Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3379,6 +3379,17 @@
"default": "default",
"markdownDescription": "%c_cpp.configuration.copilotHover.markdownDescription%",
"scope": "window"
},
"C_Cpp.windowsErrorReportingMode": {
"type": "string",
"enum": [
"default",
"enabled",
"disabled"
],
"default": "default",
"markdownDescription": "%c_cpp.configuration.windowsErrorReportingMode.markdownDescription%",
"scope": "window"
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion Extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,12 @@
"{Locked=\"`disabled`\"} {Locked=\"Copilot\"}"
]
},
"c_cpp.configuration.windowsErrorReportingMode.markdownDescription": {
"message": "If `disabled`, Windows Error Reporting will be disabled. If `default`, Windows Error Reporting will be enabled, but it becomes disabled after the first crash in the current session. Changing the setting doesn't affect currently running IntelliSense processes.",
"comment": [
"{Locked=\"`disabled`\"} {Locked=\"`default`\"} {Locked=\"`IntelliSense`\"}"
]
},
"c_cpp.configuration.renameRequiresIdentifier.markdownDescription": {
"message": "If `true`, 'Rename Symbol' will require a valid C/C++ identifier.",
"comment": [
Expand Down Expand Up @@ -1084,4 +1090,4 @@
"c_cpp.configuration.refactoring.includeHeader.never.description": "Never include the header file.",
"c_cpp.languageModelTools.configuration.displayName": "C/C++ configuration",
"c_cpp.languageModelTools.configuration.userDescription": "Configuration of the active C or C++ file, like language standard version and target platform."
}
}
9 changes: 9 additions & 0 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function hasTrustedCompilerPaths(): boolean {
// Data shared by all clients.
let languageClient: LanguageClient;
let firstClientStarted: Promise<{ wasShutdown: boolean }>;
let languageClientHasCrashed: boolean = false;
let languageClientCrashedNeedsRestart: boolean = false;
const languageClientCrashTimes: number[] = [];
let compilerDefaults: configs.CompilerDefaults | undefined;
Expand Down Expand Up @@ -1600,6 +1601,7 @@ export class DefaultClient implements Client {
codeAnalysisMaxMemory: workspaceSettings.codeAnalysisMaxMemory,
codeAnalysisUpdateDelay: workspaceSettings.codeAnalysisUpdateDelay,
copilotHover: workspaceSettings.copilotHover,
windowsErrorReportingMode: workspaceSettings.windowsErrorReportingMode,
workspaceFolderSettings: workspaceFolderSettingsParams
};
}
Expand Down Expand Up @@ -1688,6 +1690,7 @@ export class DefaultClient implements Client {
errorHandler: {
error: (_error, _message, _count) => ({ action: ErrorAction.Continue }),
closed: () => {
languageClientHasCrashed = true;
languageClientCrashTimes.push(Date.now());
languageClientCrashedNeedsRestart = true;
let restart: boolean = true;
Expand Down Expand Up @@ -1752,6 +1755,12 @@ export class DefaultClient implements Client {

if (usesCrashHandler()) {
watchForCrashes(await languageClient.sendRequest(PreInitializationRequest, null));
} else if (os.platform() === "win32") {
const settings: CppSettings = new CppSettings();
if ((settings.windowsErrorReportingMode === "default" && !languageClientHasCrashed) ||
settings.windowsErrorReportingMode === "enabled") {
await languageClient.sendRequest(PreInitializationRequest, null);
}
}

// Move initialization to a separate message, so we can see log output from it.
Expand Down
2 changes: 2 additions & 0 deletions Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export interface SettingsParams {
codeAnalysisUpdateDelay: number;
workspaceFolderSettings: WorkspaceFolderSettingsParams[];
copilotHover: string;
windowsErrorReportingMode: string;
}

function getTarget(): vscode.ConfigurationTarget {
Expand Down Expand Up @@ -478,6 +479,7 @@ export class CppSettings extends Settings {
}
return this.getAsString("copilotHover");
}
public get windowsErrorReportingMode(): string { return this.getAsString("windowsErrorReportingMode"); }
public get cppContextProviderParams(): string | undefined {
const value = super.Section.get<any>("copilotContextProviderParams");
if (isString(value)) {
Expand Down