Skip to content

Commit 3f1ad20

Browse files
Merge pull request #442 from jpogran/GH-335-option-to-disable-languageserver
(GH-335) Add option to disable language server
2 parents 3839b2f + e104417 commit 3f1ad20

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/extension.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { OutputChannelLogger } from './logging/outputchannel';
1919
import { PuppetCommandStrings } from './messages';
2020
import { PuppetStatusBar } from './PuppetStatusBar';
2121
import { ISettings, legacySettings, settingsFromWorkspace } from './settings';
22-
import { Reporter } from './telemetry/telemetry';
22+
import { Reporter, reporter } from './telemetry/telemetry';
2323

2424
const langID = 'puppet'; // don't change this
2525
let 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

Comments
 (0)