Compare commits

..
41 changed files with 52211 additions and 53471 deletions
+3 -3
View File
@@ -3915,9 +3915,9 @@
"dev": true
},
"node_modules/follow-redirects": {
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"version": "1.15.4",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
"integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
"funding": [
{
"type": "individual",
-95
View File
@@ -1,95 +0,0 @@
name: $(date:yyyyMMdd)$(rev:.r)
trigger:
branches:
include:
- main
- release
schedules:
- cron: 30 5 * * 0
branches:
include:
- main
always: true
resources:
repositories:
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
pool:
name: AzurePipelines-EO
image: AzurePipelinesWindows2022compliantGPT
os: windows
sdl:
sourceAnalysisPool:
name: AzurePipelines-EO
image: AzurePipelinesWindows2022compliantGPT
os: windows
tsa:
enabled: false
featureFlags:
autoBaseline: false
stages:
- stage: build
jobs:
- job: Phase_1
displayName: Build cpptools.vsix
timeoutInMinutes: 60
cancelTimeoutInMinutes: 1
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'cpptools.vsix'
condition: succeeded()
targetPath: $(Build.ArtifactStagingDirectory)\Extension
artifactName: cpptools.vsix
steps:
- checkout: self
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
displayName: Use Yarn 1.x
- task: UseNode@1
displayName: Use Node 16.x
inputs:
version: 16.x
- task: CmdLine@2
displayName: Delete .npmrc if it exists
inputs:
script: IF EXIST %SYSTEMDRIVE%\Users\%USERNAME%\.npmrc del %SYSTEMDRIVE%\Users\%USERNAME%\.npmrc
- task: Npm@0
name: NpmInstall_2
displayName: Install vsce
inputs:
arguments: --global @vscode/vsce
- task: CmdLine@1
name: ProcessRunner_11
displayName: Create Extension Staging Directory
inputs:
filename: mkdir
arguments: $(Build.ArtifactStagingDirectory)\Extension
- task: CmdLine@1
name: ProcessRunner_12
displayName: Run VSCE to package vsix
inputs:
filename: vsce
arguments: package --yarn -o $(Build.ArtifactStagingDirectory)\Extension\cpptools.vsix
workingFolder: $(Build.SourcesDirectory)\Extension
- task: Npm@0
displayName: Uninstall vsce
inputs:
command: uninstall
arguments: --global @vscode/vsce
+10 -98
View File
@@ -1,100 +1,12 @@
# C/C++ for Visual Studio Code Changelog
## Version 1.20.3: April 30, 2024
### Enhancement
* Log `cpptools` and `cpptool-srv` crash call stacks in the 'C/C++ Crash Call Stacks' Output channel for bug reporting (on x64 Linux and x64/arm64 Mac).
### Bug Fixes
* Fix directories being incorrectly recursively traversed in certain cases. [#11993](https://github.com/microsoft/vscode-cpptools/issues/11993)
* Fix a crash during startup. [#12237](https://github.com/microsoft/vscode-cpptools/issues/12237)
* Fix IntelliSense configuration on Windows ARM64. [#12253](https://github.com/microsoft/vscode-cpptools/issues/12253)
## Version 1.20.2: April 22, 2024
### Bug Fixes
* Fix non-existent relative path variables not showing a warning in `c_cpp_properties.json` (and other related issues). [#12089](https://github.com/microsoft/vscode-cpptools/issues/12089)
* Fix duplicate URIs in calls to provideConfigurations. [#12177](https://github.com/microsoft/vscode-cpptools/issues/12177)
* Fix a crash and deadlock with a high `C_Cpp.loggingLevel`. [#12194](https://github.com/microsoft/vscode-cpptools/issues/12194)
* Fix handling of `-iquote` for code analysis and `#include` completions. [#12198](https://github.com/microsoft/vscode-cpptools/issues/12198)
## Version 1.20.1: April 9, 2024
### Bug Fixes
* Fix 'Add #include' code actions for code scoped by a namespace or class. [#11541](https://github.com/microsoft/vscode-cpptools/issues/11541)
* Fix the IntelliSense server not starting when a completion, signature help, or document highlight occurs from external commands. [#12143](https://github.com/microsoft/vscode-cpptools/issues/12143)
* Fix the IntelliSense configuration not falling back to the `c_cpp_properties.json` configuration for a file not handled by a configuration provider. [#12144](https://github.com/microsoft/vscode-cpptools/issues/12144)
## Version 1.20.0: March 26, 2024
### Enhancements
* Add support for C++ modules IFC version 0.43. [#10843](https://github.com/microsoft/vscode-cpptools/issues/10843)
* Add support for `${userHome}` in `c_cpp_properties.json`. [#11756](https://github.com/microsoft/vscode-cpptools/issues/11756)
* Reduce the default max workspace symbol search results and add `C_Cpp.maxSymbolSearchResults`. [PR #12131](https://github.com/microsoft/vscode-cpptools/pull/12131)
* Update `clang-format`/`clang-tidy` to 18.1.2. [PR #12135](https://github.com/microsoft/vscode-cpptools/pull/12135)
* Increase the fuzzy symbol character limit from 16 to 28.
* Update the IntelliSense engine.
### Bug Fixes
* Fix an IntelliSense parsing issue. [#6183](https://github.com/microsoft/vscode-cpptools/issues/6183)
* Fix 'Copy Declaration / Definition' code not being formatted. [#10956](https://github.com/microsoft/vscode-cpptools/issues/10956)
* Fix semantic colorization of certain macro arguments. [#11416](https://github.com/microsoft/vscode-cpptools/issues/11416)
* Fix 'Create Declaration / Definition' not working if the cursor isn't on the function name. [#11834](https://github.com/microsoft/vscode-cpptools/issues/11834)
* Fix duplicate 'Add #include' code actions. [#11989](https://github.com/microsoft/vscode-cpptools/issues/11989)
* Fix `forcedInclude` resolution for relative paths. [PR #12035](https://github.com/microsoft/vscode-cpptools/pull/12035)
* Fix 'Add Configuration...' in `launch.json` when `editor.suggest.showSnippets` is `false`. [#12059](https://github.com/microsoft/vscode-cpptools/issues/12059)
* Fix `c_cpp_properties.json` warnings for `includePath`s with `**` wildcard glob patterns. [#12070](https://github.com/microsoft/vscode-cpptools/issues/12070)
* Fix call stacks for `cpptools` and `cpptools-srv` not being available on Linux. [#12091](https://github.com/microsoft/vscode-cpptools/issues/12091)
* Fix IntelliSense processes shutting down immediately if not enough memory is detected. [#12126](https://github.com/microsoft/vscode-cpptools/issues/12126)
* Fix code analysis aborting after encountering an excluded file (instead of just skipping it). [#12127](https://github.com/microsoft/vscode-cpptools/issues/12127)
* Fix `"Cannot open source"` errors on missing includes not appearing if `C_Cpp.errorSquiggles` is `enabled`. [#12134](https://github.com/microsoft/vscode-cpptools/issues/12134)
* Fix a `cpptools` process crash and deadlock during shutdown.
## Version 1.19.9: March 20, 2024
### Bug Fixes
* Fix an issue with Cygwin system headers not being properly detected. [#12113](https://github.com/microsoft/vscode-cpptools/issues/12113)
* Fix a crash in cpptools-srv when low on memory. [#12121](https://github.com/microsoft/vscode-cpptools/issues/12121)
* Fix an issue preventing cpptools-srv from being relaunched after a crash.
## Version 1.19.8: March 13, 2024
### Bug Fixes
* Fix an issue with applying the proper working directory from a `compile_commands.json` when a `compilePath` is also set. [#12024](https://github.com/microsoft/vscode-cpptools/issues/12024)
* Fix a deadlock. [#12051](https://github.com/microsoft/vscode-cpptools/issues/12051)
* Fix a crash that could occur when failing to query clang-cl.
* Fix an issue with handling of `winsysroot` args for clang-cl.
* Fix an issue with processing relative include paths returned by clang-cl.
## Version 1.19.7: March 11, 2024
### Bug Fixes
* Fix some potential deadlocks. [#12051](https://github.com/microsoft/vscode-cpptools/issues/12051)
* Fix a crash related to parsing concepts. [#12060](https://github.com/microsoft/vscode-cpptools/issues/12060)
* Fix flickering status updates in the language status bar. [#12084](https://github.com/microsoft/vscode-cpptools/issues/12084)
* Fix a cpptools crash that can occur if cpptools-srv crashes on initialization.
## Version 1.19.6: March 6, 2024
### Enhancement
* Performance improvement.
## Version 1.19.5: March 4, 2024
### Enhancements
* Change how `args` and `command` fields are handled in `cppbuild` tasks, to match the behavior of VS Code `shell` build tasks, including explicit `quoting` support. [#12001](https://github.com/microsoft/vscode-cpptools/issues/12001)
* Enable C23 IntelliSense support, and add support for `clatest` `std` value for MSVC. [#12020](https://github.com/microsoft/vscode-cpptools/issues/12020)
### Bug Fixes
* Fix the IntelliSense cache not being pruned. [#11925](https://github.com/microsoft/vscode-cpptools/issues/11925)
* Fix an issue with duplicate `Add #include` code actions appearing if the same header name exists in multiple locations. [#11989](https://github.com/microsoft/vscode-cpptools/issues/11989)
* Fix compiler querying with a `-index-store-path` argument. [#12012](https://github.com/microsoft/vscode-cpptools/issues/12012)
* Fix an issue with changes to `C_Cpp.inlayHints` settings not taking effect immediately. [#12013](https://github.com/microsoft/vscode-cpptools/issues/12013)
* Fix an issue with how Doxygen `brief` and `param` are displayed on hover. [#12015](https://github.com/microsoft/vscode-cpptools/issues/12015)
* Fix an issue preventing the extension from functioning if installed via snap on Linux. [#12021](https://github.com/microsoft/vscode-cpptools/issues/12021)
* Fix compiler querying with a `-Xclang -mllvm` argument. [#12024](https://github.com/microsoft/vscode-cpptools/issues/12024)
* Fix the include graph lookup not occurring for source files. [#12036](https://github.com/microsoft/vscode-cpptools/issues/12036)
* Fix exclusions not applying to dependent headers with recursive includes. [#12042](https://github.com/microsoft/vscode-cpptools/issues/12042)
* Fix a potential cpptools process hang on shutdown.
## Version 1.19.4: February 21, 2024
### Enhancements
* Enable support for fuzzy symbol searches. [#2751](https://github.com/microsoft/vscode-cpptools/issues/2751)
* This may not be enabled for all users unless `C_Cpp.experimentalFeatures` is `enabled`.
* Enable support for fuzzy symbol searches. [#2751](https://github.com/microsoft/vscode-cpptools/issues/2751)
* This may not be enabled for all users unless `C_Cpp.experimentalFeatures` is `enabled`.
* Implement progressive population of IntelliSense results. [#7759](https://github.com/microsoft/vscode-cpptools/issues/7759)
* Improve performance of symbol searches. [#7908](https://github.com/microsoft/vscode-cpptools/issues/7908), [#7914](https://github.com/microsoft/vscode-cpptools/issues/7914), [#11557](https://github.com/microsoft/vscode-cpptools/issues/11557)
* This may not be enabled for all users unless `C_Cpp.experimentalFeatures` is `enabled`.
* Improve performance of symbol searches. [#7908](https://github.com/microsoft/vscode-cpptools/issues/7908), [#7914](https://github.com/microsoft/vscode-cpptools/issues/7914), [#11557](https://github.com/microsoft/vscode-cpptools/issues/11557)
* This may not be enabled for all users unless `C_Cpp.experimentalFeatures` is `enabled`.
* Support insert mode for auto-complete. [#10613](https://github.com/microsoft/vscode-cpptools/issues/10613)
* Use the `"[cpp]": { "editor.suggest.insertMode": "insert" } ` and `"[c]": { "editor.suggest.insertMode": "insert" } ` settings to override the extension's defaults.
* Improve memory efficiency by using token parsing in the 'Add #include' feature. [#11515](https://github.com/microsoft/vscode-cpptools/issues/11515)
@@ -164,7 +76,7 @@
### Enhancements
* Add keyboard support for 'Inline Macro'. [#11260](https://github.com/microsoft/vscode-cpptools/issues/11260)
* Add setting `C_Cpp.refactoring.includeHeader` to customize whether or not to add an include header when doing a refactoring code action. [#11271](https://github.com/microsoft/vscode-cpptools/issues/11271)
* Add setting `C_Cpp.refactoring.includeHeader` to customize whether or not to add an include header when doing a refactoring code action. [#11271](https://github.com/microsoft/vscode-cpptools/issues/11271)
* Improve the walkthrough wording. [#11320](https://github.com/microsoft/vscode-cpptools/issues/11320)
* Update clang-format and clang-tidy to 17. [PR #11491](https://github.com/microsoft/vscode-cpptools/pull/11491)
* Add a pre-release available notification. [PR #11569](https://github.com/microsoft/vscode-cpptools/pull/11569)
@@ -224,9 +136,9 @@
* Fix the parameter format of call hierarchy items. [#11247](https://github.com/microsoft/vscode-cpptools/issues/11247)
* Remove the vcpkg code action from the missing includes code action list. [#11252](https://github.com/microsoft/vscode-cpptools/issues/11252)
* Fix the file path info of call hierarchy items to display the relative path to a workspace folder. [#11254](https://github.com/microsoft/vscode-cpptools/issues/11254)
* Fix colorization for macro expansions in macro arguments. [#11256](https://github.com/microsoft/vscode-cpptools/issues/11256)
* Fix a crash for CUDA projects with '>' in the command line. [#11289](https://github.com/microsoft/vscode-cpptools/issues/11289)
* Increase the default standard for the 'Build and Debug Active File' feature to c++14 on macOS. [#11292](https://github.com/microsoft/vscode-cpptools/issues/11292)
* Fix colorization for macro expansions in macro arguments. [#11256](https://github.com/microsoft/vscode-cpptools/issues/11256)
* Fix a crash for CUDA projects with '>' in the command line. [#11289](https://github.com/microsoft/vscode-cpptools/issues/11289)
* Increase the default standard for the 'Build and Debug Active File' feature to c++14 on macOS. [#11292](https://github.com/microsoft/vscode-cpptools/issues/11292)
* Fix an issue with the compiler currently configured for use with IntelliSense being listed last in the task creation popup. [PR #11299](https://github.com/microsoft/vscode-cpptools/pull/11299)
* Fix an IPCH issue on Linux due to the Position Independent Executable (PIE) option not being set since 1.17.0.
* Fix Rank > 1 Display Strings for Natvis. [PR MIEngine#1406](https://github.com/microsoft/MIEngine/pull/1406)
@@ -639,7 +551,7 @@
## Version 1.9.7: March 23, 2022
### New Features
* Add debugger support for Apple M1 (osx-arm64). [#7035](https://github.com/microsoft/vscode-cpptools/issues/7035)
* Resolves issue "[Big Sur M1] ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument))". [#6779](https://github.com/microsoft/vscode-cpptools/issues/6779)
* Resolves issue "[Big Sur M1] ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument))". [#6779](https://github.com/microsoft/vscode-cpptools/issues/6779)
* Add a build and debug button when `C_Cpp.debugShortcut` is `true`. [#7497](https://github.com/microsoft/vscode-cpptools/issues/7497)
* The "Build and Debug Active File" command has been split into "Debug C++ File" and "Run C++ File", and it has been removed from the context menu.
* Add Alpine Linux arm64 support (VSIX).
@@ -648,7 +560,7 @@
### Enhancements
* Reserved identifiers with characters that match typed characters in the correct order but not contiguously are initially filtered in the auto-completion list. Doing a `ctrl` + `space` in the same location will show all auto-complete suggestions. [#4939](https://github.com/microsoft/vscode-cpptools/issues/4939)
* Add `dotConfig` property to IntelliSense Configuration (c_cpp_properties.json) to use .config file created by Kconfig system.
* Matheus Castello (@microhobby) [PR #7845](https://github.com/microsoft/vscode-cpptools/pull/7845)
* Matheus Castello (@microhobby) [PR #7845](https://github.com/microsoft/vscode-cpptools/pull/7845)
* Rework how cancelation is processed for semantic tokens and folding operations. [PR #8739](https://github.com/microsoft/vscode-cpptools/pull/8739)
* Make SwitchHeaderSource use the `workbench.editor.revealIfOpen` setting.
* Joel Smith (@joelmsmith) [PR #8857](https://github.com/microsoft/vscode-cpptools/pull/8857)
+2 -35
View File
@@ -1793,7 +1793,7 @@ THE SOFTWARE.
---------------------------------------------------------
follow-redirects 1.15.6 - MIT
follow-redirects 1.15.5 - MIT
https://github.com/follow-redirects/follow-redirects
Copyright 2014-present Olivier Lalonde <[email protected]> , James Talmage <[email protected]> , Ruben Verborgh
@@ -3003,10 +3003,9 @@ The notices below are from non-npm sources.
- ANTLR (http://www.antlr2.org/)
- C++11 Sublime Text Snippets (https://github.com/Rapptz/cpp-sublime-snippet)
- Clang (https://clang.llvm.org/)
- gcc-11/libgcc (https://packages.ubuntu.com/jammy/gcc-11-base)
- gcc-9/libgcc (https://packages.ubuntu.com/focal/gcc-9-base)
- Guidelines Support Library (https://github.com/Microsoft/GSL)
- libc++ (https://libcxx.llvm.org/index.html)
- libexecinfo (https://github.com/ronchaine/libexecinfo)
- libuv (https://github.com/libuv/libuv)
- LLDB (https://lldb.llvm.org/)
- LLVM (http://llvm.org/)
@@ -3851,38 +3850,6 @@ obstacle to adoption, that text has been removed.
=========================================
END OF musl NOTICES AND INFORMATION
%% libexecinfo NOTICES AND INFORMATION BEGIN HERE
=========================================
libexecinfo is licensed for use as follows:
====
Copyright (c) 2003 Maxim Sobolev <[email protected]>
All rights reserved.
*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
*
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
=========================================
END OF libexecinfo NOTICES AND INFORMATION
%% libuv NOTICES AND INFORMATION BEGIN HERE
=========================================
libuv is licensed for use as follows:
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -4,11 +4,11 @@
"--microsoft",
"--microsoft_bugs",
"--microsoft_version",
"1939",
"1935",
"--pack_alignment",
"8",
"-D_MSC_VER=1939",
"-D_MSC_FULL_VER=193933519",
"-D_MSC_VER=1935",
"-D_MSC_FULL_VER=193532215",
"-D_MSC_BUILD=0",
"-D_M_ARM=7"
],
+3 -3
View File
@@ -4,12 +4,12 @@
"--microsoft",
"--microsoft_bugs",
"--microsoft_version",
"1939",
"1935",
"--pack_alignment",
"8",
"-D_CPPUNWIND=1",
"-D_MSC_VER=1939",
"-D_MSC_FULL_VER=193933519",
"-D_MSC_VER=1935",
"-D_MSC_FULL_VER=193532215",
"-D_MSC_BUILD=0",
"-D_M_ARM64=1"
],
+3 -3
View File
@@ -4,12 +4,12 @@
"--microsoft",
"--microsoft_bugs",
"--microsoft_version",
"1939",
"1935",
"--pack_alignment",
"8",
"-D_CPPUNWIND=1",
"-D_MSC_VER=1939",
"-D_MSC_FULL_VER=193933519",
"-D_MSC_VER=1935",
"-D_MSC_FULL_VER=193532215",
"-D_MSC_BUILD=0",
"-D_M_X64=100",
"-D_M_AMD64=100"
+3 -3
View File
@@ -4,11 +4,11 @@
"--microsoft",
"--microsoft_bugs",
"--microsoft_version",
"1939",
"1935",
"--pack_alignment",
"8",
"-D_MSC_VER=1939",
"-D_MSC_FULL_VER=193933519",
"-D_MSC_VER=1935",
"-D_MSC_FULL_VER=193532215",
"-D_MSC_BUILD=0",
"-D_M_IX86=600",
"-D_M_IX86_FP=2"
+4 -178
View File
@@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "1.20.3-main",
"version": "1.19.4-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
@@ -313,78 +313,12 @@
"description": "%c_cpp.taskDefinitions.name.description%"
},
"command": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"required": [
"value",
"quoting"
],
"properties": {
"value": {
"type": "string",
"description": "%c_cpp.taskDefinitions.args.value.description%"
},
"quoting": {
"type": "string",
"enum": [
"escape",
"strong",
"weak"
],
"enumDescriptions": [
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
],
"default": "strong",
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
}
}
}
]
"type": "string",
"description": "%c_cpp.taskDefinitions.command.description%"
},
"args": {
"type": "array",
"description": "%c_cpp.taskDefinitions.args.description%",
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"required": [
"value",
"quoting"
],
"properties": {
"value": {
"type": "string",
"description": "%c_cpp.taskDefinitions.args.value.description%"
},
"quoting": {
"type": "string",
"enum": [
"escape",
"strong",
"weak"
],
"enumDescriptions": [
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
],
"default": "strong",
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
}
}
}
]
}
"description": "%c_cpp.taskDefinitions.args.description%"
},
"options": {
"type": "object",
@@ -1851,11 +1785,7 @@
"bugprone-bad-signal-to-kill-thread",
"bugprone-bool-pointer-implicit-conversion",
"bugprone-branch-clone",
"bugprone-casting-through-void",
"bugprone-chained-comparison",
"bugprone-compare-pointer-to-member-virtual-function",
"bugprone-copy-constructor-init",
"bugprone-crtp-constructor-accessibility",
"bugprone-dangling-handle",
"bugprone-dynamic-static-initializers",
"bugprone-easily-swappable-parameters",
@@ -1866,9 +1796,6 @@
"bugprone-forwarding-reference-overload",
"bugprone-implicit-widening-of-multiplication-result",
"bugprone-inaccurate-erase",
"bugprone-inc-dec-in-conditions",
"bugprone-incorrect-*",
"bugprone-incorrect-enable-if",
"bugprone-incorrect-roundings",
"bugprone-infinite-loop",
"bugprone-integer-division",
@@ -1880,7 +1807,6 @@
"bugprone-misplaced-pointer-arithmetic-in-alloc",
"bugprone-misplaced-widening-cast",
"bugprone-move-forwarding-reference",
"bugprone-multi-level-implicit-pointer-conversion",
"bugprone-multiple-*",
"bugprone-multiple-new-in-one-expression",
"bugprone-multiple-statement-macro",
@@ -1888,7 +1814,6 @@
"bugprone-no-escape",
"bugprone-non-zero-enum-to-bool-conversion",
"bugprone-not-null-terminated-result",
"bugprone-optional-value-conversion",
"bugprone-parent-virtual-call",
"bugprone-posix-return",
"bugprone-redundant-branch-condition",
@@ -1915,7 +1840,6 @@
"bugprone-suspicious-realloc-usage",
"bugprone-suspicious-semicolon",
"bugprone-suspicious-string-compare",
"bugprone-suspicious-stringview-data-usage",
"bugprone-swapped-arguments",
"bugprone-switch-missing-default-case",
"bugprone-terminating-continue",
@@ -1928,9 +1852,6 @@
"bugprone-unhandled-exception-at-new",
"bugprone-unhandled-self-assignment",
"bugprone-unique-ptr-array-mismatch",
"bugprone-unsafe-functions",
"bugprone-unused-*",
"bugprone-unused-local-non-trivial-variable",
"bugprone-unused-raii",
"bugprone-unused-return-value",
"bugprone-use-after-move",
@@ -1967,7 +1888,6 @@
"cert-msc*",
"cert-msc30-c",
"cert-msc32-c",
"cert-msc33-c",
"cert-msc50-cpp",
"cert-msc51-cpp",
"cert-msc54-cpp",
@@ -1983,7 +1903,6 @@
"cert-str34-c",
"clang-analyzer-*",
"clang-analyzer-core.*",
"clang-analyzer-core.BitwiseShift",
"clang-analyzer-core.CallAndMessage",
"clang-analyzer-core.DivideZero",
"clang-analyzer-core.DynamicTypePropagation",
@@ -1996,7 +1915,6 @@
"clang-analyzer-core.uninitialized.Assign",
"clang-analyzer-core.uninitialized.Branch",
"clang-analyzer-core.uninitialized.CapturedBlockVariable",
"clang-analyzer-core.uninitialized.NewArraySize",
"clang-analyzer-core.uninitialized.UndefReturn",
"clang-analyzer-core.VLASize",
"clang-analyzer-cplusplus.*",
@@ -2004,11 +1922,7 @@
"clang-analyzer-cplusplus.Move",
"clang-analyzer-cplusplus.NewDelete",
"clang-analyzer-cplusplus.NewDeleteLeaks",
"clang-analyzer-cplusplus.PlacementNew",
"clang-analyzer-cplusplus.PureVirtualCall",
"clang-analyzer-cplusplus.StringChecker",
"clang-analyzer-deadcode.DeadStores",
"clang-analyzer-fuchsia.HandleChecker",
"clang-analyzer-nullablity.*",
"clang-analyzer-nullability.NullableDereferenced",
"clang-analyzer-nullability.NullablePassedToNonnull",
@@ -2016,7 +1930,6 @@
"clang-analyzer-nullability.NullPassedToNonnull",
"clang-analyzer-nullability.NullReturnedFromNonnull",
"clang-analyzer-optin.*",
"clang-analyzer-optin.core.EnumCastOutOfRange",
"clang-analyzer-optin.cplusplus.*",
"clang-analyzer-optin.cplusplus.UninitializedObject",
"clang-analyzer-optin.cplusplus.VirtualCall",
@@ -2065,13 +1978,11 @@
"clang-analyzer-osx.OSObjectRetainCount",
"clang-analyzer-osx.SecKeychainAPI",
"clang-analyzer-security.*",
"clang-analyzer-security.cert.env.InvalidPtr",
"clang-analyzer-security.FloatLoopCounter",
"clang-analyzer-security.insecureAPI.*",
"clang-analyzer-security.insecureAPI.bcmp",
"clang-analyzer-security.insecureAPI.bcopy",
"clang-analyzer-security.insecureAPI.bzero",
"clang-analyzer-security.insecureAPI.decodeValueOfObjCType",
"clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
"clang-analyzer-security.insecureAPI.getpw",
"clang-analyzer-security.insecureAPI.gets",
@@ -2086,19 +1997,14 @@
"clang-analyzer-unix.cstring.*",
"clang-analyzer-unix.cstring.BadSizeArg",
"clang-analyzer-unix.cstring.NullArg",
"clang-analyzer-unix.Errno",
"clang-analyzer-unix.Malloc",
"clang-analyzer-unix.MallocSizeof",
"clang-analyzer-unix.MismatchedDeallocator",
"clang-analyzer-unix.StdCLibraryFunctions",
"clang-analyzer-unix.Vfork",
"clang-analyzer-valist.*",
"clang-analyzer-valist.CopyToSelf",
"clang-analyzer-valist.Uninitialized",
"clang-analyzer-valist.Unterminated",
"clang-analyzer-webkit.NoUncountedMemberChecker",
"clang-analyzer-webkit.RefCntblBaseVirtualDtor",
"clang-analyzer-webkit.UncountedLambdaCapturesChecker",
"concurrency-*",
"concurrency-mt-unsafe",
"concurrency-thread-canceltype-asynchronous",
@@ -2121,13 +2027,7 @@
"cppcoreguidelines-misleading-capture-default-by-value",
"cppcoreguidelines-missing-std-forward",
"cppcoreguidelines-narrowing-conversions",
"cppcoreguidelines-no-*",
"cppcoreguidelines-no-malloc",
"cppcoreguidelines-no-suspend-with-lock",
"cppcoreguidelines-noexcept-*",
"cppcoreguidelines-noexcept-destructor",
"cppcoreguidelines-noexcept-move-operations",
"cppcoreguidelines-noexcept-swap",
"cppcoreguidelines-non-private-member-variables-in-classes",
"cppcoreguidelines-owning-memory",
"cppcoreguidelines-prefer-member-initializer",
@@ -2146,7 +2046,6 @@
"cppcoreguidelines-rvalue-reference-param-not-moved",
"cppcoreguidelines-slicing",
"cppcoreguidelines-special-member-functions",
"cppcoreguidelines-use-default-member-init",
"cppcoreguidelines-virtual-class-destructor",
"darwin-*",
"darwin-avoid-spinlock",
@@ -2195,7 +2094,6 @@
"hicpp-exception-baseclass",
"hicpp-explicit-conversions",
"hicpp-function-size",
"hicpp-ignored-remove-result",
"hicpp-invalid-access-moved",
"hicpp-member-init",
"hicpp-move-const-arg",
@@ -2241,7 +2139,6 @@
"misc-*",
"misc-confusable-identifiers",
"misc-const-correctness",
"misc-coroutine-hostile-raii",
"misc-definitions-in-headers",
"misc-header-include-cycle",
"misc-include-cleaner",
@@ -2292,9 +2189,7 @@
"modernize-use-auto",
"modernize-use-bool-literals",
"modernize-use-default",
"modernize-use-constraints",
"modernize-use-default-member-init",
"modernize-use-designated-initializers",
"modernize-use-emplace",
"modernize-use-equals-*",
"modernize-use-equals-default",
@@ -2303,9 +2198,6 @@
"modernize-use-noexcept",
"modernize-use-nullptr",
"modernize-use-override",
"modernize-use-starts-ends-with",
"modernize-use-std-*",
"modernize-use-std-numbers",
"modernize-use-std-print",
"modernize-use-trailing-return-type",
"modernize-use-transparent-functors",
@@ -2329,7 +2221,6 @@
"openmp-use-default-none",
"performance-*",
"performance-avoid-endl",
"performance-enum-size",
"performance-faster-string-find",
"performance-for-range-copy",
"performance-implicit-conversion-in-loop",
@@ -2359,8 +2250,6 @@
"readability-*",
"readability-avoid-*",
"readability-avoid-const-params-in-decls",
"readability-avoid-nested-conditional-operator",
"readability-avoid-return-with-void-value",
"readability-avoid-unconditional-preprocessor-if",
"readability-braces-around-statements",
"readability-const-return-type",
@@ -2391,18 +2280,15 @@
"readability-qualified-auto",
"readability-redundant-*",
"readability-redundant-access-specifiers",
"readability-redundant-casting",
"readability-redundant-control-flow",
"readability-redundant-declaration",
"readability-redundant-function-ptr-dereference",
"readability-redundant-inline-specifier",
"readability-redundant-member-init",
"readability-redundant-preprocessor",
"readability-redundant-smartptr-get",
"readability-redundant-string-*",
"readability-redundant-string-cstr",
"readability-redundant-string-init",
"readability-reference-to-constructed-temporary",
"readability-simplify-*",
"readability-simplify-boolean-expr",
"readability-simplify-subscript-expr",
@@ -2413,9 +2299,7 @@
"readability-suspicious-call-argument",
"readability-uniqueptr-delete-release",
"readability-uppercase-literal-suffix",
"readability-use-*",
"readability-use-anyofallof",
"readability-use-std-min-max",
"zircon-temporary-objects"
]
},
@@ -2487,11 +2371,7 @@
"bugprone-bad-signal-to-kill-thread",
"bugprone-bool-pointer-implicit-conversion",
"bugprone-branch-clone",
"bugprone-casting-through-void",
"bugprone-chained-comparison",
"bugprone-compare-pointer-to-member-virtual-function",
"bugprone-copy-constructor-init",
"bugprone-crtp-constructor-accessibility",
"bugprone-dangling-handle",
"bugprone-dynamic-static-initializers",
"bugprone-easily-swappable-parameters",
@@ -2502,9 +2382,6 @@
"bugprone-forwarding-reference-overload",
"bugprone-implicit-widening-of-multiplication-result",
"bugprone-inaccurate-erase",
"bugprone-inc-dec-in-conditions",
"bugprone-incorrect-*",
"bugprone-incorrect-enable-if",
"bugprone-incorrect-roundings",
"bugprone-infinite-loop",
"bugprone-integer-division",
@@ -2516,7 +2393,6 @@
"bugprone-misplaced-pointer-arithmetic-in-alloc",
"bugprone-misplaced-widening-cast",
"bugprone-move-forwarding-reference",
"bugprone-multi-level-implicit-pointer-conversion",
"bugprone-multiple-*",
"bugprone-multiple-new-in-one-expression",
"bugprone-multiple-statement-macro",
@@ -2524,7 +2400,6 @@
"bugprone-no-escape",
"bugprone-non-zero-enum-to-bool-conversion",
"bugprone-not-null-terminated-result",
"bugprone-optional-value-conversion",
"bugprone-parent-virtual-call",
"bugprone-posix-return",
"bugprone-redundant-branch-condition",
@@ -2551,7 +2426,6 @@
"bugprone-suspicious-realloc-usage",
"bugprone-suspicious-semicolon",
"bugprone-suspicious-string-compare",
"bugprone-suspicious-stringview-data-usage",
"bugprone-swapped-arguments",
"bugprone-switch-missing-default-case",
"bugprone-terminating-continue",
@@ -2564,9 +2438,6 @@
"bugprone-unhandled-exception-at-new",
"bugprone-unhandled-self-assignment",
"bugprone-unique-ptr-array-mismatch",
"bugprone-unsafe-functions",
"bugprone-unused-*",
"bugprone-unused-local-non-trivial-variable",
"bugprone-unused-raii",
"bugprone-unused-return-value",
"bugprone-use-after-move",
@@ -2603,7 +2474,6 @@
"cert-msc*",
"cert-msc30-c",
"cert-msc32-c",
"cert-msc33-c",
"cert-msc50-cpp",
"cert-msc51-cpp",
"cert-msc54-cpp",
@@ -2619,7 +2489,6 @@
"cert-str34-c",
"clang-analyzer-*",
"clang-analyzer-core.*",
"clang-analyzer-core.BitwiseShift",
"clang-analyzer-core.CallAndMessage",
"clang-analyzer-core.DivideZero",
"clang-analyzer-core.DynamicTypePropagation",
@@ -2632,7 +2501,6 @@
"clang-analyzer-core.uninitialized.Assign",
"clang-analyzer-core.uninitialized.Branch",
"clang-analyzer-core.uninitialized.CapturedBlockVariable",
"clang-analyzer-core.uninitialized.NewArraySize",
"clang-analyzer-core.uninitialized.UndefReturn",
"clang-analyzer-core.VLASize",
"clang-analyzer-cplusplus.*",
@@ -2640,11 +2508,7 @@
"clang-analyzer-cplusplus.Move",
"clang-analyzer-cplusplus.NewDelete",
"clang-analyzer-cplusplus.NewDeleteLeaks",
"clang-analyzer-cplusplus.PlacementNew",
"clang-analyzer-cplusplus.PureVirtualCall",
"clang-analyzer-cplusplus.StringChecker",
"clang-analyzer-deadcode.DeadStores",
"clang-analyzer-fuchsia.HandleChecker",
"clang-analyzer-nullablity.*",
"clang-analyzer-nullability.NullableDereferenced",
"clang-analyzer-nullability.NullablePassedToNonnull",
@@ -2652,7 +2516,6 @@
"clang-analyzer-nullability.NullPassedToNonnull",
"clang-analyzer-nullability.NullReturnedFromNonnull",
"clang-analyzer-optin.*",
"clang-analyzer-optin.core.EnumCastOutOfRange",
"clang-analyzer-optin.cplusplus.*",
"clang-analyzer-optin.cplusplus.UninitializedObject",
"clang-analyzer-optin.cplusplus.VirtualCall",
@@ -2701,13 +2564,11 @@
"clang-analyzer-osx.OSObjectRetainCount",
"clang-analyzer-osx.SecKeychainAPI",
"clang-analyzer-security.*",
"clang-analyzer-security.cert.env.InvalidPtr",
"clang-analyzer-security.FloatLoopCounter",
"clang-analyzer-security.insecureAPI.*",
"clang-analyzer-security.insecureAPI.bcmp",
"clang-analyzer-security.insecureAPI.bcopy",
"clang-analyzer-security.insecureAPI.bzero",
"clang-analyzer-security.insecureAPI.decodeValueOfObjCType",
"clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling",
"clang-analyzer-security.insecureAPI.getpw",
"clang-analyzer-security.insecureAPI.gets",
@@ -2722,19 +2583,14 @@
"clang-analyzer-unix.cstring.*",
"clang-analyzer-unix.cstring.BadSizeArg",
"clang-analyzer-unix.cstring.NullArg",
"clang-analyzer-unix.Errno",
"clang-analyzer-unix.Malloc",
"clang-analyzer-unix.MallocSizeof",
"clang-analyzer-unix.MismatchedDeallocator",
"clang-analyzer-unix.StdCLibraryFunctions",
"clang-analyzer-unix.Vfork",
"clang-analyzer-valist.*",
"clang-analyzer-valist.CopyToSelf",
"clang-analyzer-valist.Uninitialized",
"clang-analyzer-valist.Unterminated",
"clang-analyzer-webkit.NoUncountedMemberChecker",
"clang-analyzer-webkit.RefCntblBaseVirtualDtor",
"clang-analyzer-webkit.UncountedLambdaCapturesChecker",
"concurrency-*",
"concurrency-mt-unsafe",
"concurrency-thread-canceltype-asynchronous",
@@ -2757,13 +2613,7 @@
"cppcoreguidelines-misleading-capture-default-by-value",
"cppcoreguidelines-missing-std-forward",
"cppcoreguidelines-narrowing-conversions",
"cppcoreguidelines-no-*",
"cppcoreguidelines-no-malloc",
"cppcoreguidelines-no-suspend-with-lock",
"cppcoreguidelines-noexcept-*",
"cppcoreguidelines-noexcept-destructor",
"cppcoreguidelines-noexcept-move-operations",
"cppcoreguidelines-noexcept-swap",
"cppcoreguidelines-non-private-member-variables-in-classes",
"cppcoreguidelines-owning-memory",
"cppcoreguidelines-prefer-member-initializer",
@@ -2782,7 +2632,6 @@
"cppcoreguidelines-rvalue-reference-param-not-moved",
"cppcoreguidelines-slicing",
"cppcoreguidelines-special-member-functions",
"cppcoreguidelines-use-default-member-init",
"cppcoreguidelines-virtual-class-destructor",
"darwin-*",
"darwin-avoid-spinlock",
@@ -2831,7 +2680,6 @@
"hicpp-exception-baseclass",
"hicpp-explicit-conversions",
"hicpp-function-size",
"hicpp-ignored-remove-result",
"hicpp-invalid-access-moved",
"hicpp-member-init",
"hicpp-move-const-arg",
@@ -2877,7 +2725,6 @@
"misc-*",
"misc-confusable-identifiers",
"misc-const-correctness",
"misc-coroutine-hostile-raii",
"misc-definitions-in-headers",
"misc-header-include-cycle",
"misc-include-cleaner",
@@ -2928,9 +2775,7 @@
"modernize-use-auto",
"modernize-use-bool-literals",
"modernize-use-default",
"modernize-use-constraints",
"modernize-use-default-member-init",
"modernize-use-designated-initializers",
"modernize-use-emplace",
"modernize-use-equals-*",
"modernize-use-equals-default",
@@ -2939,9 +2784,6 @@
"modernize-use-noexcept",
"modernize-use-nullptr",
"modernize-use-override",
"modernize-use-starts-ends-with",
"modernize-use-std-*",
"modernize-use-std-numbers",
"modernize-use-std-print",
"modernize-use-trailing-return-type",
"modernize-use-transparent-functors",
@@ -2965,7 +2807,6 @@
"openmp-use-default-none",
"performance-*",
"performance-avoid-endl",
"performance-enum-size",
"performance-faster-string-find",
"performance-for-range-copy",
"performance-implicit-conversion-in-loop",
@@ -2995,8 +2836,6 @@
"readability-*",
"readability-avoid-*",
"readability-avoid-const-params-in-decls",
"readability-avoid-nested-conditional-operator",
"readability-avoid-return-with-void-value",
"readability-avoid-unconditional-preprocessor-if",
"readability-braces-around-statements",
"readability-const-return-type",
@@ -3027,18 +2866,15 @@
"readability-qualified-auto",
"readability-redundant-*",
"readability-redundant-access-specifiers",
"readability-redundant-casting",
"readability-redundant-control-flow",
"readability-redundant-declaration",
"readability-redundant-function-ptr-dereference",
"readability-redundant-inline-specifier",
"readability-redundant-member-init",
"readability-redundant-preprocessor",
"readability-redundant-smartptr-get",
"readability-redundant-string-*",
"readability-redundant-string-cstr",
"readability-redundant-string-init",
"readability-reference-to-constructed-temporary",
"readability-simplify-*",
"readability-simplify-boolean-expr",
"readability-simplify-subscript-expr",
@@ -3049,9 +2885,7 @@
"readability-suspicious-call-argument",
"readability-uniqueptr-delete-release",
"readability-uppercase-literal-suffix",
"readability-use-*",
"readability-use-anyofallof",
"readability-use-std-min-max",
"zircon-temporary-objects"
]
},
@@ -3178,14 +3012,6 @@
"maximum": 65536,
"scope": "machine"
},
"C_Cpp.maxSymbolSearchResults": {
"type": "integer",
"markdownDescription": "%c_cpp.configuration.maxSymbolSearchResults.markdownDescription%",
"default": 5000,
"minimum": 500,
"maximum": 10000,
"scope": "window"
},
"C_Cpp.intelliSense.maxCachedProcesses": {
"type": [
"integer",
-11
View File
@@ -66,12 +66,6 @@
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"c_cpp.configuration.maxSymbolSearchResults.markdownDescription": {
"message": "The maximum number of results to show for 'Go to Symbol in Workspace'. The default is `5000`.",
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"c_cpp.configuration.intelliSense.maxCachedProcesses.markdownDescription": {
"message": "The maximum number of IntelliSense processes to keep running. The default of `null` (empty) uses value inherited from `#C_Cpp.maxCachedProcesses#`.",
"comment": [
@@ -934,11 +928,6 @@
"c_cpp.taskDefinitions.name.description": "The name of the task.",
"c_cpp.taskDefinitions.command.description": "The path to either a compiler or script that performs compilation.",
"c_cpp.taskDefinitions.args.description": "Additional arguments to pass to the compiler or compilation script.",
"c_cpp.taskDefinitions.args.value.description": "The actual argument value.",
"c_cpp.taskDefinitions.args.quoting.description": "How the argument value should be quoted.",
"c_cpp.taskDefinitions.args.quoting.escape.description": "Escapes characters using the shell's escape character (e.g. \\ under bash).",
"c_cpp.taskDefinitions.args.quoting.strong.description": "Quotes the argument using the shell's strong quote character (e.g. ' under bash).",
"c_cpp.taskDefinitions.args.quoting.weak.description": "Quotes the argument using the shell's weak quote character (e.g. \" under bash).",
"c_cpp.taskDefinitions.options.description": "Additional command options.",
"c_cpp.taskDefinitions.options.cwd.description": "The current working directory of the executed program or script. If omitted Code's current workspace root is used.",
"c_cpp.taskDefinitions.detail.description": "Additional details of the task.",
@@ -413,7 +413,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
if (buildTasks.length !== 0) {
configs = (await Promise.all(buildTasks.map<Promise<CppDebugConfiguration | undefined>>(async task => {
const definition: CppBuildTaskDefinition = task.definition as CppBuildTaskDefinition;
const compilerPath: string = util.isString(definition.command) ? definition.command : definition.command.value;
const compilerPath: string = definition.command;
// Filter out the tasks that has an invalid compiler path.
const compilerPathExists: boolean = path.isAbsolute(compilerPath) ?
// Absolute path, just check if it exists
@@ -1228,7 +1228,7 @@ class LinuxConfigurationProvider extends DefaultConfigurationProvider {
}
function convertConfigurationSnippetToCompletionItem(snippet: IConfigurationSnippet): vscode.CompletionItem {
const item: vscode.CompletionItem = new vscode.CompletionItem(snippet.label, vscode.CompletionItemKind.Module);
const item: vscode.CompletionItem = new vscode.CompletionItem(snippet.label, vscode.CompletionItemKind.Snippet);
item.insertText = snippet.bodyText;
@@ -10,17 +10,7 @@ interface FileData
{
version: number;
promise: ManualPromise<vscode.InlayHint[]>;
typeHints: CppInlayHint[];
parameterHints: CppInlayHint[];
inlayHints: vscode.InlayHint[];
inlayHintsAutoDeclarationTypes?: boolean;
inlayHintsAutoDeclarationTypesShowOnLeft?: boolean;
inlayHintsParameterNames?: boolean;
inlayHintsParameterNamesHideLeadingUnderscores?: boolean;
inlayHintsParameterNamesSuppressName?: boolean;
inlayHintsReferenceOperator?: boolean;
inlayHintsReferenceOperatorShowSpace?: boolean;
}
export interface CppInlayHint {
@@ -45,7 +35,7 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
public onDidChangeInlayHints?: vscode.Event<void> = this.onDidChangeInlayHintsEvent.event;
private allFileData: Map<string, FileData> = new Map<string, FileData>();
public async provideInlayHints(document: vscode.TextDocument, _range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[]> {
public async provideInlayHints(document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[]> {
const uri: vscode.Uri = document.uri;
const uriString: string = uri.toString();
let fileData: FileData | undefined = this.allFileData.get(uriString);
@@ -54,36 +44,6 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
// Make sure file hasn't been changed since the last set of results.
// If a complete promise is present, there should also be a cache.
if (fileData.version === document.version) {
const settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
// Check if any of the settings changed.
if (fileData.inlayHintsAutoDeclarationTypes === settings.inlayHintsAutoDeclarationTypes &&
fileData.inlayHintsAutoDeclarationTypesShowOnLeft === settings.inlayHintsAutoDeclarationTypesShowOnLeft &&
fileData.inlayHintsParameterNames === settings.inlayHintsParameterNames &&
fileData.inlayHintsParameterNamesHideLeadingUnderscores === settings.inlayHintsParameterNamesHideLeadingUnderscores &&
fileData.inlayHintsParameterNamesSuppressName === settings.inlayHintsParameterNamesSuppressName &&
fileData.inlayHintsReferenceOperator === settings.inlayHintsReferenceOperator &&
fileData.inlayHintsReferenceOperatorShowSpace === settings.inlayHintsReferenceOperatorShowSpace) {
return fileData.promise;
}
fileData.inlayHints = [];
fileData.inlayHintsAutoDeclarationTypes = settings.inlayHintsAutoDeclarationTypes;
fileData.inlayHintsAutoDeclarationTypesShowOnLeft = settings.inlayHintsAutoDeclarationTypesShowOnLeft;
fileData.inlayHintsParameterNames = settings.inlayHintsParameterNames;
fileData.inlayHintsParameterNamesHideLeadingUnderscores = settings.inlayHintsParameterNamesHideLeadingUnderscores;
fileData.inlayHintsParameterNamesSuppressName = settings.inlayHintsParameterNamesSuppressName;
fileData.inlayHintsReferenceOperator = settings.inlayHintsReferenceOperator;
fileData.inlayHintsReferenceOperatorShowSpace = settings.inlayHintsReferenceOperatorShowSpace;
if (settings.inlayHintsAutoDeclarationTypes) {
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, fileData.typeHints);
Array.prototype.push.apply(fileData.inlayHints, resolvedTypeHints);
}
if (settings.inlayHintsParameterNames || settings.inlayHintsReferenceOperator) {
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, fileData.parameterHints);
Array.prototype.push.apply(fileData.inlayHints, resolvedParameterHints);
}
fileData.promise = new ManualPromise<vscode.InlayHint[]>();
fileData.promise.resolve(fileData.inlayHints);
this.onDidChangeInlayHintsEvent.fire();
return fileData.promise;
}
} else {
@@ -96,8 +56,6 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
fileData = {
version: document.version,
promise: new ManualPromise<vscode.InlayHint[]>(),
typeHints: [],
parameterHints: [],
inlayHints: []
};
this.allFileData.set(uriString, fileData);
@@ -135,8 +93,6 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
fileData = {
version: editor.document.version,
promise: new ManualPromise<vscode.InlayHint[]>(),
typeHints: [],
parameterHints: [],
inlayHints: []
};
newPromiseCreated = true;
@@ -149,38 +105,25 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
}
if (fileData.version !== editor.document.version) {
fileData.version = editor.document.version;
fileData.typeHints = [];
fileData.parameterHints = [];
fileData.inlayHints = [];
}
}
return [fileData, newPromiseCreated];
})();
const settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
if (startNewSet) {
fileData.inlayHints = [];
fileData.typeHints = [];
fileData.parameterHints = [];
fileData.inlayHintsAutoDeclarationTypes = settings.inlayHintsAutoDeclarationTypes;
fileData.inlayHintsAutoDeclarationTypesShowOnLeft = settings.inlayHintsAutoDeclarationTypesShowOnLeft;
fileData.inlayHintsParameterNames = settings.inlayHintsParameterNames;
fileData.inlayHintsParameterNamesHideLeadingUnderscores = settings.inlayHintsParameterNamesHideLeadingUnderscores;
fileData.inlayHintsParameterNamesSuppressName = settings.inlayHintsParameterNamesSuppressName;
fileData.inlayHintsReferenceOperator = settings.inlayHintsReferenceOperator;
fileData.inlayHintsReferenceOperatorShowSpace = settings.inlayHintsReferenceOperatorShowSpace;
}
const newTypeHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Type);
const newParameterHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Parameter);
Array.prototype.push.apply(fileData.typeHints, newTypeHints);
Array.prototype.push.apply(fileData.parameterHints, newParameterHints);
const typeHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Type);
const paramHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Parameter);
const settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
if (settings.inlayHintsAutoDeclarationTypes) {
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, newTypeHints);
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, typeHints);
Array.prototype.push.apply(fileData.inlayHints, resolvedTypeHints);
}
if (settings.inlayHintsParameterNames || settings.inlayHintsReferenceOperator) {
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, newParameterHints);
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, paramHints);
Array.prototype.push.apply(fileData.inlayHints, resolvedParameterHints);
}
+86 -180
View File
@@ -53,7 +53,7 @@ import {
import { Location, TextEdit, WorkspaceEdit } from './commonTypes';
import * as configs from './configurations';
import { DataBinding } from './dataBinding';
import { CppSourceStr, clients, configPrefix, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
import { CppSourceStr, clients, configPrefix, updateLanguageConfigurations, watchForCrashes } from './extension';
import { LocalizeStringParams, getLocaleId, getLocalizedString } from './localization';
import { PersistentFolderState, PersistentWorkspaceState } from './persistentState';
import { createProtocolFilter } from './protocolFilter';
@@ -111,6 +111,10 @@ export function disposeWorkspaceData(): void {
workspaceDisposables = [];
}
function logTelemetry(notificationBody: TelemetryPayload): void {
telemetry.logLanguageServerEvent(notificationBody.event, notificationBody.properties, notificationBody.metrics);
}
/** Note: We should not await on the following functions,
* or any function that returns a promise acquired from them,
* vscode.window.showInformationMessage, vscode.window.showWarningMessage, vscode.window.showErrorMessage
@@ -290,7 +294,6 @@ interface PublishRefactorDiagnosticsParams {
}
export interface CreateDeclarationOrDefinitionParams extends SelectionParams {
formatParams: FormatParams;
copyToClipboard: boolean;
}
@@ -533,19 +536,8 @@ interface DidChangeActiveEditorParams {
selection?: Range;
}
interface GetIncludesParams
{
maxDepth: number;
}
interface GetIncludesResult
{
includedFiles: string[];
}
// Requests
const PreInitializationRequest: RequestType<void, string, void> = new RequestType<void, string, void>('cpptools/preinitialize');
const InitializationRequest: RequestType<CppInitializationParams, void, void> = new RequestType<CppInitializationParams, void, void>('cpptools/initialize');
const InitializationRequest: RequestType<CppInitializationParams, string, void> = new RequestType<CppInitializationParams, string, void>('cpptools/initialize');
const QueryCompilerDefaultsRequest: RequestType<QueryDefaultCompilerParams, configs.CompilerDefaults, void> = new RequestType<QueryDefaultCompilerParams, configs.CompilerDefaults, void>('cpptools/queryCompilerDefaults');
const QueryTranslationUnitSourceRequest: RequestType<QueryTranslationUnitSourceParams, QueryTranslationUnitSourceResult, void> = new RequestType<QueryTranslationUnitSourceParams, QueryTranslationUnitSourceResult, void>('cpptools/queryTranslationUnitSource');
const SwitchHeaderSourceRequest: RequestType<SwitchHeaderSourceParams, string, void> = new RequestType<SwitchHeaderSourceParams, string, void>('cpptools/didSwitchHeaderSource');
@@ -561,7 +553,6 @@ const ExtractToFunctionRequest: RequestType<ExtractToFunctionParams, WorkspaceEd
const GoToDirectiveInGroupRequest: RequestType<GoToDirectiveInGroupParams, Position | undefined, void> = new RequestType<GoToDirectiveInGroupParams, Position | undefined, void>('cpptools/goToDirectiveInGroup');
const GenerateDoxygenCommentRequest: RequestType<GenerateDoxygenCommentParams, GenerateDoxygenCommentResult | undefined, void> = new RequestType<GenerateDoxygenCommentParams, GenerateDoxygenCommentResult, void>('cpptools/generateDoxygenComment');
const ChangeCppPropertiesRequest: RequestType<CppPropertiesParams, void, void> = new RequestType<CppPropertiesParams, void, void>('cpptools/didChangeCppProperties');
const IncludesRequest: RequestType<GetIncludesParams, GetIncludesResult, void> = new RequestType<GetIncludesParams, GetIncludesResult, void>('cpptools/getIncludes');
// Notifications to the server
const DidOpenNotification: NotificationType<DidOpenTextDocumentParams> = new NotificationType<DidOpenTextDocumentParams>('textDocument/didOpen');
@@ -638,13 +629,10 @@ class ClientModel {
constructor() {
this.isInitializingWorkspace = new DataBinding<boolean>(false);
this.isIndexingWorkspace = new DataBinding<boolean>(false);
// The following elements add a delay of 500ms before notitfying the UI that the icon can hide itself.
this.isParsingWorkspace = new DataBinding<boolean>(false, 500, false);
this.isParsingWorkspacePaused = new DataBinding<boolean>(false, 500, false);
this.isParsingFiles = new DataBinding<boolean>(false, 500, false);
this.isUpdatingIntelliSense = new DataBinding<boolean>(false, 500, false);
this.isParsingWorkspace = new DataBinding<boolean>(false);
this.isParsingWorkspacePaused = new DataBinding<boolean>(false);
this.isParsingFiles = new DataBinding<boolean>(false);
this.isUpdatingIntelliSense = new DataBinding<boolean>(false);
this.isRunningCodeAnalysis = new DataBinding<boolean>(false);
this.isCodeAnalysisPaused = new DataBinding<boolean>(false);
this.codeAnalysisProcessed = new DataBinding<number>(0);
@@ -790,7 +778,6 @@ export interface Client {
getShowConfigureIntelliSenseButton(): boolean;
setShowConfigureIntelliSenseButton(show: boolean): void;
addTrustedCompiler(path: string): Promise<void>;
getIncludes(maxDepth: number): Promise<GetIncludesResult>;
}
export function createClient(workspaceFolder?: vscode.WorkspaceFolder): Client {
@@ -1455,7 +1442,6 @@ export class DefaultClient implements Client {
maxConcurrentThreads: workspaceSettings.maxConcurrentThreads,
maxCachedProcesses: workspaceSettings.maxCachedProcesses,
maxMemory: workspaceSettings.maxMemory,
maxSymbolSearchResults: workspaceSettings.maxSymbolSearchResults,
loggingLevel: workspaceSettings.loggingLevel,
workspaceParsingPriority: workspaceSettings.workspaceParsingPriority,
workspaceSymbols: workspaceSettings.workspaceSymbols,
@@ -1486,8 +1472,8 @@ export class DefaultClient implements Client {
}
const serverName: string = this.getName(this.rootFolder);
const serverOptions: ServerOptions = {
run: { command: serverModule, options: { detached: false, cwd: util.getExtensionFilePath("bin") } },
debug: { command: serverModule, args: [serverName], options: { detached: true, cwd: util.getExtensionFilePath("bin") } }
run: { command: serverModule, options: { detached: false } },
debug: { command: serverModule, args: [serverName], options: { detached: true } }
};
// The IntelliSense process should automatically detect when AutoPCH is
@@ -1593,14 +1579,10 @@ export class DefaultClient implements Client {
languageClient.registerProposedFeatures();
await languageClient.start();
if (usesCrashHandler()) {
watchForCrashes(await languageClient.sendRequest(PreInitializationRequest, null));
}
// Move initialization to a separate message, so we can see log output from it.
// A request is used in order to wait for completion and ensure that no subsequent
// higher priority message may be processed before the Initialization request.
await languageClient.sendRequest(InitializationRequest, cppInitializationParams);
watchForCrashes(await languageClient.sendRequest(InitializationRequest, cppInitializationParams));
}
public async sendDidChangeSettings(): Promise<void> {
@@ -1625,9 +1607,11 @@ export class DefaultClient implements Client {
updateLanguageConfigurations();
}
if (changedSettings.loggingLevel) {
const oldLoggingLevelLogged: boolean = this.loggingLevel > 1;
this.loggingLevel = util.getNumericLoggingLevel(changedSettings.loggingLevel);
if (oldLoggingLevelLogged || this.loggingLevel > 1) {
const oldLoggingLevelLogged: boolean = !!this.loggingLevel && this.loggingLevel !== 0 && this.loggingLevel !== 1;
const newLoggingLevel: string | undefined = changedSettings.loggingLevel;
this.loggingLevel = util.getNumericLoggingLevel(newLoggingLevel);
const newLoggingLevelLogged: boolean = !!newLoggingLevel && newLoggingLevel !== "None" && newLoggingLevel !== "Error";
if (oldLoggingLevelLogged || newLoggingLevelLogged) {
const out: Logger = getOutputChannelLogger();
out.appendLine(localize({ key: "loggingLevel.changed", comment: ["{0} is the setting name 'loggingLevel', {1} is a string value such as 'Debug'"] }, "{0} has changed to: {1}", "loggingLevel", changedSettings.loggingLevel));
}
@@ -1644,24 +1628,6 @@ export class DefaultClient implements Client {
}
}
// If an inlay hints setting has changed, force an inlay provider update on the visible documents.
if (["inlayHints.autoDeclarationTypes.enabled",
"inlayHints.autoDeclarationTypes.showOnLeft",
"inlayHints.parameterNames.enabled",
"inlayHints.parameterNames.hideLeadingUnderscores",
"inlayHints.parameterNames.suppressWhenArgumentContainsName",
"inlayHints.referenceOperator.enabled",
"inlayHints.referenceOperator.showSpace"].some(setting => setting in changedSettings)) {
vscode.window.visibleTextEditors.forEach((visibleEditor: vscode.TextEditor) => {
// The exact range doesn't matter.
const visibleRange: vscode.Range | undefined = visibleEditor.visibleRanges.at(0);
if (visibleRange !== undefined) {
void vscode.commands.executeCommand<vscode.InlayHint[]>('vscode.executeInlayHintProvider',
visibleEditor.document.uri, visibleRange);
}
});
}
const showButtonSender: string = "settingsChanged";
if (changedSettings["default.configurationProvider"] !== undefined) {
void ui.ShowConfigureIntelliSenseButton(false, this, ConfigurationType.ConfigProvider, showButtonSender);
@@ -1999,17 +1965,13 @@ export class DefaultClient implements Client {
onFinished();
return;
}
try {
DefaultClient.isStarted.reset();
const resultCode = await this.provideCustomConfigurationAsync(docUri, requestFile, replaceExisting, provider);
telemetry.logLanguageServerEvent('provideCustomConfiguration', { providerId, resultCode });
} finally {
onFinished();
DefaultClient.isStarted.resolve();
}
telemetry.logLanguageServerEvent('provideCustomConfiguration', { providerId });
void this.provideCustomConfigurationAsync(docUri, requestFile, replaceExisting, onFinished, provider);
}
private async provideCustomConfigurationAsync(docUri: vscode.Uri, requestFile: string | undefined, replaceExisting: boolean | undefined, provider: CustomConfigurationProvider1): Promise<string> {
private async provideCustomConfigurationAsync(docUri: vscode.Uri, requestFile: string | undefined, replaceExisting: boolean | undefined, onFinished: () => void, provider: CustomConfigurationProvider1) {
DefaultClient.isStarted.reset();
const tokenSource: vscode.CancellationTokenSource = new vscode.CancellationTokenSource();
const params: QueryTranslationUnitSourceParams = {
@@ -2021,12 +1983,14 @@ export class DefaultClient implements Client {
const response: QueryTranslationUnitSourceResult = await this.languageClient.sendRequest(QueryTranslationUnitSourceRequest, params);
if (!response.candidates || response.candidates.length === 0) {
// If we didn't receive any candidates, no configuration is needed.
return "noCandidates";
onFinished();
DefaultClient.isStarted.resolve();
return;
}
// Need to loop through candidates, to see if we can get a custom configuration from any of them.
// Wrap all lookups in a single task, so we can apply a timeout to the entire duration.
const provideConfigurationAsync: () => Thenable<SourceFileConfigurationItem[] | undefined> = async () => {
const provideConfigurationAsync: () => Thenable<SourceFileConfigurationItem[] | null | undefined> = async () => {
const uris: vscode.Uri[] = [];
for (let i: number = 0; i < response.candidates.length; ++i) {
const candidate: string = response.candidates[i];
@@ -2086,41 +2050,44 @@ export class DefaultClient implements Client {
}
return configs as SourceFileConfigurationItem[];
}
return undefined;
if (tokenSource.token.isCancellationRequested) {
return null;
}
};
let result: string = "success";
try {
const configs: SourceFileConfigurationItem[] | undefined = await this.callTaskWithTimeout(provideConfigurationAsync, configProviderTimeout, tokenSource);
const configs: SourceFileConfigurationItem[] | null | undefined = await this.callTaskWithTimeout(provideConfigurationAsync, configProviderTimeout, tokenSource);
if (configs && configs.length > 0) {
this.sendCustomConfigurations(configs, provider.version);
} else {
result = "noConfigurations";
}
onFinished();
} catch (err) {
result = "timeout";
if (!requestFile) {
const settings: CppSettings = new CppSettings(this.RootUri);
if (settings.configurationWarnings && !this.isExternalHeader(docUri) && !vscode.debug.activeDebugSession) {
const dismiss: string = localize("dismiss.button", "Dismiss");
const disable: string = localize("disable.warnings.button", "Disable Warnings");
const configName: string | undefined = this.configuration.CurrentConfiguration?.name;
if (!configName) {
return "noConfigName";
}
let message: string = localize("unable.to.provide.configuration",
"{0} is unable to provide IntelliSense configuration information for '{1}'. Settings from the '{2}' configuration will be used instead.",
provider.name, docUri.fsPath, configName);
if (err) {
message += ` (${err})`;
}
if (requestFile) {
onFinished();
return;
}
const settings: CppSettings = new CppSettings(this.RootUri);
if (settings.configurationWarnings && !this.isExternalHeader(docUri) && !vscode.debug.activeDebugSession) {
const dismiss: string = localize("dismiss.button", "Dismiss");
const disable: string = localize("disable.warnings.button", "Disable Warnings");
const configName: string | undefined = this.configuration.CurrentConfiguration?.name;
if (!configName) {
return;
}
let message: string = localize("unable.to.provide.configuration",
"{0} is unable to provide IntelliSense configuration information for '{1}'. Settings from the '{2}' configuration will be used instead.",
provider.name, docUri.fsPath, configName);
if (err) {
message += ` (${err})`;
}
if (await vscode.window.showInformationMessage(message, dismiss, disable) === disable) {
settings.toggleSetting("configurationWarnings", "enabled", "disabled");
}
if (await vscode.window.showInformationMessage(message, dismiss, disable) === disable) {
settings.toggleSetting("configurationWarnings", "enabled", "disabled");
}
}
} finally {
DefaultClient.isStarted.resolve();
}
return result;
}
private async handleRequestCustomConfig(requestFile: string): Promise<void> {
@@ -2202,12 +2169,6 @@ export class DefaultClient implements Client {
await this.languageClient.sendNotification(DidOpenNotification, params);
}
public async getIncludes(maxDepth: number): Promise<GetIncludesResult> {
const params: GetIncludesParams = { maxDepth: maxDepth };
await this.ready;
return this.languageClient.sendRequest(IncludesRequest, params);
}
/**
* a Promise that can be awaited to know when it's ok to proceed.
*
@@ -2321,7 +2282,7 @@ export class DefaultClient implements Client {
this.languageClient.onNotification(ReloadWindowNotification, () => void util.promptForReloadWindowDueToSettingsChange());
this.languageClient.onNotification(UpdateTrustedCompilersNotification, (e) => void this.addTrustedCompiler(e.compilerPath));
this.languageClient.onNotification(LogTelemetryNotification, (e) => this.logTelemetry(e));
this.languageClient.onNotification(LogTelemetryNotification, logTelemetry);
this.languageClient.onNotification(ReportStatusNotification, (e) => void this.updateStatus(e));
this.languageClient.onNotification(ReportTagParseStatusNotification, (e) => this.updateTagParseStatus(e));
this.languageClient.onNotification(CompileCommandsPathsNotification, (e) => void this.promptCompileCommands(e));
@@ -2348,21 +2309,21 @@ export class DefaultClient implements Client {
this.languageClient.onNotification(CanceledReferencesNotification, this.serverCanceledReferences);
}
private handleIntelliSenseResult(intelliSenseResult: IntelliSenseResult): void {
const fileVersion: number | undefined = openFileVersions.get(intelliSenseResult.uri);
if (fileVersion !== undefined && fileVersion !== intelliSenseResult.fileVersion) {
private handleIntelliSenseResult(intelliseSenseResult: IntelliSenseResult): void {
const fileVersion: number | undefined = openFileVersions.get(intelliseSenseResult.uri);
if (fileVersion !== undefined && fileVersion !== intelliseSenseResult.fileVersion) {
return;
}
if (this.semanticTokensProvider) {
this.semanticTokensProvider.deliverTokens(intelliSenseResult.uri, intelliSenseResult.semanticTokens, intelliSenseResult.clearExistingSemanticTokens);
this.semanticTokensProvider.deliverTokens(intelliseSenseResult.uri, intelliseSenseResult.semanticTokens, intelliseSenseResult.clearExistingSemanticTokens);
}
if (this.inlayHintsProvider) {
this.inlayHintsProvider.deliverInlayHints(intelliSenseResult.uri, intelliSenseResult.inlayHints, intelliSenseResult.clearExistingInlayHint);
this.inlayHintsProvider.deliverInlayHints(intelliseSenseResult.uri, intelliseSenseResult.inlayHints, intelliseSenseResult.clearExistingInlayHint);
}
this.updateInactiveRegions(intelliSenseResult.uri, intelliSenseResult.inactiveRegions, intelliSenseResult.clearExistingInactiveRegions, intelliSenseResult.isCompletePass);
this.updateSquiggles(intelliSenseResult.uri, intelliSenseResult.diagnostics, intelliSenseResult.clearExistingDiagnostics);
this.updateInactiveRegions(intelliseSenseResult.uri, intelliseSenseResult.inactiveRegions, intelliseSenseResult.clearExistingInactiveRegions, intelliseSenseResult.isCompletePass);
this.updateSquiggles(intelliseSenseResult.uri, intelliseSenseResult.diagnostics, intelliseSenseResult.clearExistingDiagnostics);
}
private updateSquiggles(uriString: string, diagnostics: IntelliSenseDiagnostic[], startNewSet: boolean): void {
@@ -2560,13 +2521,6 @@ export class DefaultClient implements Client {
}
}
private logTelemetry(notificationBody: TelemetryPayload): void {
if (notificationBody.event === "includeSquiggles" && this.configurationProvider && notificationBody.properties) {
notificationBody.properties["providerId"] = this.configurationProvider;
}
telemetry.logLanguageServerEvent(notificationBody.event, notificationBody.properties, notificationBody.metrics);
}
private async updateStatus(notificationBody: ReportStatusNotificationBody): Promise<void> {
const message: string = notificationBody.status;
util.setProgress(util.getProgressExecutableSuccess());
@@ -2596,7 +2550,7 @@ export class DefaultClient implements Client {
testHook.updateStatus(status);
} else if (message.endsWith("IntelliSense done")) {
const settings: CppSettings = new CppSettings();
if (util.getNumericLoggingLevel(settings.loggingLevel) >= 6) {
if (settings.loggingLevel === "Debug") {
const out: Logger = getOutputChannelLogger();
const duration: number = Date.now() - timeStamp;
out.appendLine(localize("update.intellisense.time", "Update IntelliSense time (sec): {0}", duration / 1000));
@@ -2734,7 +2688,7 @@ export class DefaultClient implements Client {
const configurationNotSet: boolean = configProviderNotSetAndNoCache && compileCommandsNotSet && compilerPathNotSet;
showConfigStatus = showConfigStatus || (configurationNotSet &&
!!compilerDefaults && !compilerDefaults.trustedCompilerFound && trustedCompilerPaths && (trustedCompilerPaths.length !== 1 || trustedCompilerPaths[0] !== ""));
!!compilerDefaults && !compilerDefaults.trustedCompilerFound && (trustedCompilerPaths.length !== 1 || trustedCompilerPaths[0] !== ""));
const configProviderType: ConfigurationType = this.configuration.ConfigProviderAutoSelected ? ConfigurationType.AutoConfigProvider : ConfigurationType.ConfigProvider;
const compilerType: ConfigurationType = this.configuration.CurrentConfiguration?.compilerPathIsExplicit ? ConfigurationType.CompilerPath : ConfigurationType.AutoCompilerPath;
@@ -2951,6 +2905,11 @@ export class DefaultClient implements Client {
params.configurations.push(modifiedConfig);
});
const trusted_compiler_path: string | undefined = params.configurations[params.currentConfiguration].compilerPath;
if (trusted_compiler_path) {
void this.addTrustedCompiler(trusted_compiler_path).catch(logAndReturn.undefined);
}
await this.languageClient.sendRequest(ChangeCppPropertiesRequest, params);
if (!!this.lastCustomBrowseConfigurationProviderId && !!this.lastCustomBrowseConfiguration && !!this.lastCustomBrowseConfigurationProviderVersion) {
if (!this.doneInitialCustomBrowseConfigurationCheck) {
@@ -3028,7 +2987,7 @@ export class DefaultClient implements Client {
const settings: CppSettings = new CppSettings();
const out: Logger = getOutputChannelLogger();
if (util.getNumericLoggingLevel(settings.loggingLevel) >= 6) {
if (settings.loggingLevel === "Debug") {
out.appendLine(localize("configurations.received", "Custom configurations received:"));
}
const sanitized: SourceFileConfigurationItemAdapter[] = [];
@@ -3042,7 +3001,7 @@ export class DefaultClient implements Client {
uri = item.uri.toString();
}
this.configurationLogging.set(uri, JSON.stringify(item.configuration, null, 4));
if (util.getNumericLoggingLevel(settings.loggingLevel) >= 6) {
if (settings.loggingLevel === "Debug") {
out.appendLine(` uri: ${uri}`);
out.appendLine(` config: ${JSON.stringify(item.configuration, null, 2)}`);
}
@@ -3146,7 +3105,7 @@ export class DefaultClient implements Client {
}
const settings: CppSettings = new CppSettings();
if (util.getNumericLoggingLevel(settings.loggingLevel) >= 6) {
if (settings.loggingLevel === "Debug") {
const out: Logger = getOutputChannelLogger();
out.appendLine(localize("browse.configuration.received", "Custom browse configuration received: {0}", JSON.stringify(sanitized, null, 2)));
}
@@ -3445,11 +3404,8 @@ export class DefaultClient implements Client {
public async handleCreateDeclarationOrDefinition(isCopyToClipboard: boolean, codeActionRange?: Range): Promise<void> {
let range: vscode.Range | undefined;
let uri: vscode.Uri | undefined;
const editor: vscode.TextEditor | undefined = vscode.window.activeTextEditor;
const editorSettings: OtherSettings = new OtherSettings(uri);
const cppSettings: CppSettings = new CppSettings(uri);
if (editor) {
uri = editor.document.uri;
if (codeActionRange !== undefined) {
@@ -3467,55 +3423,10 @@ export class DefaultClient implements Client {
}
}
if (uri === undefined || range === undefined || editor === undefined) {
if (uri === undefined || range === undefined) {
return;
}
let formatParams: FormatParams | undefined;
if (cppSettings.useVcFormat(editor.document))
{
const editorConfigSettings: any = getEditorConfigSettings(uri.fsPath);
formatParams = {
editorConfigSettings: editorConfigSettings,
useVcFormat: true,
insertSpaces: editorConfigSettings.indent_style !== undefined ? editorConfigSettings.indent_style === "space" ? true : false : true,
tabSize: editorConfigSettings.tab_width !== undefined ? editorConfigSettings.tab_width : 4,
character: "",
range: {
start: {
character: 0,
line: 0
},
end: {
character: 0,
line: 0
}
},
onChanges: false,
uri: ''
};
} else {
formatParams = {
editorConfigSettings: {},
useVcFormat: false,
insertSpaces: editorSettings.editorInsertSpaces !== undefined ? editorSettings.editorInsertSpaces : true,
tabSize: editorSettings.editorTabSize !== undefined ? editorSettings.editorTabSize : 4,
character: "",
range: {
start: {
character: 0,
line: 0
},
end: {
character: 0,
line: 0
}
},
onChanges: false,
uri: ''
};
}
const params: CreateDeclarationOrDefinitionParams = {
uri: uri.toString(),
range: {
@@ -3528,7 +3439,6 @@ export class DefaultClient implements Client {
line: range.end.line
}
},
formatParams: formatParams,
copyToClipboard: isCopyToClipboard
};
@@ -3552,6 +3462,7 @@ export class DefaultClient implements Client {
return;
}
// Handle copy to clipboard.
if (result.clipboardText && params.copyToClipboard) {
return vscode.env.clipboard.writeText(result.clipboardText);
}
@@ -3765,9 +3676,9 @@ export class DefaultClient implements Client {
isReplace ? range.end.character :
range.end.character + edit.newText.length - rangeStartCharacter));
if (isSourceFile) {
sourceFormatUriAndRanges.push({ uri, range: newFormatRange });
sourceFormatUriAndRanges.push({uri, range: newFormatRange});
} else {
headerFormatUriAndRanges.push({ uri, range: newFormatRange });
headerFormatUriAndRanges.push({uri, range: newFormatRange});
}
if (isReplace || !isSourceFile) {
// Handle additional declaration lines added before the new function call.
@@ -3817,8 +3728,7 @@ export class DefaultClient implements Client {
// without being opened because otherwise users may not realize that
// the header had changed (unless they view source control differences).
await vscode.window.showTextDocument(headerFormatUriAndRanges[0].uri, {
selection: headerReplaceEditRange, preserveFocus: false
});
selection: headerReplaceEditRange, preserveFocus: false });
}
// Format the new text edits.
@@ -3862,7 +3772,8 @@ export class DefaultClient implements Client {
formatEdits.set(formatUriAndRange.uri, formatTextEdits);
return true;
};
if (!await tryFormat()) {
if (!await tryFormat())
{
await tryFormat(); // Try again;
}
};
@@ -3873,8 +3784,7 @@ export class DefaultClient implements Client {
// This showTextDocument is required in order to get the selection to be
// correct after the formatting edit is applied. It could be a VS Code bug.
await vscode.window.showTextDocument(headerFormatUriAndRanges[0].uri, {
selection: headerReplaceEditRange, preserveFocus: false
});
selection: headerReplaceEditRange, preserveFocus: false });
await vscode.workspace.applyEdit(formatEdits, { isRefactoring: true });
formatEdits = new vscode.WorkspaceEdit();
}
@@ -3882,8 +3792,7 @@ export class DefaultClient implements Client {
// Select the replaced code.
await vscode.window.showTextDocument(sourceFormatUriAndRanges[0].uri, {
selection: sourceReplaceEditRange, preserveFocus: false
});
selection: sourceReplaceEditRange, preserveFocus: false });
await formatRanges(sourceFormatUriAndRanges);
if (formatEdits.size > 0) {
@@ -3966,13 +3875,11 @@ export class DefaultClient implements Client {
if (path === null || path === undefined) {
return;
}
if (trustedCompilerPaths.includes(path)) {
DebugConfigurationProvider.ClearDetectedBuildTasks();
return;
if (!trustedCompilerPaths.includes(path)) {
trustedCompilerPaths.push(path);
}
trustedCompilerPaths.push(path);
compilerDefaults = await this.requestCompiler(path);
DebugConfigurationProvider.ClearDetectedBuildTasks();
compilerDefaults = await this.requestCompiler(path);
}
}
@@ -4085,5 +3992,4 @@ class NullClient implements Client {
getShowConfigureIntelliSenseButton(): boolean { return false; }
setShowConfigureIntelliSenseButton(show: boolean): void { }
addTrustedCompiler(path: string): Promise<void> { return Promise.resolve(); }
getIncludes(): Promise<GetIncludesResult> { return Promise.resolve({} as GetIncludesResult); }
}
+1 -1
View File
@@ -378,7 +378,7 @@ export function publishCodeAnalysisDiagnostics(params: PublishCodeAnalysisDiagno
docPage = `checks${checksGroup}/${checksPage}.html`;
}
// TODO: This should be checking the clang-tidy version used to better support usage of older versions.
const primaryDocUri: vscode.Uri = vscode.Uri.parse(`https://releases.llvm.org/18.1.1/tools/clang/tools/extra/docs/clang-tidy/${docPage}`);
const primaryDocUri: vscode.Uri = vscode.Uri.parse(`https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/${docPage}`);
diagnostic.code = { value: identifier.code, target: primaryDocUri };
if (new CppSettings().clangTidyCodeActionShowDocumentation) {
+64 -129
View File
@@ -289,6 +289,8 @@ export class CppProperties {
}
}
});
this.handleConfigurationChange();
}
public set CompilerDefaults(compilerDefaults: CompilerDefaults) {
this.defaultCompilerPath = compilerDefaults.trustedCompilerFound ? compilerDefaults.compilerPath : null;
@@ -425,11 +427,6 @@ export class CppProperties {
result["workspaceFolderBasename"] = this.rootUri ? path.basename(this.rootUri.fsPath) : "";
result["execPath"] = process.execPath;
result["pathSeparator"] = (os.platform() === 'win32') ? "\\" : "/";
result["/"] = (os.platform() === 'win32') ? "\\" : "/";
result["userHome"] = os.homedir();
if (util.getVcpkgRoot()) {
result["vcpkgRoot"] = util.getVcpkgRoot();
}
return result;
}
@@ -758,7 +755,7 @@ export class CppProperties {
return result;
}
private resolveAndSplit(paths: string[] | undefined, defaultValue: string[] | undefined, env: Environment, assumeRelative: boolean = true, glob: boolean = false): string[] {
private resolveAndSplit(paths: string[] | undefined, defaultValue: string[] | undefined, env: Environment, glob: boolean = false): string[] {
const resolvedVariables: string[] = [];
if (paths === undefined) {
return resolvedVariables;
@@ -770,7 +767,7 @@ export class CppProperties {
// Do not futher try to resolve a "${env:VAR}"
resolvedVariables.push(resolvedVariable);
} else {
const entries: string[] = resolvedVariable.split(path.delimiter).map(e => glob ? this.resolvePath(e, false, assumeRelative) : e).filter(e => e);
const entries: string[] = resolvedVariable.split(path.delimiter).map(e => glob ? this.resolvePath(e, false) : e).filter(e => e);
resolvedVariables.push(...entries);
}
});
@@ -841,12 +838,12 @@ export class CppProperties {
return property;
}
private updateConfigurationPathsArray(paths: string[] | undefined, defaultValue: string[] | undefined, env: Environment, assumeRelative: boolean = true): string[] | undefined {
private updateConfigurationPathsArray(paths: string[] | undefined, defaultValue: string[] | undefined, env: Environment): string[] | undefined {
if (paths) {
return this.resolveAndSplit(paths, defaultValue, env, assumeRelative, true);
return this.resolveAndSplit(paths, defaultValue, env, true);
}
if (!paths && defaultValue) {
return this.resolveAndSplit(defaultValue, [], env, assumeRelative, true);
return this.resolveAndSplit(defaultValue, [], env, true);
}
return paths;
}
@@ -937,7 +934,7 @@ export class CppProperties {
configuration.macFrameworkPath = this.updateConfigurationStringArray(configuration.macFrameworkPath, settings.defaultMacFrameworkPath, env);
configuration.windowsSdkVersion = this.updateConfigurationString(configuration.windowsSdkVersion, settings.defaultWindowsSdkVersion, env);
configuration.forcedInclude = this.updateConfigurationPathsArray(configuration.forcedInclude, settings.defaultForcedInclude, env, false);
configuration.forcedInclude = this.updateConfigurationPathsArray(configuration.forcedInclude, settings.defaultForcedInclude, env);
configuration.compileCommands = this.updateConfigurationString(configuration.compileCommands, settings.defaultCompileCommands, env);
configuration.compilerArgs = this.updateConfigurationStringArray(configuration.compilerArgs, settings.defaultCompilerArgs, env);
configuration.cStandard = this.updateConfigurationString(configuration.cStandard, settings.defaultCStandard, env);
@@ -979,11 +976,6 @@ export class CppProperties {
configuration.macFrameworkPath = this.defaultFrameworks;
}
}
} else {
// add compiler to list of trusted compilers
if (i === this.CurrentConfigurationIndex) {
void this.client.addTrustedCompiler(configuration.compilerPath).catch(logAndReturn.undefined);
}
}
} else {
// However, if compileCommands are used and compilerPath is explicitly set, it's still necessary to resolve variables in it.
@@ -1097,7 +1089,7 @@ export class CppProperties {
}
if (configuration.forcedInclude) {
configuration.forcedInclude = configuration.forcedInclude.map((path: string) => this.resolvePath(path, true, false));
configuration.forcedInclude = configuration.forcedInclude.map((path: string) => this.resolvePath(path));
}
if (configuration.includePath) {
@@ -1516,7 +1508,7 @@ export class CppProperties {
return success;
}
private resolvePath(input_path: string | undefined, replaceAsterisks: boolean = true, assumeRelative: boolean = true): string {
private resolvePath(input_path: string | undefined, replaceAsterisks: boolean = true): string {
if (!input_path || input_path === "${default}") {
return "";
}
@@ -1533,17 +1525,17 @@ export class CppProperties {
result = result.replace("${workspaceRoot}", this.rootUri.fsPath);
}
}
if (result.includes("${vcpkgRoot}") && util.getVcpkgRoot()) {
result = result.replace("${vcpkgRoot}", util.getVcpkgRoot());
}
if (replaceAsterisks && result.includes("*")) {
result = result.replace(/\*/g, "");
}
if (assumeRelative) {
// Make sure all paths result to an absolute path.
// Do not add the root path to an unresolved env variable.
if (!result.includes("env:") && !path.isAbsolute(result) && this.rootUri) {
result = path.join(this.rootUri.fsPath, result);
}
// Make sure all paths result to an absolute path.
// Do not add the root path to an unresolved env variable.
if (!result.includes("env:") && !path.isAbsolute(result) && this.rootUri) {
result = path.join(this.rootUri.fsPath, result);
}
return result;
@@ -1637,7 +1629,7 @@ export class CppProperties {
errors.browsePath = this.validatePath(config.browse ? config.browse.path : undefined);
// Validate files
errors.forcedInclude = this.validatePath(config.forcedInclude, {isDirectory: false, assumeRelative: false});
errors.forcedInclude = this.validatePath(config.forcedInclude, {isDirectory: false, skipRelativePaths: true});
errors.compileCommands = this.validatePath(config.compileCommands, {isDirectory: false});
errors.dotConfig = this.validatePath(config.dotConfig, {isDirectory: false});
errors.databaseFilename = this.validatePath(config.browse ? config.browse.databaseFilename : undefined, {isDirectory: false});
@@ -1653,7 +1645,7 @@ export class CppProperties {
return errors;
}
private validatePath(input: string | string[] | undefined, {isDirectory = true, assumeRelative = true, globPaths = false} = {}): string | undefined {
private validatePath(input: string | string[] | undefined, {isDirectory = true, skipRelativePaths = false, globPaths = false} = {}): string | undefined {
if (!input) {
return undefined;
}
@@ -1669,7 +1661,7 @@ export class CppProperties {
}
// Resolve and split any environment variables
paths = this.resolveAndSplit(paths, undefined, this.ExtendedEnvironment, assumeRelative, globPaths);
paths = this.resolveAndSplit(paths, undefined, this.ExtendedEnvironment, globPaths);
for (const p of paths) {
let pathExists: boolean = true;
@@ -1680,7 +1672,7 @@ export class CppProperties {
// Check if resolved path exists
if (!fs.existsSync(resolvedPath)) {
if (assumeRelative && !path.isAbsolute(resolvedPath)) {
if (skipRelativePaths && !path.isAbsolute(resolvedPath)) {
continue;
} else if (!this.rootUri) {
pathExists = false;
@@ -1838,9 +1830,9 @@ export class CppProperties {
curText = curText.substring(0, nextNameStart2);
}
if (this.prevSquiggleMetrics.get(currentConfiguration.name) === undefined) {
this.prevSquiggleMetrics.set(currentConfiguration.name, { PathNonExistent: 0, PathNotAFile: 0, PathNotADirectory: 0, CompilerPathMissingQuotes: 0, CompilerModeMismatch: 0, MultiplePathsNotAllowed: 0 });
this.prevSquiggleMetrics.set(currentConfiguration.name, { PathNonExistent: 0, PathNotAFile: 0, PathNotADirectory: 0, CompilerPathMissingQuotes: 0, CompilerModeMismatch: 0 });
}
const newSquiggleMetrics: { [key: string]: number } = { PathNonExistent: 0, PathNotAFile: 0, PathNotADirectory: 0, CompilerPathMissingQuotes: 0, CompilerModeMismatch: 0, MultiplePathsNotAllowed: 0 };
const newSquiggleMetrics: { [key: string]: number } = { PathNonExistent: 0, PathNotAFile: 0, PathNotADirectory: 0, CompilerPathMissingQuotes: 0, CompilerModeMismatch: 0 };
const isWindows: boolean = os.platform() === 'win32';
// TODO: Add other squiggles.
@@ -1867,7 +1859,7 @@ export class CppProperties {
}
// Check for path-related squiggles.
const paths: string[] = [];
let paths: string[] = [];
let compilerPath: string | undefined;
for (const pathArray of [ currentConfiguration.browse ? currentConfiguration.browse.path : undefined,
currentConfiguration.includePath, currentConfiguration.macFrameworkPath ]) {
@@ -1895,7 +1887,10 @@ export class CppProperties {
compilerPath = currentConfiguration.compilerPath;
}
compilerPath = this.resolvePath(compilerPath).trim();
// Resolve and split any environment variables
paths = this.resolveAndSplit(paths, undefined, this.ExtendedEnvironment);
compilerPath = util.resolveVariables(compilerPath, this.ExtendedEnvironment).trim();
compilerPath = this.resolvePath(compilerPath);
// Get the start/end for properties that are file-only.
const forcedIncludeStart: number = curText.search(/\s*\"forcedInclude\"\s*:\s*\[/);
@@ -1958,7 +1953,8 @@ export class CppProperties {
let dotConfigMessage: string | undefined;
dotConfigPath = currentConfiguration.dotConfig;
dotConfigPath = this.resolvePath(dotConfigPath).trim();
dotConfigPath = util.resolveVariables(dotConfigPath, this.ExtendedEnvironment).trim();
dotConfigPath = this.resolvePath(dotConfigPath);
// does not try resolve if the dotConfig property is empty
dotConfigPath = dotConfigPath !== '' ? dotConfigPath : undefined;
@@ -1997,6 +1993,25 @@ export class CppProperties {
continue;
}
let resolvedPath: string = this.resolvePath(curPath);
if (!resolvedPath) {
continue;
}
let pathExists: boolean = true;
if (this.rootUri) {
const checkPathExists: any = util.checkPathExistsSync(resolvedPath, this.rootUri.fsPath + path.sep, isWindows, false);
pathExists = checkPathExists.pathExists;
resolvedPath = checkPathExists.path;
}
// Normalize path separators.
if (path.sep === "/") {
resolvedPath = resolvedPath.replace(/\\/g, path.sep);
} else {
resolvedPath = resolvedPath.replace(/\//g, path.sep);
}
// Iterate through the text and apply squiggles.
// Escape the path string for literal use in a regular expression
// Need to escape any quotes to match the original text
let escapedPath: string = curPath.replace(/"/g, '\\"');
@@ -2006,56 +2021,7 @@ export class CppProperties {
// and extend that pattern to the next quote before and next quote after it.
const pattern: RegExp = new RegExp(`"[^"]*?(?<="|;)${escapedPath}(?="|;).*?"`, "g");
const configMatches: string[] | null = curText.match(pattern);
const expandedPaths: string[] = this.resolveAndSplit([curPath], undefined, this.ExtendedEnvironment, true, true);
const incorrectExpandedPaths: string[] = [];
if (expandedPaths.length <= 0) {
continue;
}
if (this.rootUri) {
for (const [index, expandedPath] of expandedPaths.entries()) {
if (expandedPath.includes("${workspaceFolder}")) {
expandedPaths[index] = this.resolvePath(expandedPath, false);
} else {
expandedPaths[index] = this.resolvePath(expandedPath);
}
const checkPathExists: any = util.checkPathExistsSync(expandedPaths[index], this.rootUri.fsPath + path.sep, isWindows, false);
if (!checkPathExists.pathExists) {
// If there are multiple paths, store any non-existing paths to squiggle later on.
incorrectExpandedPaths.push(expandedPaths[index]);
}
}
}
const pathExists: boolean = incorrectExpandedPaths.length === 0;
for (const [index, expandedPath] of expandedPaths.entries()) {
// Normalize path separators.
if (path.sep === "/") {
expandedPaths[index] = expandedPath.replace(/\\/g, path.sep);
} else {
expandedPaths[index] = expandedPath.replace(/\//g, path.sep);
}
}
// Iterate through the text and apply squiggles.
let globPath: boolean = false;
const asteriskPosition = curPath.indexOf("*");
if (asteriskPosition !== -1) {
if (asteriskPosition !== curPath.length - 1 && asteriskPosition !== curPath.length - 2) {
globPath = true;
} else if (asteriskPosition === curPath.length - 2) {
if (curPath[asteriskPosition + 1] !== '*') {
globPath = true;
}
}
}
if (configMatches && !globPath) {
if (configMatches) {
let curOffset: number = 0;
let endOffset: number = 0;
for (const curMatch of configMatches) {
@@ -2064,57 +2030,29 @@ export class CppProperties {
if (curOffset >= compilerPathStart && curOffset <= compilerPathEnd) {
continue;
}
let message: string = "";
let message: string;
if (!pathExists) {
if (curOffset >= forcedIncludeStart && curOffset <= forcedeIncludeEnd
&& !path.isAbsolute(expandedPaths[0])) {
&& !path.isAbsolute(resolvedPath)) {
continue; // Skip the error, because it could be resolved recursively.
}
let badPath = "";
if (incorrectExpandedPaths.length > 0) {
badPath = incorrectExpandedPaths.map(s => `"${s}"`).join(', ');
} else {
badPath = `"${expandedPaths[0]}"`;
}
message = localize('cannot.find2', "Cannot find {0}", badPath);
message = localize('cannot.find2', "Cannot find \"{0}\".", resolvedPath);
newSquiggleMetrics.PathNonExistent++;
} else {
// Check for file versus path mismatches.
if ((curOffset >= forcedIncludeStart && curOffset <= forcedeIncludeEnd) ||
(curOffset >= compileCommandsStart && curOffset <= compileCommandsEnd)) {
if (expandedPaths.length > 1) {
message = localize("multiple.paths.not.allowed", "Multiple paths are not allowed.");
newSquiggleMetrics.MultiplePathsNotAllowed++;
} else {
const resolvedPath = this.resolvePath(expandedPaths[0]);
if (util.checkFileExistsSync(resolvedPath)) {
continue;
}
message = localize("path.is.not.a.file", "Path is not a file: {0}", expandedPaths[0]);
newSquiggleMetrics.PathNotAFile++;
}
} else {
const mismatchedPaths: string[] = [];
for (const expandedPath of expandedPaths) {
const resolvedPath = this.resolvePath(expandedPath);
if (!util.checkDirectoryExistsSync(resolvedPath)) {
mismatchedPaths.push(expandedPath);
}
}
let badPath = "";
if (mismatchedPaths.length > 1) {
badPath = mismatchedPaths.map(s => `"${s}"`).join(', ');
message = localize('paths.are.not.directories', "Paths are not directories: {0}", badPath);
newSquiggleMetrics.PathNotADirectory++;
} else if (mismatchedPaths.length === 1) {
badPath = `"${mismatchedPaths[0]}"`;
message = localize('path.is.not.a.directory', "Path is not a directory: {0}", badPath);
newSquiggleMetrics.PathNotADirectory++;
} else {
(curOffset >= compileCommandsStart && curOffset <= compileCommandsEnd)) {
if (util.checkFileExistsSync(resolvedPath)) {
continue;
}
message = localize("path.is.not.a.file", "Path is not a file: {0}", resolvedPath);
newSquiggleMetrics.PathNotAFile++;
} else {
if (util.checkDirectoryExistsSync(resolvedPath)) {
continue;
}
message = localize("path.is.not.a.directory", "Path is not a directory: {0}", resolvedPath);
newSquiggleMetrics.PathNotADirectory++;
}
}
const diagnostic: vscode.Diagnostic = new vscode.Diagnostic(
@@ -2134,7 +2072,7 @@ export class CppProperties {
endOffset = curOffset + curMatch.length;
let message: string;
if (!pathExists) {
message = localize('cannot.find2', "Cannot find \"{0}\".", expandedPaths[0]);
message = localize('cannot.find2', "Cannot find \"{0}\".", resolvedPath);
newSquiggleMetrics.PathNonExistent++;
const diagnostic: vscode.Diagnostic = new vscode.Diagnostic(
new vscode.Range(document.positionAt(envTextStartOffSet + curOffset),
@@ -2170,9 +2108,6 @@ export class CppProperties {
if (newSquiggleMetrics.CompilerModeMismatch !== this.prevSquiggleMetrics.get(currentConfiguration.name)?.CompilerModeMismatch) {
changedSquiggleMetrics.CompilerModeMismatch = newSquiggleMetrics.CompilerModeMismatch;
}
if (newSquiggleMetrics.MultiplePathsNotAllowed !== this.prevSquiggleMetrics.get(currentConfiguration.name)?.MultiplePathsNotAllowed) {
changedSquiggleMetrics.MultiplePathsNotAllowed = newSquiggleMetrics.MultiplePathsNotAllowed;
}
if (Object.keys(changedSquiggleMetrics).length > 0) {
telemetry.logLanguageServerEvent("ConfigSquiggles", undefined, changedSquiggleMetrics);
}
@@ -21,8 +21,8 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export interface CppBuildTaskDefinition extends TaskDefinition {
type: string;
label: string; // The label appears in tasks.json file.
command: string | util.IQuotedString;
args: (string | util.IQuotedString)[];
command: string;
args: string[];
options: cp.ExecOptions | cp.SpawnOptions | undefined;
}
@@ -166,24 +166,20 @@ export class CppBuildTaskProvider implements TaskProvider {
return result;
}
private getTask: (compilerPath: string | util.IQuotedString, appendSourceToName: boolean, compilerArgs?: (string | util.IQuotedString)[], definition?: CppBuildTaskDefinition, detail?: string) => Task = (compilerPath: string | util.IQuotedString, appendSourceToName: boolean, compilerArgs?: (string | util.IQuotedString)[], definition?: CppBuildTaskDefinition, detail?: string) => {
const compilerPathString: string = util.isString(compilerPath) ? compilerPath : compilerPath.value;
const compilerPathBase: string = path.basename(compilerPathString);
private getTask: (compilerPath: string, appendSourceToName: boolean, compilerArgs?: string[], definition?: CppBuildTaskDefinition, detail?: string) => Task = (compilerPath: string, appendSourceToName: boolean, compilerArgs?: string[], definition?: CppBuildTaskDefinition, detail?: string) => {
const compilerPathBase: string = path.basename(compilerPath);
const isCl: boolean = compilerPathBase.toLowerCase() === "cl.exe";
const isClang: boolean = !isCl && compilerPathBase.toLowerCase().includes("clang");
// Double-quote the command if needed.
const resolvedCompilerPathString: string = isCl ? compilerPathBase : compilerPathString;
let resolvedCompilerPath: string | util.IQuotedString = compilerPath;
if (isCl) {
resolvedCompilerPath = compilerPathBase;
}
let resolvedcompilerPath: string = isCl ? compilerPathBase : compilerPath;
resolvedcompilerPath = util.quoteArgument(resolvedcompilerPath);
if (!definition) {
const isWindows: boolean = os.platform() === 'win32';
const taskLabel: string = ((appendSourceToName && !compilerPathBase.startsWith(ext.configPrefix)) ?
ext.configPrefix : "") + compilerPathBase + " " + localize("build.active.file", "build active file");
const programName: string = util.defaultExePath();
let args: (string | util.IQuotedString)[] = isCl ?
let args: string[] = isCl ?
['/Zi', '/EHsc', '/nologo', `/Fe${programName}`, '${file}'] :
isClang ?
['-fcolor-diagnostics', '-fansi-escape-codes', '-g', '${file}', '-o', programName] :
@@ -192,38 +188,30 @@ export class CppBuildTaskProvider implements TaskProvider {
if (compilerArgs && compilerArgs.length > 0) {
args = args.concat(compilerArgs);
}
const cwd: string = isWindows && !isCl && !process.env.PATH?.includes(path.dirname(compilerPathString)) ? path.dirname(compilerPathString) : "${fileDirname}";
const cwd: string = isWindows && !isCl && !process.env.PATH?.includes(path.dirname(compilerPath)) ? path.dirname(compilerPath) : "${fileDirname}";
const options: cp.ExecOptions | cp.SpawnOptions | undefined = { cwd: cwd };
definition = {
type: CppBuildTaskProvider.CppBuildScriptType,
label: taskLabel,
command: compilerPath,
command: isCl ? compilerPathBase : compilerPath,
args: args,
options: options
};
if (isCl) {
definition.command = compilerPathBase;
}
}
const editor: TextEditor | undefined = window.activeTextEditor;
const folder: WorkspaceFolder | undefined = editor ? workspace.getWorkspaceFolder(editor.document.uri) : undefined;
const taskUsesActiveFile: boolean = definition.args.some(arg => {
if (util.isString(arg)) {
return arg.indexOf('${file}') >= 0;
}
return arg.value.indexOf('${file}') >= 0;
}); // Need to check this before ${file} is resolved
const taskUsesActiveFile: boolean = definition.args.some(arg => arg.indexOf('${file}') >= 0); // Need to check this before ${file} is resolved
const scope: WorkspaceFolder | TaskScope = folder ? folder : TaskScope.Workspace;
const task: CppBuildTask = new Task(definition, scope, definition.label, ext.CppSourceStr,
new CustomExecution(async (resolvedDefinition: TaskDefinition): Promise<Pseudoterminal> =>
// When the task is executed, this callback will run. Here, we setup for running the task.
new CustomBuildTaskTerminal(resolvedCompilerPath, resolvedDefinition.args, resolvedDefinition.options, { taskUsesActiveFile, insertStd: isClang && os.platform() === 'darwin' })
new CustomBuildTaskTerminal(resolvedcompilerPath, resolvedDefinition.args, resolvedDefinition.options, { taskUsesActiveFile, insertStd: isClang && os.platform() === 'darwin' })
), isCl ? '$msCompile' : '$gcc');
task.group = TaskGroup.Build;
task.detail = detail ? detail : localize("compiler.details", "compiler:") + " " + resolvedCompilerPathString;
task.detail = detail ? detail : localize("compiler.details", "compiler:") + " " + resolvedcompilerPath;
return task;
};
@@ -366,7 +354,7 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
public get onDidClose(): Event<number> { return this.closeEmitter.event; }
private endOfLine: string = "\r\n";
constructor(private command: string | util.IQuotedString, private args: (string | util.IQuotedString)[], private options: cp.ExecOptions | undefined, private buildOptions: BuildOptions) {
constructor(private command: string, private args: string[], private options: cp.ExecOptions | cp.SpawnOptions | undefined, private buildOptions: BuildOptions) {
}
async open(_initialDimensions: TerminalDimensions | undefined): Promise<void> {
@@ -392,29 +380,22 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
private async doBuild(): Promise<any> {
// Do build.
let resolvedCommand: string | util.IQuotedString | undefined;
if (util.isString(this.command)) {
resolvedCommand = util.resolveVariables(this.command);
} else {
resolvedCommand = {
value: util.resolveVariables(this.command.value),
quoting: this.command.quoting
};
}
let command: string = util.resolveVariables(this.command);
let activeCommand: string = command;
// Create the exe folder path if it doesn't exist.
const exePath: string | undefined = util.resolveVariables(util.findExePathInArgs(this.args));
util.createDirIfNotExistsSync(exePath);
this.args.forEach((value, index) => {
if (util.isString(value)) {
this.args[index] = util.resolveVariables(value);
} else {
value.value = util.resolveVariables(value.value);
}
value = util.quoteArgument(util.resolveVariables(value));
activeCommand = activeCommand + " " + value;
this.args[index] = value;
});
if (this.options === undefined) {
this.options = { };
if (this.options) {
this.options.shell = true;
} else {
this.options = { "shell": true };
}
if (this.options.cwd) {
this.options.cwd = util.resolveVariables(this.options.cwd.toString());
@@ -444,12 +425,15 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
}
};
const activeCommand: string = util.buildShellCommandLine(resolvedCommand, this.command, this.args);
if (os.platform() === 'win32') {
command = `cmd /c chcp 65001>nul && ${command}`;
}
this.writeEmitter.fire(activeCommand + this.endOfLine);
let child: cp.ChildProcess | undefined;
try {
child = cp.exec(activeCommand, this.options);
child = cp.spawn(command, this.args, this.options ? this.options : {});
let error: string = "";
let stdout: string = "";
let stderr: string = "";
+5 -42
View File
@@ -4,37 +4,13 @@
* ------------------------------------------------------------------------------------------ */
import * as vscode from 'vscode';
class Deferral {
private timer?: NodeJS.Timeout;
constructor(callback: () => void, timeout: number) {
this.timer = setTimeout(() => {
this.timer = undefined;
callback();
}, timeout);
}
public cancel() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = undefined;
}
}
}
export class DataBinding<T> {
private value: T;
private valueChanged = new vscode.EventEmitter<T>();
private isActive: boolean = true;
private deferral?: Deferral;
/**
* Bind an event to a value so that a data model can automatically update the UI when values change.
* Since values can change quickly and cause UI to flicker, an optional delay/trigger combination can
* be specified to prevent UI elements from appearing/disappearing too quickly.
* @param value The initial value in the binding.
* @param delay An optional delay (in milliseconds) for firing the value changed event.
* @param delayValueTrigger The value that triggers an event delay.
*/
constructor(private value: T, private delay: number = 0, private delayValueTrigger?: T) {
constructor(value: T) {
this.value = value;
this.isActive = true;
}
@@ -44,21 +20,8 @@ export class DataBinding<T> {
public set Value(value: T) {
if (value !== this.value) {
if (this.delay === 0 || value !== this.delayValueTrigger) {
this.value = value;
this.valueChanged.fire(this.value);
} else {
if (this.deferral) {
this.deferral.cancel();
}
this.deferral = new Deferral(() => {
this.value = value;
this.valueChanged.fire(this.value);
}, this.delay);
}
} else if (this.deferral) {
this.deferral.cancel();
this.deferral = undefined;
this.value = value;
this.valueChanged.fire(this.value);
}
}
+32 -61
View File
@@ -17,7 +17,6 @@ import { TargetPopulation } from 'vscode-tas-client';
import * as which from 'which';
import { logAndReturn } from '../Utility/Async/returns';
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';
@@ -37,9 +36,7 @@ const localize: nls.LocalizeFunc = nls.loadMessageBundle();
export const CppSourceStr: string = "C/C++";
export const configPrefix: string = "C/C++: ";
let prevMacCrashFile: string;
let prevCppCrashFile: string;
let prevCppCrashCallStackData: string = "";
let prevCrashFile: string;
export let clients: ClientCollection;
let activeDocument: vscode.TextDocument | undefined;
let ui: LanguageStatusUI;
@@ -147,6 +144,7 @@ function sendActivationTelemetry(): void {
* activate: set up the extension for language services
*/
export async function activate(): Promise<void> {
sendActivationTelemetry();
const checkForConflictingExtensions: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".checkForConflictingExtensions", true);
if (checkForConflictingExtensions.Value) {
@@ -403,7 +401,6 @@ export function registerCommands(enabled: boolean): void {
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ExtractToFreeFunction', enabled ? () => onExtractToFunction(true, false) : onDisabledCommand));
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ExtractToMemberFunction', enabled ? () => onExtractToFunction(false, true) : onDisabledCommand));
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ExpandSelection', enabled ? (r: Range) => onExpandSelection(r) : onDisabledCommand));
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.getIncludes', enabled ? (maxDepth: number) => getIncludes(maxDepth) : onDisabledCommand));
}
function onDisabledCommand() {
@@ -917,7 +914,7 @@ function onShowRefCommand(arg?: TreeNode): void {
function reportMacCrashes(): void {
if (process.platform === "darwin") {
prevMacCrashFile = "";
prevCrashFile = "";
const home: string = os.homedir();
const crashFolder: string = path.resolve(home, "Library/Logs/DiagnosticReports");
fs.stat(crashFolder, (err) => {
@@ -935,10 +932,10 @@ function reportMacCrashes(): void {
if (event !== "rename") {
return;
}
if (!filename || filename === prevMacCrashFile) {
if (!filename || filename === prevCrashFile) {
return;
}
prevMacCrashFile = filename;
prevCrashFile = filename;
if (!filename.startsWith("cpptools")) {
return;
}
@@ -961,13 +958,9 @@ function reportMacCrashes(): void {
}
}
export function usesCrashHandler(): boolean {
return process.platform !== "win32" && (process.platform === "darwin" || os.arch() === "x64");
}
export function watchForCrashes(crashDirectory: string): void {
if (crashDirectory !== "") {
prevCppCrashFile = "";
if (process.platform !== "win32") {
prevCrashFile = "";
fs.stat(crashDirectory, (err) => {
const crashObject: Record<string, string> = {};
if (err?.code) {
@@ -983,19 +976,17 @@ export function watchForCrashes(crashDirectory: string): void {
if (event !== "rename") {
return;
}
if (!filename || filename === prevCppCrashFile) {
if (!filename || filename === prevCrashFile) {
return;
}
prevCppCrashFile = filename;
prevCrashFile = filename;
if (!filename.startsWith("cpptools")) {
return;
}
const crashDate: Date = new Date();
// Wait 5 seconds to allow time for the crash log to finish being written.
setTimeout(() => {
fs.readFile(path.resolve(crashDirectory, filename), 'utf8', (err, data) => {
void handleCrashFileRead(crashDirectory, filename, crashDate, err, data);
void handleCrashFileRead(crashDirectory, filename, err, data);
});
}, 5000);
});
@@ -1120,7 +1111,7 @@ function handleMacCrashFileRead(err: NodeJS.ErrnoException | undefined | null, d
logMacCrashTelemetry(data);
}
async function handleCrashFileRead(crashDirectory: string, crashFile: string, crashDate: Date, err: NodeJS.ErrnoException | undefined | null, data: string): Promise<void> {
async function handleCrashFileRead(crashDirectory: string, crashFile: string, err: NodeJS.ErrnoException | undefined | null, data: string): Promise<void> {
if (err) {
if (err.code === "ENOENT") {
return; // ignore known issue
@@ -1130,23 +1121,23 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
const lines: string[] = data.split("\n");
let addressData: string = ".\n.";
const isCppToolsSrv: boolean = crashFile.startsWith("cpptools-srv");
const telemetryHeader: string = (isCppToolsSrv ? "cpptools-srv.txt" : crashFile) + "\n";
data = crashFile + "\n";
const filtPath: string | null = which.sync("c++filt", { nothrow: true });
const isMac: boolean = process.platform === "darwin";
const startStr: string = isMac ? " _" : "<";
const offsetStr: string = isMac ? " + " : "+";
const endOffsetStr: string = isMac ? " " : " <";
const startStr: string = isMac ? " _" : "(";
const offsetStr: string = isMac ? " + " : "+0x";
const endOffsetStr: string = isMac ? " " : ")";
const dotStr: string = "…";
const signalType: string = lines[0];
let crashCallStack: string = "";
data += lines[0]; // signal type
for (let lineNum: number = 2; lineNum < lines.length - 3; ++lineNum) { // skip first/last lines
crashCallStack += "\n";
addressData += "\n";
if (lineNum > 1) {
data += "\n";
addressData += "\n";
}
const line: string = lines[lineNum];
const startPos: number = line.indexOf(startStr);
if (startPos === -1 || line[startPos + (isMac ? 1 : 4)] === "+") {
crashCallStack += dotStr;
if (startPos === -1 || line[startPos + 1] === "+") {
data += dotStr;
const startAddressPos: number = line.indexOf("0x");
const endAddressPos: number = line.indexOf(endOffsetStr, startAddressPos + 2);
if (startAddressPos === -1 || endAddressPos === -1 || startAddressPos >= endAddressPos) {
@@ -1158,16 +1149,13 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
}
const offsetPos: number = line.indexOf(offsetStr, startPos + startStr.length);
if (offsetPos === -1) {
crashCallStack += "Missing offsetStr";
data += "Missing offsetStr";
continue; // unexpected
}
const startPos2: number = startPos + 1;
let funcStr: string = line.substring(startPos2, offsetPos);
if (filtPath) {
let ret: util.ProcessReturnType | undefined = await util.spawnChildProcess(filtPath, ["--no-strip-underscore", funcStr], undefined, true).catch(logAndReturn.undefined);
if (ret?.output === funcStr) {
ret = await util.spawnChildProcess(filtPath, [funcStr], undefined, true).catch(logAndReturn.undefined);
}
const ret: util.ProcessReturnType | undefined = await util.spawnChildProcess(filtPath, [funcStr], undefined, true).catch(logAndReturn.undefined);
if (ret !== undefined) {
funcStr = ret.output;
funcStr = funcStr.replace(/std::(?:__1|__cxx11)/g, "std"); // simplify std namespaces.
@@ -1178,49 +1166,36 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
funcStr = funcStr.replace(/, std::allocator<std::string>/g, "");
}
}
crashCallStack += funcStr + offsetStr;
data += funcStr + offsetStr;
const offsetPos2: number = offsetPos + offsetStr.length;
if (isMac) {
crashCallStack += line.substring(offsetPos2);
data += line.substring(offsetPos2);
const startAddressPos: number = line.indexOf("0x");
if (startAddressPos === -1 || startAddressPos >= startPos) {
// unexpected
crashCallStack += "<Missing 0x>";
data += "<Missing 0x>";
continue;
}
addressData += `${line.substring(startAddressPos, startPos)}`;
} else {
const endPos: number = line.indexOf(">", offsetPos2);
const endPos: number = line.indexOf(")", offsetPos2);
if (endPos === -1) {
crashCallStack += "<Missing > >";
data += "<Missing )>";
continue; // unexpected
}
crashCallStack += line.substring(offsetPos2, endPos);
data += line.substring(offsetPos2, endPos);
}
}
if (crashCallStack !== prevCppCrashCallStackData) {
prevCppCrashCallStackData = crashCallStack;
const settings: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", null);
if (lines.length >= 6 && util.getNumericLoggingLevel(settings.get<string>("loggingLevel")) >= 1) {
const out: vscode.OutputChannel = getCrashCallStacksChannel();
out.appendLine(`\n${isCppToolsSrv ? "cpptools-srv" : "cpptools"}\n${crashDate.toLocaleString()}\n${signalType}${crashCallStack}`);
}
}
data = telemetryHeader + signalType + crashCallStack;
if (data.length > 8192) { // The API has an 8k limit.
data = data.substring(0, 8191) + "…";
}
console.log(`Crash call stack:\n${data}`);
logCppCrashTelemetry(data, addressData);
await util.deleteFile(path.resolve(crashDirectory, crashFile)).catch(logAndReturn.undefined);
if (crashFile === "cpptools.txt") {
void util.deleteDirectory(crashDirectory).catch(logAndReturn.undefined);
}
void util.deleteDirectory(crashDirectory).catch(logAndReturn.undefined);
}
export function deactivate(): Thenable<void> {
@@ -1330,7 +1305,3 @@ export async function preReleaseCheck(): Promise<void> {
}
}
}
export async function getIncludes(maxDepth: number): Promise<any> {
return clients.ActiveClient.getIncludes(maxDepth);
}
-2
View File
@@ -142,7 +142,6 @@ export interface SettingsParams {
maxConcurrentThreads: number | null | undefined;
maxCachedProcesses: number | null | undefined;
maxMemory: number | null | undefined;
maxSymbolSearchResults: number | undefined;
loggingLevel: string | undefined;
workspaceParsingPriority: string | undefined;
workspaceSymbols: string | undefined;
@@ -314,7 +313,6 @@ export class CppSettings extends Settings {
public get maxConcurrentThreads(): number | undefined | null { return super.Section.get<number | null>("maxConcurrentThreads"); }
public get maxMemory(): number | undefined | null { return super.Section.get<number | null>("maxMemory"); }
public get maxSymbolSearchResults(): number | undefined { return super.Section.get<number>("maxSymbolSearchResults"); }
public get maxCachedProcesses(): number | undefined | null { return super.Section.get<number | null>("maxCachedProcesses"); }
public get intelliSenseMaxCachedProcesses(): number | undefined | null { return super.Section.get<number | null>("intelliSense.maxCachedProcesses"); }
public get intelliSenseMaxMemory(): number | undefined | null { return super.Section.get<number | null>("intelliSense.maxMemory"); }
@@ -103,8 +103,7 @@ export class SettingsTracker {
return val;
}
const curEnum: any[] = curSetting["enum"];
if (curEnum && curEnum.indexOf(val) === -1
&& (key !== "loggingLevel" || util.getNumericLoggingLevel(val) === -1)) {
if (curEnum && curEnum.indexOf(val) === -1) {
return "<invalid>";
}
return val;
+29 -9
View File
@@ -46,6 +46,9 @@ const commandArguments: string[] = []; // We report the sender of the command
export class LanguageStatusUI {
private currentClient: Client | undefined;
// Timer for icons from appearing too often and for too short of a time.
private readonly iconDelayTime: number = 1000;
// IntelliSense language status
private intelliSenseStatusItem: vscode.LanguageStatusItem;
private readonly updatingIntelliSenseText: string = localize("updating.intellisense.text", "IntelliSense: Updating");
@@ -55,6 +58,7 @@ export class LanguageStatusUI {
private isParsingWorkspace: boolean = false;
private isParsingWorkspacePaused: boolean = false;
private isParsingFiles: boolean = false;
private tagParseTimeout?: NodeJS.Timeout;
private readonly dataBaseIcon: string = "$(database)";
private readonly workspaceParsingInitializing: string = localize("initializing.tagparser.text", "Initializing Workspace");
private readonly workspaceParsingIndexing: string = localize("indexing.tagparser.text", "Indexing Workspace");
@@ -111,15 +115,25 @@ export class LanguageStatusUI {
return item;
}
private flameTimeout?: NodeJS.Timeout;
private setIsUpdatingIntelliSense(val: boolean): void {
this.intelliSenseStatusItem.busy = val;
if (this.flameTimeout) {
clearTimeout(this.flameTimeout);
}
if (val) {
this.intelliSenseStatusItem.text = "$(flame)";
this.intelliSenseStatusItem.detail = this.updatingIntelliSenseText;
this.flameTimeout = undefined;
} else {
this.intelliSenseStatusItem.text = this.idleIntelliSenseText;
this.intelliSenseStatusItem.detail = "";
this.flameTimeout = setTimeout(() => {
if (this.intelliSenseStatusItem) {
this.intelliSenseStatusItem.text = this.idleIntelliSenseText;
this.intelliSenseStatusItem.detail = "";
}
}, this.iconDelayTime);
}
this.intelliSenseStatusItem.command = {
command: "C_Cpp.RestartIntelliSenseForFile",
@@ -206,6 +220,10 @@ export class LanguageStatusUI {
private setTagParseStatus(): void {
// Set busy icon outside of timer for more real-time response
this.tagParseStatusItem.busy = (this.isParsingWorkspace && !this.isParsingWorkspacePaused) || this.isParsingFiles;
if (this.tagParseStatusItem.busy && this.tagParseTimeout) {
clearTimeout(this.tagParseTimeout);
this.tagParseTimeout = undefined;
}
if (this.isParsingWorkspace || this.isParsingFiles) {
this.tagParseStatusItem.text = this.dataBaseIcon;
@@ -233,13 +251,15 @@ export class LanguageStatusUI {
}
} else {
// Parsing completed.
this.tagParseStatusItem.text = this.workspaceParsingDoneText;
this.tagParseStatusItem.detail = "";
this.tagParseStatusItem.command = {
command: "C_Cpp.RescanWorkspace",
title: this.workspaceRescanText,
arguments: commandArguments
};
this.tagParseTimeout = setTimeout(() => {
this.tagParseStatusItem.text = this.workspaceParsingDoneText;
this.tagParseStatusItem.detail = "";
this.tagParseStatusItem.command = {
command: "C_Cpp.RescanWorkspace",
title: this.workspaceRescanText,
arguments: commandArguments
};
}, this.iconDelayTime);
}
}
//#endregion Tag parse language status
+5 -5
View File
@@ -9,7 +9,7 @@ import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { CppSettings } from '../LanguageServer/settings';
import { ManualPromise } from '../Utility/Async/manualPromise';
import { ISshHostInfo, ProcessReturnType, getNumericLoggingLevel, splitLines, stripEscapeSequences } from '../common';
import { ISshHostInfo, ProcessReturnType, splitLines, stripEscapeSequences } from '../common';
import { isWindows } from '../constants';
import { getSshChannel } from '../logger';
import {
@@ -254,7 +254,7 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
const disposables: vscode.Disposable[] = [];
const { systemInteractor, command, interactors, nickname, token } = args;
let logIsPaused: boolean = false;
const loggingLevel: number = getNumericLoggingLevel(new CppSettings().loggingLevel);
const loggingLevel: string | undefined = new CppSettings().loggingLevel;
const result = new ManualPromise<ProcessReturnType>();
let stdout: string = '';
@@ -344,7 +344,7 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
};
const handleTerminalOutput = async (dataWrite: vscode.TerminalDataWriteEvent): Promise<void> => {
if (loggingLevel > 0) {
if (loggingLevel !== 'None') {
handleOutputLogging(dataWrite.data);
}
@@ -396,7 +396,7 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
const logOutput: string = interaction.isPassword
? interaction.response.replace(/./g, '*')
: interaction.response;
if (loggingLevel >= 5) {
if (loggingLevel === 'Debug' || loggingLevel === 'Information') {
getSshChannel().appendLine(localize('ssh.wrote.data.to.terminal', '"{0}" wrote data to terminal: "{1}".', nickname, logOutput));
}
}
@@ -460,7 +460,7 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
const sendText: string = terminalIsWindows ? `(${args.sendText})\nexit /b %ErrorLevel%` : `${args.sendText}\nexit $?`;
terminal.sendText(sendText);
if (loggingLevel >= 5) {
if (loggingLevel === 'Debug' || loggingLevel === 'Information') {
getSshChannel().appendLine(localize('ssh.wrote.data.to.terminal', '"{0}" wrote data to terminal: "{1}".', nickname, args.sendText));
}
}
+4 -11
View File
@@ -10,10 +10,9 @@ import * as path from 'path';
import {
Configuration, ConfigurationDirective,
ConfigurationEntry,
Type as ConfigurationEntryType,
HostConfigurationDirective,
HostConfigurationDirective, parse,
ResolvedConfiguration,
parse
Type as ConfigurationEntryType
} from 'ssh-config';
import { promisify } from 'util';
import * as vscode from 'vscode';
@@ -58,14 +57,8 @@ function extractHostNames(parsedConfig: Configuration): { [host: string]: string
const hostNames: { [host: string]: string } = Object.create(null);
extractHosts(parsedConfig).forEach(host => {
let resolvedConfig: ResolvedConfiguration | undefined;
try {
resolvedConfig = parsedConfig.compute(host);
} catch (e) {
getSshChannel().appendLine(localize("failed.to.find.user.info.for.SSH",
"Failed to find user info for SSH. This could be caused by VS Code being installed using 'snap'. Please reinstall VS Code using the 'deb' package if you are planning to use SSH features."));
}
if (resolvedConfig?.HostName !== undefined) {
const resolvedConfig: ResolvedConfiguration = parsedConfig.compute(host);
if (resolvedConfig.HostName) {
hostNames[host] = resolvedConfig.HostName;
} else {
hostNames[host] = host;
+17 -185
View File
@@ -355,6 +355,17 @@ export function defaultExePath(): string {
return isWindows ? exePath + '.exe' : exePath;
}
export function findExePathInArgs(args: string[]): string | undefined {
const exePath: string | undefined = args.find((arg: string, index: number) => arg.includes(".exe") || (index > 0 && args[index - 1] === "-o"));
if (exePath?.startsWith("/Fe")) {
return exePath.substring(3);
}
if (exePath?.toLowerCase().startsWith("/out:")) {
return exePath.substring(5);
}
return exePath;
}
// Pass in 'arrayResults' if a string[] result is possible and a delimited string result is undesirable.
// The string[] result will be copied into 'arrayResults'.
export function resolveVariables(input: string | undefined, additionalEnvironment?: Record<string, string | string[]>, arrayResults?: string[]): string {
@@ -371,7 +382,7 @@ export function resolveVariables(input: string | undefined, additionalEnvironmen
}
// Replace environment and configuration variables.
const regexp: () => RegExp = () => /\$\{((env|config|workspaceFolder)(\.|:))?(.*?)\}/g;
const regexp: () => RegExp = () => /\$\{((env|config|workspaceFolder|file|fileDirname|fileBasenameNoExtension|execPath|pathSeparator)(\.|:))?(.*?)\}/g;
let ret: string = input;
const cycleCache = new Set<string>();
while (!cycleCache.has(ret)) {
@@ -745,7 +756,8 @@ export async function spawnChildProcess(program: string, args: string[] = [], co
// Do not use CppSettings to avoid circular require()
if (skipLogging === undefined || !skipLogging) {
const settings: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", null);
if (getNumericLoggingLevel(settings.get<string>("loggingLevel")) >= 5) {
const loggingLevel: string | undefined = settings.get<string>("loggingLevel");
if (loggingLevel === "Information" || loggingLevel === "Debug") {
getOutputChannelLogger().appendLine(`$ ${program} ${args.join(' ')}`);
}
}
@@ -776,7 +788,7 @@ async function spawnChildProcessImpl(program: string, args: string[], continueOn
// Do not use CppSettings to avoid circular require()
const settings: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", null);
const loggingLevel: number = (skipLogging === undefined || !skipLogging) ? getNumericLoggingLevel(settings.get<string>("loggingLevel")) : 0;
const loggingLevel: string | undefined = (skipLogging === undefined || !skipLogging) ? settings.get<string>("loggingLevel") : "None";
let proc: child_process.ChildProcess;
if (await isExecutable(program)) {
@@ -802,7 +814,7 @@ async function spawnChildProcessImpl(program: string, args: string[], continueOn
if (proc.stdout) {
proc.stdout.on('data', data => {
const str: string = data.toString();
if (loggingLevel > 0) {
if (loggingLevel !== "None") {
getOutputChannelLogger().append(str);
}
stdout += str;
@@ -1578,10 +1590,8 @@ export function getNumericLoggingLevel(loggingLevel: string | undefined): number
return 5;
case "debug":
return 6;
case "none":
return 0;
default:
return -1;
return 0;
}
}
@@ -1622,181 +1632,3 @@ export function mergeOverlappingRanges(ranges: Range[]): Range[] {
mergedRanges.length = lastMergedIndex;
return mergedRanges;
}
// Arg quoting utility functions, copied from VS Code with minor changes.
export interface IShellQuotingOptions {
/**
* The character used to do character escaping.
*/
escape?: string | {
escapeChar: string;
charsToEscape: string;
};
/**
* The character used for string quoting.
*/
strong?: string;
/**
* The character used for weak quoting.
*/
weak?: string;
}
export interface IQuotedString {
value: string;
quoting: 'escape' | 'strong' | 'weak';
}
export type CommandString = string | IQuotedString;
export function buildShellCommandLine(originalCommand: CommandString, command: CommandString, args: CommandString[]): string {
let shellQuoteOptions: IShellQuotingOptions;
const isWindows: boolean = os.platform() === 'win32';
if (isWindows) {
shellQuoteOptions = {
strong: '"'
};
} else {
shellQuoteOptions = {
escape: {
escapeChar: '\\',
charsToEscape: ' "\''
},
strong: '\'',
weak: '"'
};
}
// TODO: Support launching with PowerShell
// For PowerShell:
// {
// escape: {
// escapeChar: '`',
// charsToEscape: ' "\'()'
// },
// strong: '\'',
// weak: '"'
// },
function needsQuotes(value: string): boolean {
if (value.length >= 2) {
const first = value[0] === shellQuoteOptions.strong ? shellQuoteOptions.strong : value[0] === shellQuoteOptions.weak ? shellQuoteOptions.weak : undefined;
if (first === value[value.length - 1]) {
return false;
}
}
let quote: string | undefined;
for (let i = 0; i < value.length; i++) {
// We found the end quote.
const ch = value[i];
if (ch === quote) {
quote = undefined;
} else if (quote !== undefined) {
// skip the character. We are quoted.
continue;
} else if (ch === shellQuoteOptions.escape) {
// Skip the next character
i++;
} else if (ch === shellQuoteOptions.strong || ch === shellQuoteOptions.weak) {
quote = ch;
} else if (ch === ' ') {
return true;
}
}
return false;
}
function quote(value: string, kind: 'escape' | 'strong' | 'weak'): [string, boolean] {
if (kind === "strong" && shellQuoteOptions.strong) {
return [shellQuoteOptions.strong + value + shellQuoteOptions.strong, true];
} else if (kind === "weak" && shellQuoteOptions.weak) {
return [shellQuoteOptions.weak + value + shellQuoteOptions.weak, true];
} else if (kind === "escape" && shellQuoteOptions.escape) {
if (isString(shellQuoteOptions.escape)) {
return [value.replace(/ /g, shellQuoteOptions.escape + ' '), true];
} else {
const buffer: string[] = [];
for (const ch of shellQuoteOptions.escape.charsToEscape) {
buffer.push(`\\${ch}`);
}
const regexp: RegExp = new RegExp('[' + buffer.join(',') + ']', 'g');
const escapeChar = shellQuoteOptions.escape.escapeChar;
return [value.replace(regexp, (match) => escapeChar + match), true];
}
}
return [value, false];
}
function quoteIfNecessary(value: CommandString): [string, boolean] {
if (isString(value)) {
if (needsQuotes(value)) {
return quote(value, "strong");
} else {
return [value, false];
}
} else {
return quote(value.value, value.quoting);
}
}
// If we have no args and the command is a string then use the command to stay backwards compatible with the old command line
// model. To allow variable resolving with spaces we do continue if the resolved value is different than the original one
// and the resolved one needs quoting.
if ((!args || args.length === 0) && isString(command) && (command === originalCommand as string || needsQuotes(originalCommand as string))) {
return command;
}
const result: string[] = [];
let commandQuoted = false;
let argQuoted = false;
let value: string;
let quoted: boolean;
[value, quoted] = quoteIfNecessary(command);
result.push(value);
commandQuoted = quoted;
for (const arg of args) {
[value, quoted] = quoteIfNecessary(arg);
result.push(value);
argQuoted = argQuoted || quoted;
}
let commandLine = result.join(' ');
// There are special rules quoted command line in cmd.exe
if (isWindows)
{
commandLine = `chcp 65001>nul && ${commandLine}`;
if (commandQuoted && argQuoted) {
commandLine = '"' + commandLine + '"';
}
commandLine = `cmd /c ${commandLine}`;
}
return commandLine;
}
export function findExePathInArgs(args: CommandString[]): string | undefined {
const isWindows: boolean = os.platform() === 'win32';
let previousArg: string | undefined;
for (const arg of args) {
const argValue = isString(arg) ? arg : arg.value;
if (previousArg === '-o') {
return argValue;
}
if (isWindows && argValue.includes('.exe')) {
if (argValue.startsWith('/Fe')) {
return argValue.substring(3);
} else if (argValue.toLowerCase().startsWith('/out:')) {
return argValue.substring(5);
}
}
previousArg = argValue;
}
return undefined;
}
+1 -2
View File
@@ -10,7 +10,6 @@ import * as nls from 'vscode-nls';
import { CustomConfigurationProvider1, CustomConfigurationProviderCollection, getCustomConfigProviders } from './LanguageServer/customProviders';
import * as LanguageServer from './LanguageServer/extension';
import { CppSettings } from './LanguageServer/settings';
import { getNumericLoggingLevel } from './common';
import { getOutputChannel } from './logger';
import * as test from './testHook';
@@ -62,7 +61,7 @@ export class CppTools implements CppToolsTestApi {
const added: CustomConfigurationProvider1 | undefined = providers.get(provider);
if (added) {
const settings: CppSettings = new CppSettings();
if (getNumericLoggingLevel(settings.loggingLevel) >= 5) {
if (settings.loggingLevel === "Information" || settings.loggingLevel === "Debug") {
getOutputChannel().appendLine(localize("provider.registered", "Custom configuration provider '{0}' registered", added.name));
}
this.providers.push(added);
+1 -13
View File
@@ -7,7 +7,6 @@
import * as os from 'os';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { getNumericLoggingLevel } from './common';
import { CppSourceStr } from './LanguageServer/extension';
import { getLocalizedString, LocalizeStringParams } from './LanguageServer/localization';
@@ -74,7 +73,6 @@ export class Logger {
export let outputChannel: vscode.OutputChannel | undefined;
export let diagnosticsChannel: vscode.OutputChannel | undefined;
export let crashCallStacksChannel: vscode.OutputChannel | undefined;
export let debugChannel: vscode.OutputChannel | undefined;
export let warningChannel: vscode.OutputChannel | undefined;
export let sshChannel: vscode.OutputChannel | undefined;
@@ -85,7 +83,7 @@ export function getOutputChannel(): vscode.OutputChannel {
// Do not use CppSettings to avoid circular require()
const settings: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", null);
const loggingLevel: string | undefined = settings.get<string>("loggingLevel");
if (getNumericLoggingLevel(loggingLevel) > 1) {
if (!!loggingLevel && loggingLevel !== "None" && loggingLevel !== "Error") {
outputChannel.appendLine(`loggingLevel: ${loggingLevel}`);
}
}
@@ -99,16 +97,6 @@ export function getDiagnosticsChannel(): vscode.OutputChannel {
return diagnosticsChannel;
}
export function getCrashCallStacksChannel(): vscode.OutputChannel {
if (!crashCallStacksChannel) {
crashCallStacksChannel = vscode.window.createOutputChannel(localize("c.cpp.crash.call.stacks.title", "C/C++ Crash Call Stacks"));
crashCallStacksChannel.appendLine(localize({ key: "c.cpp.crash.call.stacks.description", comment: ["{0} is a URL."] },
"A C/C++ extension process has crashed. The crashing process name, date/time, signal, and call stack are below -- it would be helpful to include that in a bug report at {0}.",
"https://github.com/Microsoft/vscode-cpptools/issues"));
}
return crashCallStacksChannel;
}
export function getSshChannel(): vscode.OutputChannel {
if (!sshChannel) {
sshChannel = vscode.window.createOutputChannel(localize("c.cpp.ssh.channel", "{0}: SSH", "Cpptools"));
-2
View File
@@ -188,8 +188,6 @@ async function makeBinariesExecutable(): Promise<void> {
];
oldMacBinaries.forEach(binary => promises.push(util.allowExecution(util.getExtensionFilePath(binary))));
}
} else if (os.arch() === "x64") {
promises.push(util.allowExecution(util.getExtensionFilePath("./bin/libc.so")));
}
}
await Promise.all(promises);
+5645 -5656
View File
File diff suppressed because it is too large Load Diff