From 2a94a2b26df09588e22e27a7f885574580dff4c6 Mon Sep 17 00:00:00 2001 From: Sean McManus Date: Thu, 14 Jan 2021 17:05:50 -0800 Subject: [PATCH 1/3] Fix configuration status bar issue. Update changelog. (#6782) * Fix configuration status bar issue. Update changelog. --- Extension/CHANGELOG.md | 4 +++- Extension/src/LanguageServer/ui.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index b7d4c0faa2..59e38aed47 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -1,6 +1,6 @@ # C/C++ for Visual Studio Code Change Log -## Version 1.2.0-insiders: January 14, 2021 +## Version 1.2.0-insiders: January 14, 2021 ### New Features * Add support for cross-compilation configurations for IntelliSense. For example, `intelliSenseMode` value "linux-gcc-x64" could be used on a Mac host machine. [#1083](https://github.com/microsoft/vscode-cpptools/issues/1083) * Add `C_Cpp.addNodeAddonIncludePaths` setting to add include paths from `nan` and `node-addon-api` when they're dependencies. [#4854](https://github.com/microsoft/vscode-cpptools/issues/4854) @@ -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/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"); From 3e2488a9e781059d245ea6773bb308ee818db7ae Mon Sep 17 00:00:00 2001 From: Michelle Matias <38734287+michelleangela@users.noreply.github.com> Date: Thu, 14 Jan 2021 17:15:42 -0800 Subject: [PATCH 2/3] fix config name UI error (#6783) --- Extension/src/LanguageServer/configurations.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; From 8e8482b52715453def38e7bb644e1259691128e1 Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson <49173979+Colengms@users.noreply.github.com> Date: Thu, 14 Jan 2021 18:21:09 -0800 Subject: [PATCH 3/3] Fix issue with multiple didOpen (#6784) --- Extension/src/LanguageServer/extension.ts | 2 +- .../src/LanguageServer/protocolFilter.ts | 58 ++++++++++--------- 2 files changed, 31 insertions(+), 29 deletions(-) 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 {