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
2 changes: 1 addition & 1 deletion Documentation/LanguageServer/c_cpp_properties.json.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The documentation for c_cpp_properties.json has moved to https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference.
The documentation for c_cpp_properties.json has moved to https://code.visualstudio.com/docs/cpp/customize-cpp-settings.
12 changes: 12 additions & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# C/C++ for Visual Studio Code Changelog

## Version 1.27.3: September 3, 2025
### Enhancements
* Show a warning when too many files are processed in a workspace. [#10828](https://github.com/microsoft/vscode-cpptools/issues/10828)
* Update GitHub Copilot APIs. [PR #13877](https://github.com/microsoft/vscode-cpptools/pull/13877)
* Thank you for the contribution. [@dbaeumer (Dirk Bäumer)](https://github.com/dbaeumer)

### Bug Fixes
* Fix input delays when editing `c_cpp_properties.json`. [#13591](https://github.com/microsoft/vscode-cpptools/issues/13591)
* Fix non-recursive browse paths from configuration providers. [#13886](https://github.com/microsoft/vscode-cpptools/issues/13886)
* Fix an IntelliSense process crash involving `requires` expressions and templates.
* Fix an IntelliSense process crash with `class_has_mutable_member`.

## Version 1.27.2: August 21, 2025
### Bug Fix
* Fix a crash regression with `__BASE_FILE__`. [#13866](https://github.com/microsoft/vscode-cpptools/issues/13866)
Expand Down
2 changes: 1 addition & 1 deletion Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "1.27.2-main",
"version": "1.27.3-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
Expand Down
159 changes: 106 additions & 53 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { CopilotCompletionContextFeatures, CopilotCompletionContextProvider } fr
import { CustomConfigurationProvider1, getCustomConfigProviders, isSameProviderExtensionId } from './customProviders';
import { DataBinding } from './dataBinding';
import { cachedEditorConfigSettings, getEditorConfigSettings } from './editorConfig';
import { CppSourceStr, clients, configPrefix, initializeIntervalTimer, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
import { CppSourceStr, clients, configPrefix, initializeIntervalTimer, isWritingCrashCallStack, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
import { LocalizeStringParams, getLocaleId, getLocalizedString } from './localization';
import { PersistentFolderState, PersistentState, PersistentWorkspaceState } from './persistentState';
import { RequestCancelled, ServerCancelled, createProtocolFilter } from './protocolFilter';
Expand Down Expand Up @@ -953,6 +953,8 @@ export class DefaultClient implements Client {
public getShowConfigureIntelliSenseButton(): boolean { return this.showConfigureIntelliSenseButton; }
public setShowConfigureIntelliSenseButton(show: boolean): void { this.showConfigureIntelliSenseButton = show; }

private lastInvokedLspMessage: string = ""; // e.g. cpptools/hover

/**
* don't use this.rootFolder directly since it can be undefined
*/
Expand Down Expand Up @@ -1688,7 +1690,6 @@ export class DefaultClient implements Client {
closed: () => {
languageClientCrashTimes.push(Date.now());
languageClientCrashedNeedsRestart = true;
telemetry.logLanguageServerEvent("languageClientCrash");
let restart: boolean = true;
if (languageClientCrashTimes.length < 5) {
void clients.recreateClients();
Expand All @@ -1702,6 +1703,26 @@ export class DefaultClient implements Client {
void clients.recreateClients();
}
}

// Wait 1 second to allow time for the file watcher to signal a crash call stack write has occurred.
setTimeout(() => {
telemetry.logLanguageServerEvent("languageClientCrash",
{
lastInvokedLspMessage: this.lastInvokedLspMessage
},
{
restarting: Number(restart),
writingCrashCallStack: Number(isWritingCrashCallStack),
initializingWorkspace: Number(this.model.isInitializingWorkspace.Value),
indexingWorkspace: Number(this.model.isIndexingWorkspace.Value),
parsingWorkspace: Number(this.model.isParsingWorkspace.Value),
parsingFiles: Number(this.model.isParsingFiles.Value),
updatingIntelliSense: Number(this.model.isUpdatingIntelliSense.Value),
runningCodeAnalysis: Number(this.model.isRunningCodeAnalysis.Value)
}
);
}, 1000);

const message: string = restart ? localize('server.crashed.restart', 'The language server crashed. Restarting...')
: localize('server.crashed2', 'The language server crashed 5 times in the last 3 minutes. It will not be restarted.');

Expand All @@ -1723,7 +1744,7 @@ export class DefaultClient implements Client {
languageClient = new LanguageClient(`cpptools`, serverOptions, clientOptions);
languageClient.onNotification(DebugProtocolNotification, logDebugProtocol);
languageClient.onNotification(DebugLogNotification, logLocalized);
languageClient.onNotification(LogTelemetryNotification, (e) => this.logTelemetry(e));
languageClient.onNotification(LogTelemetryNotification, (e) => void this.logTelemetry(e));
languageClient.onNotification(ShowMessageWindowNotification, showMessageWindow);
languageClient.registerProposedFeatures();
await languageClient.start();
Expand Down Expand Up @@ -2757,66 +2778,98 @@ export class DefaultClient implements Client {
}
}

private logTelemetry(notificationBody: TelemetryPayload): void {
private excessiveFilesWarningShown: boolean = false;
private async logTelemetry(notificationBody: TelemetryPayload): Promise<void> {
if (notificationBody.event === "includeSquiggles" && this.configurationProvider && notificationBody.properties) {
notificationBody.properties["providerId"] = this.configurationProvider;
}

const showExcessiveFilesWarning = new PersistentWorkspaceState<boolean>('CPP.showExcessiveFilesWarning', true);
if (!this.excessiveFilesWarningShown && showExcessiveFilesWarning.Value && notificationBody.event === 'ParsingStats') {
const filesDiscovered = notificationBody.metrics?.filesDiscovered ?? 0;
const parsableFiles = notificationBody.metrics?.parsableFiles ?? 0;
if (filesDiscovered > 250000 || parsableFiles > 100000) {
// According to telemetry, less than 3% of workspaces have this many files so it seems like a reasonable threshold.

const message = localize(
"parsing.stats.large.project",
'Enumerated {0} files with {1} C/C++ source files detected. You may want to consider excluding some files for better performance.',
filesDiscovered,
parsableFiles);
const learnMore = localize('learn.more', 'Learn More');
const dontShowAgain = localize('dont.show.again', 'Don\'t Show Again');

// We only want to show this once per session.
this.excessiveFilesWarningShown = true;
const response = await vscode.window.showInformationMessage(message, learnMore, dontShowAgain);

if (response === dontShowAgain) {
showExcessiveFilesWarning.Value = false;
} else if (response === learnMore) {
void vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://go.microsoft.com/fwlink/?linkid=2333292'));
}
}
}
telemetry.logLanguageServerEvent(notificationBody.event, notificationBody.properties, notificationBody.metrics);
}

private async updateStatus(notificationBody: ReportStatusNotificationBody): Promise<void> {
const message: string = notificationBody.status;
util.setProgress(util.getProgressExecutableSuccess());
const testHook: TestHook = getTestHook();
if (message.endsWith("Idle")) {
const status: IntelliSenseStatus = { status: Status.Idle };
testHook.updateStatus(status);
} else if (message.endsWith("Parsing")) {
this.model.isParsingWorkspace.Value = true;
this.model.isInitializingWorkspace.Value = false;
this.model.isIndexingWorkspace.Value = false;
const status: IntelliSenseStatus = { status: Status.TagParsingBegun };
testHook.updateStatus(status);
} else if (message.endsWith("Initializing")) {
this.model.isInitializingWorkspace.Value = true;
this.model.isIndexingWorkspace.Value = false;
this.model.isParsingWorkspace.Value = false;
} else if (message.endsWith("Indexing")) {
this.model.isIndexingWorkspace.Value = true;
this.model.isInitializingWorkspace.Value = false;
this.model.isParsingWorkspace.Value = false;
} else if (message.endsWith("files")) {
this.model.isParsingFiles.Value = true;
} else if (message.endsWith("IntelliSense")) {
timeStamp = Date.now();
this.model.isUpdatingIntelliSense.Value = true;
const status: IntelliSenseStatus = { status: Status.IntelliSenseCompiling };
testHook.updateStatus(status);
} else if (message.endsWith("IntelliSense done")) {
getOutputChannelLogger().appendLineAtLevel(6, localize("update.intellisense.time", "Update IntelliSense time (sec): {0}", (Date.now() - timeStamp) / 1000));
this.model.isUpdatingIntelliSense.Value = false;
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady };
testHook.updateStatus(status);
} else if (message.endsWith("Parsing done")) { // Tag Parser Ready
this.model.isParsingWorkspace.Value = false;
const status: IntelliSenseStatus = { status: Status.TagParsingDone };
testHook.updateStatus(status);
util.setProgress(util.getProgressParseRootSuccess());
} else if (message.endsWith("files done")) {
this.model.isParsingFiles.Value = false;
} else if (message.endsWith("Analysis")) {
this.model.isRunningCodeAnalysis.Value = true;
this.model.codeAnalysisTotal.Value = 1;
this.model.codeAnalysisProcessed.Value = 0;
} else if (message.endsWith("Analysis done")) {
this.model.isRunningCodeAnalysis.Value = false;
} else if (message.includes("Squiggles Finished - File name:")) {
const index: number = message.lastIndexOf(":");
const name: string = message.substring(index + 2);
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady, filename: name };
testHook.updateStatus(status);
} else if (message.endsWith("No Squiggles")) {
util.setIntelliSenseProgress(util.getProgressIntelliSenseNoSquiggles());
if (message.startsWith("C_Cpp: ")) {
if (message.endsWith("Idle")) {
const status: IntelliSenseStatus = { status: Status.Idle };
testHook.updateStatus(status);
} else if (message.endsWith("Parsing")) {
this.model.isParsingWorkspace.Value = true;
this.model.isInitializingWorkspace.Value = false;
this.model.isIndexingWorkspace.Value = false;
const status: IntelliSenseStatus = { status: Status.TagParsingBegun };
testHook.updateStatus(status);
} else if (message.endsWith("Initializing")) {
this.model.isInitializingWorkspace.Value = true;
this.model.isIndexingWorkspace.Value = false;
this.model.isParsingWorkspace.Value = false;
} else if (message.endsWith("Indexing")) {
this.model.isIndexingWorkspace.Value = true;
this.model.isInitializingWorkspace.Value = false;
this.model.isParsingWorkspace.Value = false;
} else if (message.endsWith("files")) {
this.model.isParsingFiles.Value = true;
} else if (message.endsWith("IntelliSense")) {
timeStamp = Date.now();
this.model.isUpdatingIntelliSense.Value = true;
const status: IntelliSenseStatus = { status: Status.IntelliSenseCompiling };
testHook.updateStatus(status);
} else if (message.endsWith("IntelliSense done")) {
getOutputChannelLogger().appendLineAtLevel(6, localize("update.intellisense.time", "Update IntelliSense time (sec): {0}", (Date.now() - timeStamp) / 1000));
this.model.isUpdatingIntelliSense.Value = false;
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady };
testHook.updateStatus(status);
} else if (message.endsWith("Parsing done")) { // Tag Parser Ready
this.model.isParsingWorkspace.Value = false;
const status: IntelliSenseStatus = { status: Status.TagParsingDone };
testHook.updateStatus(status);
util.setProgress(util.getProgressParseRootSuccess());
} else if (message.endsWith("files done")) {
this.model.isParsingFiles.Value = false;
} else if (message.endsWith("Analysis")) {
this.model.isRunningCodeAnalysis.Value = true;
this.model.codeAnalysisTotal.Value = 1;
this.model.codeAnalysisProcessed.Value = 0;
} else if (message.endsWith("Analysis done")) {
this.model.isRunningCodeAnalysis.Value = false;
} else if (message.includes("Squiggles Finished - File name:")) {
const index: number = message.lastIndexOf(":");
const name: string = message.substring(index + 2);
const status: IntelliSenseStatus = { status: Status.IntelliSenseReady, filename: name };
testHook.updateStatus(status);
} else if (message.endsWith("No Squiggles")) {
util.setIntelliSenseProgress(util.getProgressIntelliSenseNoSquiggles());
}
} else if (message.includes("/")) {
this.lastInvokedLspMessage = message;
}
}

Expand Down
Loading