Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ let buildInfoCache: BuildInfo | null = null;
const taskSourceStr: string = "C/C++";
const cppInstallVsixStr: string = 'C/C++: Install vsix -- ';
let taskProvider: vscode.Disposable;
const intelliSenseDisabledError: string = "Do not activate the extension when IntelliSense is disabled.";

/**
* activate: set up the extension for language services
Expand Down Expand Up @@ -150,7 +151,15 @@ export async function getBuildTasks(returnComplerPath: boolean): Promise<vscode.
// for the active file, remove duplicate compiler names, then finally add the user's compilerPath setting.
let compilerPaths: string[];
const isWindows: boolean = os.platform() === 'win32';
const activeClient: Client = getActiveClient();
let activeClient: Client;
try {
activeClient = getActiveClient();
} catch (e) {
if (!e || e.message !== intelliSenseDisabledError) {
console.error("Unknown error calling getActiveClient().");
}
return []; // Language service features may be disabled.
}
let userCompilerPath: string = await activeClient.getCompilerPath();
if (userCompilerPath) {
userCompilerPath = userCompilerPath.trim();
Expand Down Expand Up @@ -280,7 +289,7 @@ function onActivationEvent(): void {

function realActivation(): void {
if (new CppSettings().intelliSenseEngine === "Disabled") {
throw new Error("Do not activate the extension when IntelliSense is disabled.");
throw new Error(intelliSenseDisabledError);
} else {
console.log("activating extension");
let checkForConflictingExtensions: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".checkForConflictingExtensions", true);
Expand Down