diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index f6414188e7..59e38aed47 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -10,6 +10,7 @@ * Show configuration squiggles when configurations with the same name exist. [#3412](https://github.com/microsoft/vscode-cpptools/issues/3412) * Add command `Generate EditorConfig contents from VC Format settings`. [#6018](https://github.com/microsoft/vscode-cpptools/issues/6018) * Update to clang-format 11.1. [#6326](https://github.com/microsoft/vscode-cpptools/issues/6326) +* Add clang-format built for Windows ARM64. [#6494](https://github.com/microsoft/vscode-cpptools/issues/6494) * Add support for the `/await` flag with msvc IntelliSense. [#6596](https://github.com/microsoft/vscode-cpptools/issues/6596) * Increase document/workspace symbol limit from 1000 to 10000. [#6766](https://github.com/microsoft/vscode-cpptools/issues/6766) @@ -62,6 +63,7 @@ * Fix `.` to `->` completion with multiple cursors. [#6720](https://github.com/microsoft/vscode-cpptools/issues/6720) * Fix bug with configured cl.exe path not being used to choose appropriate system include paths, or cl.exe not being used at all if it's not also installed via the VS Installer. [#6746](https://github.com/microsoft/vscode-cpptools/issues/6746) * Fix bugs with parsing of quotes and escape sequences in compiler args. [#6761](https://github.com/microsoft/vscode-cpptools/issues/6761) +* Fix the configuration not showing in the status bar when `c_cpp_properties.json` is active. [#6765](https://github.com/microsoft/vscode-cpptools/issues/6765) * Fix "D" command line warnings not appearing with cl.exe cppbuild build tasks. * Fix cl.exe cppbuild tasks when `/nologo` is used (and make /nologo a default arg). * Fix a cpptools crash and multiple deadlocks. diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts index f47381ca03..b7fee2d3c9 100644 --- a/Extension/src/LanguageServer/configurations.ts +++ b/Extension/src/LanguageServer/configurations.ts @@ -1375,8 +1375,9 @@ export class CppProperties { private isConfigNameUnique(configName: string): string | undefined { let errorMsg: string | undefined; + // TODO: make configName non-case sensitive. const occurrences: number | undefined = this.ConfigurationNames?.filter(function (name): boolean { return name === configName; }).length; - if (occurrences) { + if (occurrences && occurrences > 1) { errorMsg = localize('duplicate.name', "{0} is a duplicate. The configuration name should be unique.", configName); } return errorMsg; diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index bc26fe0a27..943f5e5f9b 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -432,10 +432,10 @@ export function processDelayedDidOpen(document: vscode.TextDocument): void { const client: Client = clients.getClientFor(document.uri); if (client) { // Log warm start. - clients.timeTelemetryCollector.setDidOpenTime(document.uri); if (clients.checkOwnership(client, document)) { if (!client.TrackedDocuments.has(document)) { // If not yet tracked, process as a newly opened file. (didOpen is sent to server in client.takeOwnership()). + clients.timeTelemetryCollector.setDidOpenTime(document.uri); client.TrackedDocuments.add(document); const finishDidOpen = (doc: vscode.TextDocument) => { client.provideCustomConfiguration(doc.uri, undefined); diff --git a/Extension/src/LanguageServer/protocolFilter.ts b/Extension/src/LanguageServer/protocolFilter.ts index b76697df40..433d6bdab6 100644 --- a/Extension/src/LanguageServer/protocolFilter.ts +++ b/Extension/src/LanguageServer/protocolFilter.ts @@ -26,40 +26,42 @@ export function createProtocolFilter(clients: ClientCollection): Middleware { didOpen: (document, sendMessage) => { const editor: vscode.TextEditor | undefined = vscode.window.visibleTextEditors.find(e => e.document === document); if (editor) { - // Log warm start. - clients.timeTelemetryCollector.setDidOpenTime(document.uri); // If the file was visible editor when we were activated, we will not get a call to // onDidChangeVisibleTextEditors, so immediately open any file that is visible when we receive didOpen. // Otherwise, we defer opening the file until it's actually visible. const me: Client = clients.getClientFor(document.uri); - if (clients.checkOwnership(me, document)) { - me.TrackedDocuments.add(document); - const finishDidOpen = (doc: vscode.TextDocument) => { - me.provideCustomConfiguration(doc.uri, undefined); - me.notifyWhenReady(() => { - sendMessage(doc); - me.onDidOpenTextDocument(doc); - if (editor && editor === vscode.window.activeTextEditor) { - onDidChangeActiveTextEditor(editor); - } - }); - }; - let languageChanged: boolean = false; - if ((document.uri.path.endsWith(".C") || document.uri.path.endsWith(".H")) && document.languageId === "c") { - const cppSettings: CppSettings = new CppSettings(); - if (cppSettings.autoAddFileAssociations) { - const fileName: string = path.basename(document.uri.fsPath); - const mappingString: string = fileName + "@" + document.uri.fsPath; - me.addFileAssociations(mappingString, false); - me.sendDidChangeSettings({ files: { associations: new OtherSettings().filesAssociations }}); - vscode.languages.setTextDocumentLanguage(document, "cpp").then((newDoc: vscode.TextDocument) => { - finishDidOpen(newDoc); + if (!me.TrackedDocuments.has(document)) { + // Log warm start. + clients.timeTelemetryCollector.setDidOpenTime(document.uri); + if (clients.checkOwnership(me, document)) { + me.TrackedDocuments.add(document); + const finishDidOpen = (doc: vscode.TextDocument) => { + me.provideCustomConfiguration(doc.uri, undefined); + me.notifyWhenReady(() => { + sendMessage(doc); + me.onDidOpenTextDocument(doc); + if (editor && editor === vscode.window.activeTextEditor) { + onDidChangeActiveTextEditor(editor); + } }); - languageChanged = true; + }; + let languageChanged: boolean = false; + if ((document.uri.path.endsWith(".C") || document.uri.path.endsWith(".H")) && document.languageId === "c") { + const cppSettings: CppSettings = new CppSettings(); + if (cppSettings.autoAddFileAssociations) { + const fileName: string = path.basename(document.uri.fsPath); + const mappingString: string = fileName + "@" + document.uri.fsPath; + me.addFileAssociations(mappingString, false); + me.sendDidChangeSettings({ files: { associations: new OtherSettings().filesAssociations }}); + vscode.languages.setTextDocumentLanguage(document, "cpp").then((newDoc: vscode.TextDocument) => { + finishDidOpen(newDoc); + }); + languageChanged = true; + } + } + if (!languageChanged) { + finishDidOpen(document); } - } - if (!languageChanged) { - finishDidOpen(document); } } } else { diff --git a/Extension/src/LanguageServer/ui.ts b/Extension/src/LanguageServer/ui.ts index cd8d722e7e..9494d21350 100644 --- a/Extension/src/LanguageServer/ui.ts +++ b/Extension/src/LanguageServer/ui.ts @@ -165,7 +165,7 @@ export class UI { const isCpp: boolean = (activeEditor.document.uri.scheme === "file" && (activeEditor.document.languageId === "cpp" || activeEditor.document.languageId === "c")); let isCppPropertiesJson: boolean = false; - if (activeEditor.document.languageId === "json") { + if (activeEditor.document.languageId === "json" || activeEditor.document.languageId === "jsonc") { isCppPropertiesJson = activeEditor.document.fileName.endsWith("c_cpp_properties.json"); if (isCppPropertiesJson) { vscode.languages.setTextDocumentLanguage(activeEditor.document, "jsonc");