From 0364ab04ce3e1fecc1a30e5b93015c34c946f472 Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson <49173979+Colengms@users.noreply.github.com> Date: Tue, 1 Oct 2024 17:24:27 -0700 Subject: [PATCH 1/7] Fix issue with Rename UI lingering after cancellation (#12796) --- .../Providers/callHierarchyProvider.ts | 29 +++++++------------ .../Providers/findAllReferencesProvider.ts | 11 +++---- .../Providers/renameProvider.ts | 11 +++---- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/Extension/src/LanguageServer/Providers/callHierarchyProvider.ts b/Extension/src/LanguageServer/Providers/callHierarchyProvider.ts index 0abb04a5d3..82bcf39efd 100644 --- a/Extension/src/LanguageServer/Providers/callHierarchyProvider.ts +++ b/Extension/src/LanguageServer/Providers/callHierarchyProvider.ts @@ -51,12 +51,6 @@ export interface CallHierarchyParams { interface CallHierarchyItemResult { item?: CallHierarchyItem; - - /** - * If a request is cancelled, `succeeded` will be undefined to indicate no result was returned. - * Therefore, object is not defined as optional on the language server. - */ - succeeded: boolean; } interface CallHierarchyCallsItem { @@ -137,16 +131,15 @@ export class CallHierarchyProvider implements vscode.CallHierarchyProvider { } throw e; } - cancellationTokenListener.dispose(); - requestCanceledListener.dispose(); + finally { + cancellationTokenListener.dispose(); + requestCanceledListener.dispose(); + } - if (cancelSource.token.isCancellationRequested || response.succeeded === undefined) { - // Return undefined instead of vscode.CancellationError to avoid the following error message from VS Code: - // "MISSING provider." - // TODO: per issue https://github.com/microsoft/vscode/issues/169698 vscode.CancellationError is expected, - // so when VS Code fixes the error use vscode.CancellationError again. - return undefined; - } else if (response.item === undefined) { + if (cancelSource.token.isCancellationRequested) { + throw new vscode.CancellationError(); + } + if (response.item === undefined) { return undefined; } @@ -154,8 +147,7 @@ export class CallHierarchyProvider implements vscode.CallHierarchyProvider { return this.makeVscodeCallHierarchyItem(response.item); } - public async provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): - Promise { + public async provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise { await this.client.ready; workspaceReferences.cancelCurrentReferenceRequest(CancellationSender.NewRequest); @@ -215,8 +207,7 @@ export class CallHierarchyProvider implements vscode.CallHierarchyProvider { return result; } - public async provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): - Promise { + public async provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise { const CallHierarchyCallsFromEvent: string = "CallHierarchyCallsFrom"; if (item === undefined) { this.logTelemetry(CallHierarchyCallsFromEvent, CallHierarchyRequestStatus.Failed); diff --git a/Extension/src/LanguageServer/Providers/findAllReferencesProvider.ts b/Extension/src/LanguageServer/Providers/findAllReferencesProvider.ts index 01b2dc18e2..ffdb1cf9e2 100644 --- a/Extension/src/LanguageServer/Providers/findAllReferencesProvider.ts +++ b/Extension/src/LanguageServer/Providers/findAllReferencesProvider.ts @@ -45,11 +45,12 @@ export class FindAllReferencesProvider implements vscode.ReferenceProvider { throw e; } } - - // Reset anything that can be cleared before processing the result. - workspaceReferences.resetProgressBar(); - cancellationTokenListener.dispose(); - requestCanceledListener.dispose(); + finally { + // Reset anything that can be cleared before processing the result. + workspaceReferences.resetProgressBar(); + cancellationTokenListener.dispose(); + requestCanceledListener.dispose(); + } // Process the result. if (cancelSource.token.isCancellationRequested || cancelled || (response && response.isCanceled)) { diff --git a/Extension/src/LanguageServer/Providers/renameProvider.ts b/Extension/src/LanguageServer/Providers/renameProvider.ts index 8a46d81c8c..ea93ba1c2b 100644 --- a/Extension/src/LanguageServer/Providers/renameProvider.ts +++ b/Extension/src/LanguageServer/Providers/renameProvider.ts @@ -57,11 +57,12 @@ export class RenameProvider implements vscode.RenameProvider { } throw e; } - - // Reset anything that can be cleared before processing the result. - workspaceReferences.resetProgressBar(); - workspaceReferences.resetReferences(); - requestCanceledListener.dispose(); + finally { + // Reset anything that can be cleared before processing the result. + workspaceReferences.resetProgressBar(); + workspaceReferences.resetReferences(); + requestCanceledListener.dispose(); + } // Process the result. if (cancelSource.token.isCancellationRequested || response.isCanceled) { From 4b2dac32aa92e465c773683322df04549a925292 Mon Sep 17 00:00:00 2001 From: Ben McMorran Date: Wed, 2 Oct 2024 18:52:43 -0700 Subject: [PATCH 2/7] React to breaking changes in Copilot API (#12797) --- Extension/src/LanguageServer/extension.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index 5ed2159c79..972c0e8b83 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -33,11 +33,22 @@ import { CppSettings } from './settings'; import { LanguageStatusUI, getUI } from './ui'; import { makeLspRange, rangeEquals, showInstallCompilerWalkthrough } from './utils'; +interface CopilotTrait { + name: string; + value: string; + includeInPrompt?: boolean; + promptTextOverride?: string; +} + interface CopilotApi { registerRelatedFilesProvider( providerId: { extensionId: string; languageId: string }, - callback: (uri: vscode.Uri, token: vscode.CancellationToken) => Promise<{ entries: vscode.Uri[]; traits?: { name: string; value: string }[] }> - ): vscode.Disposable; + callback: ( + uri: vscode.Uri, + context: { flags: Record }, + cancellationToken: vscode.CancellationToken + ) => Promise<{ entries: vscode.Uri[]; traits?: CopilotTrait[] }> + ): Disposable; } nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })(); @@ -270,7 +281,7 @@ export async function activate(): Promise { for (const languageId of ['c', 'cpp', 'cuda-cpp']) { api.registerRelatedFilesProvider( { extensionId: util.extensionContext.extension.id, languageId }, - async (_uri: vscode.Uri, token: vscode.CancellationToken) => + async (_uri: vscode.Uri, _context: { flags: Record }, token: vscode.CancellationToken) => ({ entries: (await clients.ActiveClient.getIncludes(1, token))?.includedFiles.map(file => vscode.Uri.file(file)) ?? [] }) ); } From 23c9fb5a9f8b173a7cf868790a9f5b5a8c30f518 Mon Sep 17 00:00:00 2001 From: Ben McMorran Date: Thu, 3 Oct 2024 11:10:17 -0700 Subject: [PATCH 3/7] Fix break in lmTools API (#12801) --- Extension/src/LanguageServer/lmTool.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extension/src/LanguageServer/lmTool.ts b/Extension/src/LanguageServer/lmTool.ts index 6b986463e1..5951377b4e 100644 --- a/Extension/src/LanguageServer/lmTool.ts +++ b/Extension/src/LanguageServer/lmTool.ts @@ -46,8 +46,8 @@ const knownValues: { [Property in keyof ChatContextResult]?: { [id: string]: str const plainTextContentType = 'text/plain'; -export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTool { - public async invoke(options: vscode.LanguageModelToolInvocationOptions, token: vscode.CancellationToken): Promise { +export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTool { + public async invoke(options: vscode.LanguageModelToolInvocationOptions, token: vscode.CancellationToken): Promise { const result: vscode.LanguageModelToolResult = {}; if (options.requestedContentTypes.includes(plainTextContentType)) { result[plainTextContentType] = await this.getContext(token); From 34f0dd673c6734b943e2e8600f4e5a2bc704f85e Mon Sep 17 00:00:00 2001 From: Luca <681992+lukka@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:53:37 -0700 Subject: [PATCH 4/7] filter out C++ headers outside the current opened folder. (#12803) --- Extension/src/LanguageServer/client.ts | 2 +- Extension/src/LanguageServer/extension.ts | 27 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 2b1b8125b1..04dcaba701 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -529,7 +529,7 @@ interface GetIncludesParams { maxDepth: number; } -interface GetIncludesResult { +export interface GetIncludesResult { includedFiles: string[]; } diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index 972c0e8b83..47a7cd0342 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -20,7 +20,7 @@ import * as util from '../common'; import { getCrashCallStacksChannel } from '../logger'; import { PlatformInformation } from '../platform'; import * as telemetry from '../telemetry'; -import { Client, DefaultClient, DoxygenCodeActionCommandArguments, openFileVersions } from './client'; +import { Client, DefaultClient, DoxygenCodeActionCommandArguments, GetIncludesResult, openFileVersions } from './client'; import { ClientCollection } from './clientCollection'; import { CodeActionDiagnosticInfo, CodeAnalysisDiagnosticIdentifiersAndUri, codeAnalysisAllFixes, codeAnalysisCodeToFixes, codeAnalysisFileToCodeActions } from './codeAnalysis'; import { CppBuildTaskProvider } from './cppBuildTaskProvider'; @@ -282,7 +282,7 @@ export async function activate(): Promise { api.registerRelatedFilesProvider( { extensionId: util.extensionContext.extension.id, languageId }, async (_uri: vscode.Uri, _context: { flags: Record }, token: vscode.CancellationToken) => - ({ entries: (await clients.ActiveClient.getIncludes(1, token))?.includedFiles.map(file => vscode.Uri.file(file)) ?? [] }) + ({ entries: (await getIncludesWithCancellation(1, token))?.includedFiles.map(file => vscode.Uri.file(file)) ?? [] }) ); } } catch { @@ -1413,13 +1413,28 @@ export async function preReleaseCheck(): Promise { } } -export async function getIncludes(maxDepth: number): Promise { - const tokenSource = new vscode.CancellationTokenSource(); - const includes = await clients.ActiveClient.getIncludes(maxDepth, tokenSource.token); - tokenSource.dispose(); +export async function getIncludesWithCancellation(maxDepth: number, token: vscode.CancellationToken): Promise { + const includes = await clients.ActiveClient.getIncludes(maxDepth, token); + const wksFolder = clients.ActiveClient.RootUri?.toString(); + + if (!wksFolder) { + return includes; + } + + includes.includedFiles = includes.includedFiles.filter(header => vscode.Uri.file(header).toString().startsWith(wksFolder)); return includes; } +async function getIncludes(maxDepth: number): Promise { + const tokenSource = new vscode.CancellationTokenSource(); + try { + const includes = await getIncludesWithCancellation(maxDepth, tokenSource.token); + return includes; + } finally { + tokenSource.dispose(); + } +} + async function getCopilotApi(): Promise { const copilotExtension = vscode.extensions.getExtension('github.copilot'); if (!copilotExtension) { From 3324ea8c864c6b351cdaab419f431e1883728b11 Mon Sep 17 00:00:00 2001 From: Sean McManus Date: Fri, 4 Oct 2024 14:10:16 -0700 Subject: [PATCH 5/7] Update changelog for 1.22.8. (#12802) * Update changelog for 1.22.8. --- Extension/CHANGELOG.md | 106 +++++++++++------------------------------ Extension/package.json | 2 +- 2 files changed, 30 insertions(+), 78 deletions(-) diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index 8307759533..5b4a5eb068 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -1,80 +1,6 @@ # C/C++ for Visual Studio Code Changelog -## Version 1.22.7: September 30, 2024 -### Enhancement -* The .vsix and .js files are now signed. [#12725](https://github.com/microsoft/vscode-cpptools/issues/12725), [#12744](https://github.com/microsoft/vscode-cpptools/issues/12744) - -### Bug Fixes -* Fix some Copilot-related issues. [PR #12773](https://github.com/microsoft/vscode-cpptools/pull/12773) -* Fix an issue preventing use of a full command line in `compilerPath`. [PR #12774](https://github.com/microsoft/vscode-cpptools/pull/12774) -* Fix an infinite loop on shutdown after changing the selected settings. -* Fix a crash (from `insert_lines`). - -## Version 1.22.6: September 25, 2024 -### Bug Fixes -* Fix an issue with usage of `#cpp` with Copilot chat. [vscode-copilot-release#1634](https://github.com/microsoft/vscode-copilot-release/issues/1634) -* Fix a performance regression with tag parsing. -* Fix a document buffer issue related to edits within files containing multi-byte characters. - -## Version 1.22.5: September 24, 2024 -### Enhancement -* Add the database path to the `C/C++: Log Diagnostics` output. - -### Bug Fixes -* Fix some synchronization and crash issues with `handle_edits`. [#12747](https://github.com/microsoft/vscode-cpptools/issues/12747) -* Fix usage of `#cpp` with Copilot chat. [PR #12755](https://github.com/microsoft/vscode-cpptools/pull/12755) -* Fix some document buffer issues. - -## Version 1.22.4: September 19, 2024 -### Enhancements -* Performance improvements related to how custom configurations are processed. [#12632](https://github.com/microsoft/vscode-cpptools/issues/12632) -* Performance improvements related to LSP request processing. - -### Bug Fixes -* Fix an issue with missing database symbols after a Rename operation. [#12480](https://github.com/microsoft/vscode-cpptools/issues/12480) -* Work around IntelliSense issues with clang 18 due to `size_t` not being defined. [#12618](https://github.com/microsoft/vscode-cpptools/issues/12618) -* Fix some crashes with recursive includes. [#12643](https://github.com/microsoft/vscode-cpptools/issues/12643) -* Possibly fix a crash in `find_existing_intellisense_client`. [#12666](https://github.com/microsoft/vscode-cpptools/issues/12666) -* Fix issues applying `files.exclude` settings when `C_Cpp.caseSensitiveFileSupport` is enabled. [#12672](https://github.com/microsoft/vscode-cpptools/issues/12672) -* Fix an issue with duplicate tag parsing occurring after a Rename operation. [#12728](https://github.com/microsoft/vscode-cpptools/issues/12728) -* Fix an issue causing unnecessary TU updates for files opened during a Rename operation, when `"files.refactoring.autoSave": false` is used. - -## Version 1.22.3: September 12, 2024 -### Enhancement -* Add support for providing additional context information to Copilot Chat. [PR #12685](https://github.com/microsoft/vscode-cpptools/pull/12685) - * Currently, it requires `"C_Cpp.experimentalFeatures": "enabled"` and typing `#cpp` in the chat. - -### Bug Fixes -* Fix the compiler selection control not keeping the list in sync with contents of the textbox. [#7427](https://github.com/microsoft/vscode-cpptools/issues/7427) -* Fix a string localization issue. [#7824](https://github.com/microsoft/vscode-cpptools/issues/7824) -* Stop logging duplicate compiler path messages. [#12445](https://github.com/microsoft/vscode-cpptools/issues/12445) -* Fix some crashes with recursive includes. [#12643](https://github.com/microsoft/vscode-cpptools/issues/12643) -* Fix a rare crash on macOS related to `get_memory_usage`. [#12667](https://github.com/microsoft/vscode-cpptools/issues/12667) -* Fix an issue with 'Extract to Function' formatting. [#12677](https://github.com/microsoft/vscode-cpptools/issues/12677) -* Fix a potential deadlock in `process_paths`. [#12690](https://github.com/microsoft/vscode-cpptools/issues/12690) - -## Version 1.22.2: August 29, 2024 -### Enhancement -* Remove the `C_Cpp.intelliSenseEngineFallback` setting. [#12596](https://github.com/microsoft/vscode-cpptools/issues/12596) - -### Bug Fix -* Fix a deadlock when doing "Find All References" and a file is deleted. [#12656](https://github.com/microsoft/vscode-cpptools/issues/12656) - -## Version 1.22.1: August 29, 2024 -### Enhancement -* Add "Additional Tracked Settings" to `C/C++: Log Diagnostics` output. [PR #12635](https://github.com/microsoft/vscode-cpptools/pull/12635) - -### Bug Fixes -* Fix hover over static constexpr variables sometimes not working. [#12284](https://github.com/microsoft/vscode-cpptools/issues/12284) -* Fix completion not giving results in several scenarios. [#12412](https://github.com/microsoft/vscode-cpptools/issues/12412) -* Fix include completion showing results for deleted folders with recursive includes. [#12636](https://github.com/microsoft/vscode-cpptools/issues/12636) -* Fix the `/FU` flag not working for C++/CLI . [#12641](https://github.com/microsoft/vscode-cpptools/issues/12641) -* Fix some crashes with recursive includes. [#12643](https://github.com/microsoft/vscode-cpptools/issues/12643) -* Fix IntelliSense not working on Windows when `C_Cpp.caseSensitiveFileSupport` is `enabled`. [#12648](https://github.com/microsoft/vscode-cpptools/issues/12648) -* Changes that might fix a crash with `translate_encoding_to_utf8`. [#12652](https://github.com/microsoft/vscode-cpptools/issues/12652) -* Fix a random crash during IntelliSense creation. - -## Version 1.22.0: August 26, 2024 +## Version 1.22.8: October 7, 2024 ### Performance Improvements * Switch to an alternative implementation of recursive includes (that sends all the paths instead of only the "used" paths). [#11780](https://github.com/microsoft/vscode-cpptools/issues/11780) - Performance improvement: Configuration is no longer blocked on tag parsing of all dependent headers. @@ -82,28 +8,54 @@ * Initialization performance improvements. [#12030](https://github.com/microsoft/vscode-cpptools/issues/12030) - Some processing is parallelized and started earlier (populating the filename cache, discovering files). [#11954](https://github.com/microsoft/vscode-cpptools/issues/11954), [#12169](https://github.com/microsoft/vscode-cpptools/issues/12169) - Some compiler configuration queries are cached in the database, and processing of compile_commands.json was improved. [#10029](https://github.com/microsoft/vscode-cpptools/issues/10029), [#12078](https://github.com/microsoft/vscode-cpptools/issues/12078) +* Performance improvements related to how custom configurations are processed. [#9003](https://github.com/microsoft/vscode-cpptools/issues/9003), [#12632](https://github.com/microsoft/vscode-cpptools/issues/12632) * Improve the implementation of file buffers to reduce memory usage. +* Performance improvements related to LSP request processing. ### Enhancements * Add modified `C_Cpp` settings to the `C/C++: Log Diagnostics` output. [#11700](https://github.com/microsoft/vscode-cpptools/issues/11700) -* Change the default C/C++ `"editor.stickyScroll.defaultModel"` to `"foldingProviderModel"`. [#12483](https://github.com/microsoft/vscode-cpptools/issues/12483) * Add better validation for settings. [#12371](https://github.com/microsoft/vscode-cpptools/issues/12371) +* Change the default C/C++ `"editor.stickyScroll.defaultModel"` to `"foldingProviderModel"`. [#12483](https://github.com/microsoft/vscode-cpptools/issues/12483) +* Remove the `C_Cpp.intelliSenseEngineFallback` setting. [#12596](https://github.com/microsoft/vscode-cpptools/issues/12596) +* Enable `C/C++: Log Diagnostics` without a C/C++ file being active. [#12634](https://github.com/microsoft/vscode-cpptools/issues/12634) +* Add "Additional Tracked Settings" to the `C/C++: Log Diagnostics` output. [PR #12635](https://github.com/microsoft/vscode-cpptools/pull/12635) +* Add support for providing additional context information to Copilot Chat. [PR #12685](https://github.com/microsoft/vscode-cpptools/pull/12685) + * Currently, it requires `"C_Cpp.experimentalFeatures": "enabled"` and typing `#cpp` in the chat. +* The .vsix and .js files are now signed. [#12725](https://github.com/microsoft/vscode-cpptools/issues/12725), [#12744](https://github.com/microsoft/vscode-cpptools/issues/12744) +* Add the database path to the `C/C++: Log Diagnostics` output. * Various IntelliSense parsing updates/fixes. ### Bug Fixes +* Fix the compiler selection control not keeping the list in sync with the contents of the textbox. [#7427](https://github.com/microsoft/vscode-cpptools/issues/7427) +* Fix a string localization issue. [#7824](https://github.com/microsoft/vscode-cpptools/issues/7824) +* Fix an issue with lingering IntelliSense squiggles after an edit. [#12175](https://github.com/microsoft/vscode-cpptools/issues/12175) +* Fix hover over static constexpr variables sometimes not working. [#12284](https://github.com/microsoft/vscode-cpptools/issues/12284) +* Fix completion not giving results in several scenarios. [#12412](https://github.com/microsoft/vscode-cpptools/issues/12412) * Stop logging duplicate compiler path messages. [#12445](https://github.com/microsoft/vscode-cpptools/issues/12445) * Fix an issue where a file is incorrectly processed as C instead of C++. [#12466](https://github.com/microsoft/vscode-cpptools/issues/12466) +* Fix an issue with missing database symbols after a Rename operation. [#12480](https://github.com/microsoft/vscode-cpptools/issues/12480) * Fix include path ordering being incorrect if there is a duplicate. [#12525](https://github.com/microsoft/vscode-cpptools/issues/12525) * Fix a WebAssembly "Out of Memory" error. [#12529](https://github.com/microsoft/vscode-cpptools/issues/12529) * Fix an error message not being shown if the connection failed with remote attach debugging. [#12547](https://github.com/microsoft/vscode-cpptools/issues/12547) * Thank you for the contribution. [@MrStanislav0 (Stanislav)](https://github.com/MrStanislav0) * Fix `-I` not being used if `-iquote` is also used for the same path. [#12551](https://github.com/microsoft/vscode-cpptools/issues/12551) * Fix issues with relative paths on `nvcc` (CUDA) command lines not being handled correctly. [#12553](https://github.com/microsoft/vscode-cpptools/issues/12553) -* Fix a random crash when a child process is created. [#12585](https://github.com/microsoft/vscode-cpptools/issues/12585) * Fix a crash on shutdown on macOS with a verbose logging level. [#12567](https://github.com/microsoft/vscode-cpptools/issues/12567) +* Fix a random crash when a child process is created. [#12585](https://github.com/microsoft/vscode-cpptools/issues/12585) +* Work around IntelliSense issues with clang 18 due to `size_t` not being defined. [#12618](https://github.com/microsoft/vscode-cpptools/issues/12618) +* Fix the `/FU` flag not working for C++/CLI. [#12641](https://github.com/microsoft/vscode-cpptools/issues/12641) +* Fix a crash in `find_existing_intellisense_client`. [#12666](https://github.com/microsoft/vscode-cpptools/issues/12666) +* Fix a rare crash on macOS related to `get_memory_usage`. [#12667](https://github.com/microsoft/vscode-cpptools/issues/12667) +* Fix an issue with 'Extract to Function' formatting. [#12677](https://github.com/microsoft/vscode-cpptools/issues/12677) +* Fix an issue with duplicate tag parsing occurring after a Rename operation. [#12728](https://github.com/microsoft/vscode-cpptools/issues/12728) +* Fix an issue preventing use of a full command line in `compilerPath`. [PR #12774](https://github.com/microsoft/vscode-cpptools/pull/12774) +* Fix an issue causing unnecessary TU updates for files opened during a Rename operation, when `"files.refactoring.autoSave": false` is used. * Fix some issues with recursive includes handling of symbolic links, multi-root, exclusion changes, and file/folder deletion. * Fix unnecessary IntelliSense resetting when a new file or folder was created. +* Fix an infinite loop on shutdown after changing the selected settings. * Fix accumulation of stale signature help and completion requests. +* Fix handling of the `compiler-binddir` compiler argument. +* Fix a random crash during IntelliSense creation. * Fix some bugs with include completion. ## Version 1.21.6: August 5, 2024 diff --git a/Extension/package.json b/Extension/package.json index ae53da9e9c..7ec7975b7a 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -2,7 +2,7 @@ "name": "cpptools", "displayName": "C/C++", "description": "C/C++ IntelliSense, debugging, and code browsing.", - "version": "1.22.7-main", + "version": "1.22.8-main", "publisher": "ms-vscode", "icon": "LanguageCCPP_color_128x.png", "readme": "README.md", From c2badddf6fa7e9c76577563f9169ca14da104624 Mon Sep 17 00:00:00 2001 From: Bob Brown Date: Mon, 7 Oct 2024 13:54:49 -0700 Subject: [PATCH 6/7] clang-format/tidy version comparisons fail for some builds (#12813) --- Extension/src/LanguageServer/settings.ts | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Extension/src/LanguageServer/settings.ts b/Extension/src/LanguageServer/settings.ts index 5171f27793..8e8d6c0654 100644 --- a/Extension/src/LanguageServer/settings.ts +++ b/Extension/src/LanguageServer/settings.ts @@ -277,7 +277,6 @@ export class CppSettings extends Settings { if (cachedClangPath !== undefined) { return cachedClangPath; } - const clangStr: string = isFormat ? this.clangFormatStr : this.clangTidyStr; const clangName: string = isFormat ? this.clangFormatName : this.clangTidyName; const setCachedClangPath: (path: string) => void = isFormat ? setCachedClangFormatPath : setCachedClangTidyPath; const whichPath: string | null = which.sync(clangName, { nothrow: true }); @@ -290,20 +289,14 @@ export class CppSettings extends Settings { return undefined; } else { // Attempt to invoke both our own version of clang-* to see if we can successfully execute it, and to get its version. - let clangVersion: string; + let bundledVersion: string; try { - const exePath: string = getExtensionFilePath(`./LLVM/bin/${clangName}`); - const output: string[] = execSync(quote([exePath, '--version'])).toString().split(" "); - if (output.length < 3 || output[0] !== clangStr || output[1] !== "version" || !semver.valid(output[2])) { - if (output.length === 3) { - return path; - } - const versionIndex: number = output.findIndex((value: string) => value === "version"); - if (versionIndex < 0 || versionIndex + 1 >= output.length || !semver.valid(output[versionIndex + 1].trim())) { - return path; - } + const bundledPath: string = getExtensionFilePath(`./LLVM/bin/${clangName}`); + const output: string = execSync(quote([bundledPath, '--version'])).toString(); + bundledVersion = output.match(/(\d+\.\d+\.\d+)/)?.[1] ?? ""; + if (!semver.valid(bundledVersion)) { + return path; } - clangVersion = output[2]; } catch (e) { // Unable to invoke our own clang-*. Use the system installed clang-*. return path; @@ -311,8 +304,9 @@ export class CppSettings extends Settings { // Invoke the version on the system to compare versions. Use ours if it's more recent. try { - const output: string[] = execSync(`"${path}" --version`).toString().split(" "); - if (output.length < 3 || output[0] !== clangStr || output[1] !== "version" || semver.ltr(output[2], clangVersion)) { + const output: string = execSync(`"${path}" --version`).toString(); + const userVersion = output.match(/(\d+\.\d+\.\d+)/)?.[1] ?? ""; + if (semver.ltr(userVersion, bundledVersion)) { path = ""; setCachedClangPath(path); } From 292d84f55af235b7902daae4d29a6ae0ca4a8d50 Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson <49173979+Colengms@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:59:23 -0700 Subject: [PATCH 7/7] Update changelog for 1.22.8 (insiders) (#12816) --- Extension/CHANGELOG.md | 120 ++++++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 32 deletions(-) diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index 5b4a5eb068..7bba868497 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -1,6 +1,88 @@ # C/C++ for Visual Studio Code Changelog -## Version 1.22.8: October 7, 2024 +## Version 1.22.8: October 8, 2024 +### Bug Fixes +* Fix an issue with the 'Add #include' code action incorrectly using a relative path for a system include. [#12010](https://github.com/microsoft/vscode-cpptools/issues/12010) +* Fix an issue with lingering incorrect squiggles after an edit. [#12175](https://github.com/microsoft/vscode-cpptools/issues/12175) +* Fix an issue with clang-format/tidy version checks for some builds. [#12806](https://github.com/microsoft/vscode-cpptools/issues/12806) +* Revert/postpone changes related to recursive includes handling due to issues with some projects. +* Fix a memory leak. + +## Version 1.22.7: September 30, 2024 +### Enhancement +* The .vsix and .js files are now signed. [#12725](https://github.com/microsoft/vscode-cpptools/issues/12725), [#12744](https://github.com/microsoft/vscode-cpptools/issues/12744) + +### Bug Fixes +* Fix some Copilot-related issues. [PR #12773](https://github.com/microsoft/vscode-cpptools/pull/12773) +* Fix an issue preventing use of a full command line in `compilerPath`. [PR #12774](https://github.com/microsoft/vscode-cpptools/pull/12774) +* Fix an infinite loop on shutdown after changing the selected settings. +* Fix a crash (from `insert_lines`). + +## Version 1.22.6: September 25, 2024 +### Bug Fixes +* Fix an issue with usage of `#cpp` with Copilot chat. [vscode-copilot-release#1634](https://github.com/microsoft/vscode-copilot-release/issues/1634) +* Fix a performance regression with tag parsing. +* Fix a document buffer issue related to edits within files containing multi-byte characters. + +## Version 1.22.5: September 24, 2024 +### Enhancement +* Add the database path to the `C/C++: Log Diagnostics` output. + +### Bug Fixes +* Fix some synchronization and crash issues with `handle_edits`. [#12747](https://github.com/microsoft/vscode-cpptools/issues/12747) +* Fix usage of `#cpp` with Copilot chat. [PR #12755](https://github.com/microsoft/vscode-cpptools/pull/12755) +* Fix some document buffer issues. + +## Version 1.22.4: September 19, 2024 +### Enhancements +* Performance improvements related to how custom configurations are processed. [#12632](https://github.com/microsoft/vscode-cpptools/issues/12632) +* Performance improvements related to LSP request processing. + +### Bug Fixes +* Fix an issue with missing database symbols after a Rename operation. [#12480](https://github.com/microsoft/vscode-cpptools/issues/12480) +* Work around IntelliSense issues with clang 18 due to `size_t` not being defined. [#12618](https://github.com/microsoft/vscode-cpptools/issues/12618) +* Fix some crashes with recursive includes. [#12643](https://github.com/microsoft/vscode-cpptools/issues/12643) +* Possibly fix a crash in `find_existing_intellisense_client`. [#12666](https://github.com/microsoft/vscode-cpptools/issues/12666) +* Fix issues applying `files.exclude` settings when `C_Cpp.caseSensitiveFileSupport` is enabled. [#12672](https://github.com/microsoft/vscode-cpptools/issues/12672) +* Fix an issue with duplicate tag parsing occurring after a Rename operation. [#12728](https://github.com/microsoft/vscode-cpptools/issues/12728) +* Fix an issue causing unnecessary TU updates for files opened during a Rename operation, when `"files.refactoring.autoSave": false` is used. + +## Version 1.22.3: September 12, 2024 +### Enhancement +* Add support for providing additional context information to Copilot Chat. [PR #12685](https://github.com/microsoft/vscode-cpptools/pull/12685) + * Currently, it requires `"C_Cpp.experimentalFeatures": "enabled"` and typing `#cpp` in the chat. + +### Bug Fixes +* Fix the compiler selection control not keeping the list in sync with contents of the textbox. [#7427](https://github.com/microsoft/vscode-cpptools/issues/7427) +* Fix a string localization issue. [#7824](https://github.com/microsoft/vscode-cpptools/issues/7824) +* Stop logging duplicate compiler path messages. [#12445](https://github.com/microsoft/vscode-cpptools/issues/12445) +* Fix some crashes with recursive includes. [#12643](https://github.com/microsoft/vscode-cpptools/issues/12643) +* Fix a rare crash on macOS related to `get_memory_usage`. [#12667](https://github.com/microsoft/vscode-cpptools/issues/12667) +* Fix an issue with 'Extract to Function' formatting. [#12677](https://github.com/microsoft/vscode-cpptools/issues/12677) +* Fix a potential deadlock in `process_paths`. [#12690](https://github.com/microsoft/vscode-cpptools/issues/12690) + +## Version 1.22.2: August 29, 2024 +### Enhancement +* Remove the `C_Cpp.intelliSenseEngineFallback` setting. [#12596](https://github.com/microsoft/vscode-cpptools/issues/12596) + +### Bug Fix +* Fix a deadlock when doing "Find All References" and a file is deleted. [#12656](https://github.com/microsoft/vscode-cpptools/issues/12656) + +## Version 1.22.1: August 29, 2024 +### Enhancement +* Add "Additional Tracked Settings" to `C/C++: Log Diagnostics` output. [PR #12635](https://github.com/microsoft/vscode-cpptools/pull/12635) + +### Bug Fixes +* Fix hover over static constexpr variables sometimes not working. [#12284](https://github.com/microsoft/vscode-cpptools/issues/12284) +* Fix completion not giving results in several scenarios. [#12412](https://github.com/microsoft/vscode-cpptools/issues/12412) +* Fix include completion showing results for deleted folders with recursive includes. [#12636](https://github.com/microsoft/vscode-cpptools/issues/12636) +* Fix the `/FU` flag not working for C++/CLI . [#12641](https://github.com/microsoft/vscode-cpptools/issues/12641) +* Fix some crashes with recursive includes. [#12643](https://github.com/microsoft/vscode-cpptools/issues/12643) +* Fix IntelliSense not working on Windows when `C_Cpp.caseSensitiveFileSupport` is `enabled`. [#12648](https://github.com/microsoft/vscode-cpptools/issues/12648) +* Changes that might fix a crash with `translate_encoding_to_utf8`. [#12652](https://github.com/microsoft/vscode-cpptools/issues/12652) +* Fix a random crash during IntelliSense creation. + +## Version 1.22.0: August 26, 2024 ### Performance Improvements * Switch to an alternative implementation of recursive includes (that sends all the paths instead of only the "used" paths). [#11780](https://github.com/microsoft/vscode-cpptools/issues/11780) - Performance improvement: Configuration is no longer blocked on tag parsing of all dependent headers. @@ -8,54 +90,28 @@ * Initialization performance improvements. [#12030](https://github.com/microsoft/vscode-cpptools/issues/12030) - Some processing is parallelized and started earlier (populating the filename cache, discovering files). [#11954](https://github.com/microsoft/vscode-cpptools/issues/11954), [#12169](https://github.com/microsoft/vscode-cpptools/issues/12169) - Some compiler configuration queries are cached in the database, and processing of compile_commands.json was improved. [#10029](https://github.com/microsoft/vscode-cpptools/issues/10029), [#12078](https://github.com/microsoft/vscode-cpptools/issues/12078) -* Performance improvements related to how custom configurations are processed. [#9003](https://github.com/microsoft/vscode-cpptools/issues/9003), [#12632](https://github.com/microsoft/vscode-cpptools/issues/12632) * Improve the implementation of file buffers to reduce memory usage. -* Performance improvements related to LSP request processing. ### Enhancements * Add modified `C_Cpp` settings to the `C/C++: Log Diagnostics` output. [#11700](https://github.com/microsoft/vscode-cpptools/issues/11700) -* Add better validation for settings. [#12371](https://github.com/microsoft/vscode-cpptools/issues/12371) * Change the default C/C++ `"editor.stickyScroll.defaultModel"` to `"foldingProviderModel"`. [#12483](https://github.com/microsoft/vscode-cpptools/issues/12483) -* Remove the `C_Cpp.intelliSenseEngineFallback` setting. [#12596](https://github.com/microsoft/vscode-cpptools/issues/12596) -* Enable `C/C++: Log Diagnostics` without a C/C++ file being active. [#12634](https://github.com/microsoft/vscode-cpptools/issues/12634) -* Add "Additional Tracked Settings" to the `C/C++: Log Diagnostics` output. [PR #12635](https://github.com/microsoft/vscode-cpptools/pull/12635) -* Add support for providing additional context information to Copilot Chat. [PR #12685](https://github.com/microsoft/vscode-cpptools/pull/12685) - * Currently, it requires `"C_Cpp.experimentalFeatures": "enabled"` and typing `#cpp` in the chat. -* The .vsix and .js files are now signed. [#12725](https://github.com/microsoft/vscode-cpptools/issues/12725), [#12744](https://github.com/microsoft/vscode-cpptools/issues/12744) -* Add the database path to the `C/C++: Log Diagnostics` output. +* Add better validation for settings. [#12371](https://github.com/microsoft/vscode-cpptools/issues/12371) * Various IntelliSense parsing updates/fixes. ### Bug Fixes -* Fix the compiler selection control not keeping the list in sync with the contents of the textbox. [#7427](https://github.com/microsoft/vscode-cpptools/issues/7427) -* Fix a string localization issue. [#7824](https://github.com/microsoft/vscode-cpptools/issues/7824) -* Fix an issue with lingering IntelliSense squiggles after an edit. [#12175](https://github.com/microsoft/vscode-cpptools/issues/12175) -* Fix hover over static constexpr variables sometimes not working. [#12284](https://github.com/microsoft/vscode-cpptools/issues/12284) -* Fix completion not giving results in several scenarios. [#12412](https://github.com/microsoft/vscode-cpptools/issues/12412) * Stop logging duplicate compiler path messages. [#12445](https://github.com/microsoft/vscode-cpptools/issues/12445) * Fix an issue where a file is incorrectly processed as C instead of C++. [#12466](https://github.com/microsoft/vscode-cpptools/issues/12466) -* Fix an issue with missing database symbols after a Rename operation. [#12480](https://github.com/microsoft/vscode-cpptools/issues/12480) * Fix include path ordering being incorrect if there is a duplicate. [#12525](https://github.com/microsoft/vscode-cpptools/issues/12525) * Fix a WebAssembly "Out of Memory" error. [#12529](https://github.com/microsoft/vscode-cpptools/issues/12529) * Fix an error message not being shown if the connection failed with remote attach debugging. [#12547](https://github.com/microsoft/vscode-cpptools/issues/12547) * Thank you for the contribution. [@MrStanislav0 (Stanislav)](https://github.com/MrStanislav0) * Fix `-I` not being used if `-iquote` is also used for the same path. [#12551](https://github.com/microsoft/vscode-cpptools/issues/12551) * Fix issues with relative paths on `nvcc` (CUDA) command lines not being handled correctly. [#12553](https://github.com/microsoft/vscode-cpptools/issues/12553) -* Fix a crash on shutdown on macOS with a verbose logging level. [#12567](https://github.com/microsoft/vscode-cpptools/issues/12567) * Fix a random crash when a child process is created. [#12585](https://github.com/microsoft/vscode-cpptools/issues/12585) -* Work around IntelliSense issues with clang 18 due to `size_t` not being defined. [#12618](https://github.com/microsoft/vscode-cpptools/issues/12618) -* Fix the `/FU` flag not working for C++/CLI. [#12641](https://github.com/microsoft/vscode-cpptools/issues/12641) -* Fix a crash in `find_existing_intellisense_client`. [#12666](https://github.com/microsoft/vscode-cpptools/issues/12666) -* Fix a rare crash on macOS related to `get_memory_usage`. [#12667](https://github.com/microsoft/vscode-cpptools/issues/12667) -* Fix an issue with 'Extract to Function' formatting. [#12677](https://github.com/microsoft/vscode-cpptools/issues/12677) -* Fix an issue with duplicate tag parsing occurring after a Rename operation. [#12728](https://github.com/microsoft/vscode-cpptools/issues/12728) -* Fix an issue preventing use of a full command line in `compilerPath`. [PR #12774](https://github.com/microsoft/vscode-cpptools/pull/12774) -* Fix an issue causing unnecessary TU updates for files opened during a Rename operation, when `"files.refactoring.autoSave": false` is used. +* Fix a crash on shutdown on macOS with a verbose logging level. [#12567](https://github.com/microsoft/vscode-cpptools/issues/12567) * Fix some issues with recursive includes handling of symbolic links, multi-root, exclusion changes, and file/folder deletion. * Fix unnecessary IntelliSense resetting when a new file or folder was created. -* Fix an infinite loop on shutdown after changing the selected settings. * Fix accumulation of stale signature help and completion requests. -* Fix handling of the `compiler-binddir` compiler argument. -* Fix a random crash during IntelliSense creation. * Fix some bugs with include completion. ## Version 1.21.6: August 5, 2024 @@ -1329,7 +1385,7 @@ ## Version 0.29.0: July 15, 2020 ### New Features * Add Doxygen comment support (to tooltip display of hover, completion, and signature help). [#658](https://github.com/microsoft/vscode-cpptools/issues/658) - * The way comments are formatted is controlled by the `C_Cpp.simplifyStructuredComments` setting. + * The way comments are formatted is controlled by the `C_Cpp.simplifyStructuredComments` setting. * Auto-convert `.` to `->` when the type is a pointer. [#862](https://github.com/microsoft/vscode-cpptools/issues/862) * Switch to using the VS Code Semantic Tokens API for semantic colorization (works with remoting). [PR #5401](https://github.com/microsoft/vscode-cpptools/pull/5401), [#3932](https://github.com/microsoft/vscode-cpptools/issues/3932), [#3933](https://github.com/microsoft/vscode-cpptools/issues/3933), [#3942](https://github.com/microsoft/vscode-cpptools/issues/3942) * Add support for LogMessage Breakpoints for debug type `cppdbg`. [PR MIEngine#1013](https://github.com/microsoft/MIEngine/pull/1013) @@ -2034,7 +2090,7 @@ ## Version 0.16.1: March 30, 2018 * Fix random deadlock caused by logging code on Linux/Mac. [#1759](https://github.com/Microsoft/vscode-cpptools/issues/1759) * Fix compiler from `compileCommands` not being queried for includes/defines if `compilerPath` isn't set on Windows. [#1754](https://github.com/Microsoft/vscode-cpptools/issues/1754) -* Fix OSX `UseShellExecute` I/O bug. [#1756](https://github.com/Microsoft/vscode-cpptools/issues/1756) +* Fix OSX `UseShellExecute` I/O bug. [#1756](https://github.com/Microsoft/vscode-cpptools/issues/1756) * Invalidate partially unzipped files from package manager. [#1757](https://github.com/Microsoft/vscode-cpptools/issues/1757) ## Version 0.16.0: March 28, 2018 @@ -2378,4 +2434,4 @@ ## Version 0.5.0: April 14, 2016 * Usability and correctness bug fixes. -* Simplify installation experience. +* Simplify installation experience. \ No newline at end of file