File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 22 "name" : " elastic-docs-v3-utilities" ,
33 "displayName" : " Elastic Docs Utilities" ,
44 "description" : " Utilities for Elastic Docs authoring" ,
5- "version" : " 0.11.12 " ,
5+ "version" : " 0.11.13 " ,
66 "publisher" : " Elastic" ,
77 "repository" : {
88 "type" : " git" ,
1616 ],
1717 "icon" : " images/icon.png" ,
1818 "activationEvents" : [
19- " onLanguage:markdown" ,
20- " onStartupFinished"
19+ " onLanguage:markdown"
2120 ],
2221 "main" : " ./out/extension.js" ,
2322 "browser" : " ./out/extension-web.js" ,
Original file line number Diff line number Diff line change @@ -247,6 +247,17 @@ export function activate(context: vscode.ExtensionContext): void {
247247function applyColorCustomizations ( ) : void {
248248 const config = vscode . workspace . getConfiguration ( 'editor' ) ;
249249 const currentCustomizations = config . get ( 'tokenColorCustomizations' ) as Record < string , unknown > || { } ;
250+ const existingRules = ( currentCustomizations . textMateRules as Array < { scope ?: string } > ) || [ ] ;
251+
252+ // Check if our rules are already applied by looking for a known elastic scope
253+ const elasticRulesAlreadyApplied = existingRules . some (
254+ rule => rule . scope && rule . scope . includes ( '.elastic' )
255+ ) ;
256+
257+ if ( elasticRulesAlreadyApplied ) {
258+ // Rules already exist, skip the expensive settings write
259+ return ;
260+ }
250261
251262 // Define our custom color rules
252263 const elasticRules = [
@@ -327,11 +338,9 @@ function applyColorCustomizations(): void {
327338 }
328339 ] ;
329340
330- // Merge with existing rules
331- const existingRules = ( currentCustomizations . textMateRules as unknown [ ] ) || [ ] ;
341+ // Merge with existing rules and apply (only on first activation)
332342 const newRules = [ ...existingRules , ...elasticRules ] ;
333343
334- // Apply the customizations
335344 config . update ( 'tokenColorCustomizations' , {
336345 ...currentCustomizations ,
337346 textMateRules : newRules
You can’t perform that action at this time.
0 commit comments