@@ -19,7 +19,7 @@ import { OutputChannelLogger } from './logging/outputchannel';
1919import { PuppetCommandStrings } from './messages' ;
2020import { PuppetStatusBar } from './PuppetStatusBar' ;
2121import { ISettings , legacySettings , settingsFromWorkspace } from './settings' ;
22- import { Reporter } from './telemetry/telemetry' ;
22+ import { Reporter , reporter } from './telemetry/telemetry' ;
2323
2424const langID = 'puppet' ; // don't change this
2525let extContext : vscode . ExtensionContext ;
@@ -43,6 +43,12 @@ export function activate(context: vscode.ExtensionContext) {
4343 statusBar = new PuppetStatusBar ( langID , context , logger ) ;
4444 configSettings = new ConnectionConfiguration ( ) ;
4545
46+ if ( settings . editorService . enable === false ) {
47+ notifyEditorServiceDisabled ( extContext ) ;
48+ reporter . sendTelemetryEvent ( 'editorServiceDisabled' ) ;
49+ return ;
50+ }
51+
4652 if ( checkInstallDirectory ( configSettings , logger ) === false ) {
4753 // If this returns false, then we needed a local directory
4854 // but did not find it, so we should abort here
@@ -166,3 +172,26 @@ async function notifyOnNewExtensionVersion(context: vscode.ExtensionContext) {
166172 context . globalState . update ( suppressUpdateNotice , true ) ;
167173 }
168174}
175+
176+ async function notifyEditorServiceDisabled ( context : vscode . ExtensionContext ) {
177+ const suppressEditorServicesDisabled = 'suppressEditorServicesDisabled' ;
178+ const dontShowAgainNotice = "Don't show again" ;
179+
180+ if ( context . globalState . get ( suppressEditorServicesDisabled , false ) ) {
181+ return ;
182+ }
183+
184+ const result = await vscode . window . showInformationMessage (
185+ `Puppet Editor Services has been disabled. While syntax highlighting and grammar detection will still work, intellisense and other advanced features will not.` ,
186+ { modal : false } ,
187+ { title : dontShowAgainNotice }
188+ ) ;
189+
190+ if ( result === undefined ) {
191+ return ;
192+ }
193+
194+ if ( result . title === dontShowAgainNotice ) {
195+ context . globalState . update ( suppressEditorServicesDisabled , true ) ;
196+ }
197+ }
0 commit comments