diff --git a/.github/actions/StaleCloser/StaleCloser.js b/.github/actions/StaleCloser/StaleCloser.js
index 15f4c177aa..dd775d082a 100644
--- a/.github/actions/StaleCloser/StaleCloser.js
+++ b/.github/actions/StaleCloser/StaleCloser.js
@@ -79,7 +79,7 @@ class StaleCloser extends ActionBase_1.ActionBase {
console.log(`Closing issue ${hydrated.number}.`);
}
else {
- // Ping
+ // Ping
if (hydrated.updatedAt < pingTimestamp && hydrated.assignee) {
console.log(`Last comment on issue ${hydrated.number} by ${lastComment.author.name}. Pinging @${hydrated.assignee}`);
if (this.pingComment) {
diff --git a/.github/actions/StaleCloser/StaleCloser.ts b/.github/actions/StaleCloser/StaleCloser.ts
index 1e411f3f96..d516c06e8c 100644
--- a/.github/actions/StaleCloser/StaleCloser.ts
+++ b/.github/actions/StaleCloser/StaleCloser.ts
@@ -97,7 +97,7 @@ export class StaleCloser extends ActionBase {
}
console.log(`Closing issue ${hydrated.number}.`)
} else {
- // Ping
+ // Ping
if (hydrated.updatedAt < pingTimestamp && hydrated.assignee) {
console.log(
`Last comment on issue ${hydrated.number} by ${lastComment.author.name}. Pinging @${hydrated.assignee}`,
diff --git a/Build/lldb-mi/lldb-mi.yml b/Build/lldb-mi/lldb-mi.yml
index 80cde6ca2f..85aa0182d8 100644
--- a/Build/lldb-mi/lldb-mi.yml
+++ b/Build/lldb-mi/lldb-mi.yml
@@ -17,13 +17,13 @@ jobs:
steps:
- task: CmdLine@2
displayName: 'Install Dependencies'
- inputs:
+ inputs:
script: brew install cmake ninja swig
continueOnError: true
- task: CmdLine@2
displayName: 'Build LLVM Project'
- inputs:
+ inputs:
script: |
log_and_exec_cmd() {
echo "##[command] $1"
@@ -32,7 +32,7 @@ jobs:
log_and_exec_cmd "cd $(Build.StagingDirectory)"
log_and_exec_cmd "mkdir $(Build.StagingDirectory)/buildspace"
-
+
log_and_exec_cmd "git clone $(llvm_repo) llvm-project"
log_and_exec_cmd "cd llvm-project"
log_and_exec_cmd "git checkout $(llvm_branch)"
diff --git a/Code Samples/BoxConsoleSample/README.md b/Code Samples/BoxConsoleSample/README.md
index 178feeeb88..c1a1fabc90 100644
--- a/Code Samples/BoxConsoleSample/README.md
+++ b/Code Samples/BoxConsoleSample/README.md
@@ -21,4 +21,4 @@ This option will generate a tasks.json file for you, build your active source fi
### F5
Another way to begin building and debugging your active file is to execute the command by pressing F5. This method will configure
-both a tasks.json and launch.json file for you, build your active source file, and then launch the debugger.
+both a tasks.json and launch.json file for you, build your active source file, and then launch the debugger.
diff --git a/Code Samples/Fib/README.md b/Code Samples/Fib/README.md
index 7e53f5914d..6402c911bf 100644
--- a/Code Samples/Fib/README.md
+++ b/Code Samples/Fib/README.md
@@ -1,3 +1,3 @@
# Fib
-This code sample is to show debugging. Update `launch.json` and `tasks.json` in the `.vscode` folder to use your setup to build and debug.
\ No newline at end of file
+This code sample is to show debugging. Update `launch.json` and `tasks.json` in the `.vscode` folder to use your setup to build and debug.
\ No newline at end of file
diff --git a/Code Samples/Fib/thread.cpp b/Code Samples/Fib/thread.cpp
index f24717b633..bef34e9c78 100644
--- a/Code Samples/Fib/thread.cpp
+++ b/Code Samples/Fib/thread.cpp
@@ -15,14 +15,14 @@ static int fib(int n){
switch (n) {
case 0: return 1;
case 1: return 1;
- default: return (fib(n-2) + fib(n-1));
- }
+ default: return (fib(n-2) + fib(n-1));
+ }
}
void * thread_proc(void* ctx)
{
int tid = g_tid++;
-
+
char thread_name[16];
sprintf(thread_name, "Thread %d", tid);
#ifdef __APPLE__
@@ -30,19 +30,19 @@ void * thread_proc(void* ctx)
#else
pthread_setname_np(pthread_self(), thread_name);
#endif
-
+
// Random delay, 0 - 0.5 sec
timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 500000000 + ((float)rand() / (float)RAND_MAX) * 500000000;
nanosleep(&ts, NULL);
-
+
volatile int i = 0;
while (i <= 30) {
std::cout << "Thread " << tid << ": fib(" << i << ") = " << fib(i) << std::endl;
i++;
nanosleep(&ts, NULL);
}
-
+
std::cout << thread_name << " exited!" << std::endl;
}
\ No newline at end of file
diff --git a/Documentation/Debugger/natvis/natvis.xsd b/Documentation/Debugger/natvis/natvis.xsd
index c7428e522c..56c2dd4de5 100644
--- a/Documentation/Debugger/natvis/natvis.xsd
+++ b/Documentation/Debugger/natvis/natvis.xsd
@@ -240,7 +240,7 @@
-
+
@@ -335,9 +335,9 @@
are evaluated in the context of the node.
-
+
-
+
Expression that points to value of the linked list node. It can be left empty or have 'this' to refer to the linked list node itself. This expression is evaluated under the context of the linked list node and not the parent linked list type.
@@ -402,7 +402,7 @@
Indicates that the item should use the icon associated with general data.
-
+
@@ -864,16 +864,16 @@
- Specifies an expression which evaluates to the current object, casted to its most-derived type.
-
- In most cases, the debugger is able to automatically determine an object's most-derived type, in which case use of the <MostDerivedType>
+ Specifies an expression which evaluates to the current object, casted to its most-derived type.
+
+ In most cases, the debugger is able to automatically determine an object's most-derived type, in which case use of the <MostDerivedType>
element is unecessary. Automatic determination of an object's most-derived type requires the object to be an instance of a C++ class, with a
compiler-generated virtual function table. This is sufficient for most class-hierarchies; however, custom logic may occasionally be necessary
- when dealing with a class hierarchy that does not contain virtual functions, or when the virtual function table is manually constructed by the
+ when dealing with a class hierarchy that does not contain virtual functions, or when the virtual function table is manually constructed by the
application code.
-
+
@@ -935,12 +935,12 @@
Indicates that the given type is a smart pointer. The text inside this element specifies the expression to evaluate the underlying pointer.
-
+
The <SmartPointer> element has the following effects:
- If no alternative <DisplayString> element is provided (or all <DisplayString> elements have failed conditions), the underlying pointer will be the display string
- If no alternative <StringView> element is provided (or all <StringView> elements have failed conditions), the underlying pointer will be the string view, if it has one.
- If no alternative <Expand> element is provided, the expansion of the smart pointer will be the expansion of the underlying pointer.
- - The smart pointer class will also support overloaded operators as determined by the <Usage> attribute. You can opt out of this behavior by specifying
+ - The smart pointer class will also support overloaded operators as determined by the <Usage> attribute. You can opt out of this behavior by specifying
'DefaultExpansion="false"'
@@ -949,7 +949,7 @@
- Indicates which combinations of operators this smart pointer object supports.
+ Indicates which combinations of operators this smart pointer object supports.
@@ -1004,10 +1004,10 @@
Specifies an optional priority to assign to this entry for type matching. Higher priority entries within a particular file or directory
are checked first. <Type> entries that do not specify a priority receive default priority of "Medium" <AlternativeType> entries which do not specify a priority
will inherit the priority of the enclosing <Type> element. The priority is only used to disambiguate type matching when all other means of disambiguation are unavailable.
- For example, entries with more specific template instantiations, module constraints, or view constraints will take priority regardless of any priority values specified.
- Similarly, regardless of priority, natvis files that are part of a loaded project will always take precedence over files in the user natvis directory,
- which will, in turn, take precedence over files in the system-wide natvis directory.
-
+ For example, entries with more specific template instantiations, module constraints, or view constraints will take priority regardless of any priority values specified.
+ Similarly, regardless of priority, natvis files that are part of a loaded project will always take precedence over files in the user natvis directory,
+ which will, in turn, take precedence over files in the system-wide natvis directory.
+
If two entries have the same priority and cannot otherwise be disambiguated, it is unspecified which one will get used.
diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md
index 4d2c43a4d1..d86c779dec 100644
--- a/Extension/CHANGELOG.md
+++ b/Extension/CHANGELOG.md
@@ -1,5 +1,10 @@
# C/C++ for Visual Studio Code Change Log
+## Version 1.7.1: October 19, 2021
+### Bug Fixes
+* Fix an extension crash that occurred on activation while a workspace is open with no folders in it. [#8280](https://github.com/microsoft/vscode-cpptools/issues/8280)
+* Fix an issue in which configuration defaults were not properly applied. [#8298](https://github.com/microsoft/vscode-cpptools/pull/8298)
+
## Version 1.7.0: October 13, 2021
### New Features
* Add a command to restart IntelliSense for a specific file. [#3727](https://github.com/microsoft/vscode-cpptools/issues/3727)
diff --git a/Extension/README.md b/Extension/README.md
index 1e4635573c..68daffca83 100644
--- a/Extension/README.md
+++ b/Extension/README.md
@@ -17,7 +17,7 @@ C/C++ extension tutorials per compiler and platform
* [Clang on macOS](https://code.visualstudio.com/docs/cpp/config-clang-mac)
## Quick links
-* [Editing features (IntelliSense)](https://code.visualstudio.com/docs/cpp/cpp-ide)
+* [Editing features (IntelliSense)](https://code.visualstudio.com/docs/cpp/cpp-ide)
* [IntelliSense configuration](https://code.visualstudio.com/docs/cpp/customize-default-settings-cpp)
* [Enhanced colorization](https://code.visualstudio.com/docs/cpp/colorization-cpp)
* [Debugging](https://code.visualstudio.com/docs/cpp/cpp-debug)
diff --git a/Extension/package.json b/Extension/package.json
index 9fa5429349..f36616393b 100644
--- a/Extension/package.json
+++ b/Extension/package.json
@@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
- "version": "1.7.0-main",
+ "version": "1.7.1-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts
index 01df035fbf..2188f88a38 100644
--- a/Extension/src/LanguageServer/configurations.ts
+++ b/Extension/src/LanguageServer/configurations.ts
@@ -264,7 +264,7 @@ export class CppProperties {
// not for each notifying folder.
const savedDocWorkspaceFolder: vscode.WorkspaceFolder | undefined = vscode.workspace.getWorkspaceFolder(doc.uri);
const notifyingWorkspaceFolder: vscode.WorkspaceFolder | undefined = vscode.workspace.getWorkspaceFolder(vscode.Uri.file(settingsPath));
- if ((!savedDocWorkspaceFolder && vscode.workspace.workspaceFolders && notifyingWorkspaceFolder === vscode.workspace.workspaceFolders[0])
+ if ((!savedDocWorkspaceFolder && vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0 && notifyingWorkspaceFolder === vscode.workspace.workspaceFolders[0])
|| savedDocWorkspaceFolder === notifyingWorkspaceFolder) {
let fileType: string | undefined;
const documentPath: string = doc.uri.fsPath.toLowerCase();
diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts
index 38a2cee4de..5a71e73c1c 100644
--- a/Extension/src/LanguageServer/extension.ts
+++ b/Extension/src/LanguageServer/extension.ts
@@ -284,7 +284,7 @@ function sendActivationTelemetry(): void {
}
function realActivation(): void {
- if (new CppSettings(vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri : undefined).intelliSenseEngine === "Disabled") {
+ if (new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined).intelliSenseEngine === "Disabled") {
throw new Error(intelliSenseDisabledError);
} else {
console.log("activating extension");
diff --git a/Extension/src/LanguageServer/settings.ts b/Extension/src/LanguageServer/settings.ts
index edff3a4866..f0bfd04523 100644
--- a/Extension/src/LanguageServer/settings.ts
+++ b/Extension/src/LanguageServer/settings.ts
@@ -61,6 +61,18 @@ class Settings {
}
return result;
}
+
+ protected getWithUndefinedDefault(section: string): T | undefined {
+ const info: any = this.settings.inspect(section);
+ if (info.workspaceFolderValue !== undefined) {
+ return info.workspaceFolderValue;
+ } else if (info.workspaceValue !== undefined) {
+ return info.workspaceValue;
+ } else if (info.globalValue !== undefined) {
+ return info.globalValue;
+ }
+ return undefined;
+ }
}
export class CppSettings extends Settings {
@@ -148,23 +160,23 @@ export class CppSettings extends Settings {
public get addNodeAddonIncludePaths(): boolean | undefined { return super.Section.get("addNodeAddonIncludePaths"); }
public get renameRequiresIdentifier(): boolean | undefined { return super.Section.get("renameRequiresIdentifier"); }
public get filesExclude(): vscode.WorkspaceConfiguration | undefined { return super.Section.get("files.exclude"); }
- public get defaultIncludePath(): string[] | undefined { return super.Section.get("default.includePath"); }
- public get defaultDefines(): string[] | undefined { return super.Section.get("default.defines"); }
- public get defaultMacFrameworkPath(): string[] | undefined { return super.Section.get("default.macFrameworkPath"); }
+ public get defaultIncludePath(): string[] | undefined { return super.getWithUndefinedDefault("default.includePath"); }
+ public get defaultDefines(): string[] | undefined { return super.getWithUndefinedDefault("default.defines"); }
+ public get defaultMacFrameworkPath(): string[] | undefined { return super.getWithUndefinedDefault("default.macFrameworkPath"); }
public get defaultWindowsSdkVersion(): string | undefined { return super.Section.get("default.windowsSdkVersion"); }
public get defaultCompileCommands(): string | undefined { return super.Section.get("default.compileCommands"); }
- public get defaultForcedInclude(): string[] | undefined { return super.Section.get("default.forcedInclude"); }
+ public get defaultForcedInclude(): string[] | undefined { return super.getWithUndefinedDefault("default.forcedInclude"); }
public get defaultIntelliSenseMode(): string | undefined { return super.Section.get("default.intelliSenseMode"); }
public get defaultCompilerPath(): string | undefined { return super.Section.get("default.compilerPath") ?? undefined; }
- public get defaultCompilerArgs(): string[] | undefined { return super.Section.get("default.compilerArgs"); }
+ public get defaultCompilerArgs(): string[] | undefined { return super.getWithUndefinedDefault("default.compilerArgs"); }
public get defaultCStandard(): string | undefined { return super.Section.get("default.cStandard"); }
public get defaultCppStandard(): string | undefined { return super.Section.get("default.cppStandard"); }
public get defaultConfigurationProvider(): string | undefined { return super.Section.get("default.configurationProvider"); }
public get defaultMergeConfigurations(): boolean | undefined { return super.Section.get("default.mergeConfigurations"); }
- public get defaultBrowsePath(): string[] | undefined { return super.Section.get("default.browse.path") ?? undefined; }
+ public get defaultBrowsePath(): string[] | undefined { return super.getWithUndefinedDefault("default.browse.path") ?? undefined; }
public get defaultDatabaseFilename(): string | undefined { return super.Section.get("default.browse.databaseFilename"); }
public get defaultLimitSymbolsToIncludedHeaders(): boolean | undefined { return super.Section.get("default.browse.limitSymbolsToIncludedHeaders"); }
- public get defaultSystemIncludePath(): string[] | undefined { return super.Section.get("default.systemIncludePath"); }
+ public get defaultSystemIncludePath(): string[] | undefined { return super.getWithUndefinedDefault("default.systemIncludePath"); }
public get defaultEnableConfigurationSquiggles(): boolean | undefined { return super.Section.get("default.enableConfigurationSquiggles"); }
public get defaultCustomConfigurationVariables(): { [key: string]: string } | undefined { return super.Section.get<{ [key: string]: string }>("default.customConfigurationVariables"); }
public get useBacktickCommandSubstitution(): boolean | undefined { return super.Section.get("debugger.useBacktickCommandSubstitution"); }
diff --git a/Extension/src/common.ts b/Extension/src/common.ts
index dc89c0ddda..fc544e9c03 100644
--- a/Extension/src/common.ts
+++ b/Extension/src/common.ts
@@ -1272,7 +1272,7 @@ function getUniqueWorkspaceNameHelper(workspaceFolder: vscode.WorkspaceFolder, a
return workspaceFolderName; // No duplicate names to search for.
}
for (let i: number = 0; i < workspaceFolder.index; ++i) {
- if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[i].name === workspaceFolderName) {
+ if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0 && vscode.workspace.workspaceFolders[i].name === workspaceFolderName) {
return addSubfolder ? path.join(workspaceFolderName, String(workspaceFolder.index)) : // Use the index as a subfolder.
workspaceFolderName + String(workspaceFolder.index);
}
diff --git a/Extension/src/main.ts b/Extension/src/main.ts
index 779d076940..73e77e34a6 100644
--- a/Extension/src/main.ts
+++ b/Extension/src/main.ts
@@ -393,7 +393,7 @@ async function postInstall(info: PlatformInformation): Promise {
}
async function finalizeExtensionActivation(): Promise {
- const settings: CppSettings = new CppSettings(vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri : undefined);
+ const settings: CppSettings = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined);
if (settings.intelliSenseEngine === "Disabled") {
languageServiceDisabled = true;
getTemporaryCommandRegistrarInstance().disableLanguageServer();
diff --git a/Extension/test/unitTests/common.test.ts b/Extension/test/unitTests/common.test.ts
index 9e757af9df..7a2722265b 100644
--- a/Extension/test/unitTests/common.test.ts
+++ b/Extension/test/unitTests/common.test.ts
@@ -235,8 +235,8 @@ suite("Common Utility validation", () => {
"-DTEST6=TEST6\\ TEST6 Test6", // "-DTEST6=TEST6 TEST6 Test6"
]
*/
- testNormalizeArgsScenario("-DTEST1=TEST1 TEST1", "\"-DTEST1=TEST1 TEST1\"");
- testNormalizeArgsScenario("-DTEST2=\"TEST2 TEST2\"", "-DTEST2=\"TEST2 TEST2\"");
+ testNormalizeArgsScenario("-DTEST1=TEST1 TEST1", "\"-DTEST1=TEST1 TEST1\"");
+ testNormalizeArgsScenario("-DTEST2=\"TEST2 TEST2\"", "-DTEST2=\"TEST2 TEST2\"");
testNormalizeArgsScenario("-DTEST3=\\\"TEST3 TEST3\\\"", "\"-DTEST3=\\\"TEST3 TEST3\\\"\"");
if (process.platform.includes("win")) {
testNormalizeArgsScenario("-DTEST4=TEST4\\ TEST4", "\"-DTEST4=TEST4 TEST4\"");
@@ -245,7 +245,7 @@ suite("Common Utility validation", () => {
testNormalizeArgsScenario("-DTEST4=TEST4\\ TEST4", "-DTEST4=TEST4\\ TEST4");
testNormalizeArgsScenario("-DTEST5='TEST5 TEST5'", "-DTEST5='TEST5 TEST5'");
}
- testNormalizeArgsScenario("-DTEST6=TEST6\\ TEST6 Test6", "\"-DTEST6=TEST6 TEST6 Test6\"");
+ testNormalizeArgsScenario("-DTEST6=TEST6\\ TEST6 Test6", "\"-DTEST6=TEST6 TEST6 Test6\"");
});
interface ResolveTestFlowEnvironment {
diff --git a/Extension/tools/OptionsSchema.json b/Extension/tools/OptionsSchema.json
index 28db2f62ac..68bf9ddfc5 100644
--- a/Extension/tools/OptionsSchema.json
+++ b/Extension/tools/OptionsSchema.json
@@ -279,9 +279,9 @@
},
"default": []
},
- "envFile": {
- "type": "string",
- "description": "%c_cpp.debuggers.envFile.description%",
+ "envFile": {
+ "type": "string",
+ "description": "%c_cpp.debuggers.envFile.description%",
"default": "${workspaceFolder}/.env"
},
"additionalSOLibSearchPath": {
@@ -551,9 +551,9 @@
},
"default": []
},
- "envFile": {
- "type": "string",
- "description": "%c_cpp.debuggers.envFile.description%",
+ "envFile": {
+ "type": "string",
+ "description": "%c_cpp.debuggers.envFile.description%",
"default": "${workspaceFolder}/.env"
},
"symbolSearchPath": {
diff --git a/Extension/tools/VSSymbolSettings.json b/Extension/tools/VSSymbolSettings.json
index cda444d4d1..03fabc5c08 100644
--- a/Extension/tools/VSSymbolSettings.json
+++ b/Extension/tools/VSSymbolSettings.json
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
-
+
"definitions": {
"VSSymbolOptions": {
"type": "object",
diff --git a/Extension/translations_auto_pr.js b/Extension/translations_auto_pr.js
index 54a4dbbd69..e4121a67ed 100644
--- a/Extension/translations_auto_pr.js
+++ b/Extension/translations_auto_pr.js
@@ -64,7 +64,7 @@ function hasAnyChanges() {
anyChanges = true;
}
});
-
+
return anyChanges;
}
diff --git a/Extension/tscCompileList.txt b/Extension/tscCompileList.txt
index 0e73da3a93..612bf6f27d 100644
--- a/Extension/tscCompileList.txt
+++ b/Extension/tscCompileList.txt
@@ -6,7 +6,7 @@
# If you do not want it to be webpacked:
# 1. Please make sure it is not in the src directory
# 2. Add it to the list below
-# 3. If you created a new folder, please make sure it is added to the .vscodeignore
+# 3. If you created a new folder, please make sure it is added to the .vscodeignore
tools/GenerateOptionsSchema.ts
ui/settings.ts
\ No newline at end of file
diff --git a/Extension/ui/settings.html b/Extension/ui/settings.html
index b151ab004e..0ccce51cda 100644
--- a/Extension/ui/settings.html
+++ b/Extension/ui/settings.html
@@ -421,7 +421,7 @@
- Switch to the c_cpp_properties.json file by clicking on the file link or using the command:
+ Switch to the c_cpp_properties.json file by clicking on the file link or using the command: C/C++: Edit configurations (JSON)
@@ -466,7 +466,7 @@
-
+
@@ -611,7 +611,7 @@
-
+
@@ -671,7 +671,7 @@
Merge configurations
- When `true` (or checked), merge include paths, defines, and forced includes with those from a configuration provider.
+ When true (or checked), merge include paths, defines, and forced includes with those from a configuration provider.
@@ -692,7 +692,7 @@
Browse: limit symbols to included headers
- When true (or checked), the Tag Parser will only parse code files that have been directly or indirectly included by a source file in ${workspaceFolder}. When false (or not checked), the Tag Parser will parse all code files found in the paths specified in the Browse: path list.
+ When true (or checked), the Tag Parser will only parse code files that have been directly or indirectly included by a source file in ${workspaceFolder}. When false (or not checked), the Tag Parser will parse all code files found in the paths specified in the Browse: path list.