Skip to content

Commit

Permalink
Merge pull request #8303 from microsoft/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Colengms authored Oct 19, 2021
2 parents a06d8e6 + 6b00343 commit a18b91b
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/actions/StaleCloser/StaleCloser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/actions/StaleCloser/StaleCloser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
6 changes: 3 additions & 3 deletions Build/lldb-mi/lldb-mi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion Code Samples/BoxConsoleSample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kbd>F5</kbd>. 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.
2 changes: 1 addition & 1 deletion Code Samples/Fib/README.md
Original file line number Diff line number Diff line change
@@ -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.
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.
12 changes: 6 additions & 6 deletions Code Samples/Fib/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ 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__
pthread_setname_np(thread_name);
#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;
}
32 changes: 16 additions & 16 deletions Documentation/Debugger/natvis/natvis.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>

<!-- Attributes for elements that support filtering by view-->
<xs:attributeGroup name="ViewConstraints">
<xs:attribute name="IncludeView" type ="ViewIncludeType" use="optional" />
Expand Down Expand Up @@ -335,9 +335,9 @@
are evaluated in the context of the node.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attribute>
</xs:attributeGroup>

<xs:complexType name="ListItemsNodeType">
<xs:annotation>
<xs:documentation>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.</xs:documentation>
Expand Down Expand Up @@ -402,7 +402,7 @@
<xs:documentation>
Indicates that the item should use the icon associated with general data.
</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="Method">
<xs:annotation>
Expand Down Expand Up @@ -864,16 +864,16 @@
<xs:complexType name="MostDerivedObjectType">
<xs:annotation>
<xs:documentation>
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 &lt;MostDerivedType&gt;
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 &lt;MostDerivedType&gt;
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.
</xs:documentation>
</xs:annotation>

<xs:simpleContent>
<xs:extension base="StringType">
<xs:attributeGroup ref="CommonAttributes" />
Expand Down Expand Up @@ -935,12 +935,12 @@
<xs:annotation>
<xs:documentation>
Indicates that the given type is a smart pointer. The text inside this element specifies the expression to evaluate the underlying pointer.

The &lt;SmartPointer&gt; element has the following effects:
- If no alternative &lt;DisplayString&gt; element is provided (or all &lt;DisplayString&gt; elements have failed conditions), the underlying pointer will be the display string
- If no alternative &lt;StringView&gt; element is provided (or all &lt;StringView&gt; elements have failed conditions), the underlying pointer will be the string view, if it has one.
- If no alternative &lt;Expand&gt; 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 &lt;Usage&gt; attribute. You can opt out of this behavior by specifying
- The smart pointer class will also support overloaded operators as determined by the &lt;Usage&gt; attribute. You can opt out of this behavior by specifying
'DefaultExpansion=&quot;false&quot;'
</xs:documentation>
</xs:annotation>
Expand All @@ -949,7 +949,7 @@
<xs:attributeGroup ref="CommonAttributes_NoCondition" />
<xs:attribute name="Usage" type="SmartPointerUsage" use="required">
<xs:annotation>
<xs:documentation>Indicates which combinations of operators this smart pointer object supports.
<xs:documentation>Indicates which combinations of operators this smart pointer object supports.
</xs:documentation>
</xs:annotation>
</xs:attribute>
Expand Down Expand Up @@ -1004,10 +1004,10 @@
<xs:documentation>Specifies an optional priority to assign to this entry for type matching. Higher priority entries within a particular file or directory
are checked first. &lt;Type&gt; entries that do not specify a priority receive default priority of &quot;Medium&quot; &lt;AlternativeType&gt; entries which do not specify a priority
will inherit the priority of the enclosing &lt;Type&gt; 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.
</xs:documentation>
</xs:annotation>
Expand Down
5 changes: 5 additions & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
26 changes: 19 additions & 7 deletions Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ class Settings {
}
return result;
}

protected getWithUndefinedDefault<T>(section: string): T | undefined {
const info: any = this.settings.inspect<T>(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 {
Expand Down Expand Up @@ -148,23 +160,23 @@ export class CppSettings extends Settings {
public get addNodeAddonIncludePaths(): boolean | undefined { return super.Section.get<boolean>("addNodeAddonIncludePaths"); }
public get renameRequiresIdentifier(): boolean | undefined { return super.Section.get<boolean>("renameRequiresIdentifier"); }
public get filesExclude(): vscode.WorkspaceConfiguration | undefined { return super.Section.get<vscode.WorkspaceConfiguration>("files.exclude"); }
public get defaultIncludePath(): string[] | undefined { return super.Section.get<string[]>("default.includePath"); }
public get defaultDefines(): string[] | undefined { return super.Section.get<string[]>("default.defines"); }
public get defaultMacFrameworkPath(): string[] | undefined { return super.Section.get<string[]>("default.macFrameworkPath"); }
public get defaultIncludePath(): string[] | undefined { return super.getWithUndefinedDefault<string[]>("default.includePath"); }
public get defaultDefines(): string[] | undefined { return super.getWithUndefinedDefault<string[]>("default.defines"); }
public get defaultMacFrameworkPath(): string[] | undefined { return super.getWithUndefinedDefault<string[]>("default.macFrameworkPath"); }
public get defaultWindowsSdkVersion(): string | undefined { return super.Section.get<string>("default.windowsSdkVersion"); }
public get defaultCompileCommands(): string | undefined { return super.Section.get<string>("default.compileCommands"); }
public get defaultForcedInclude(): string[] | undefined { return super.Section.get<string[]>("default.forcedInclude"); }
public get defaultForcedInclude(): string[] | undefined { return super.getWithUndefinedDefault<string[]>("default.forcedInclude"); }
public get defaultIntelliSenseMode(): string | undefined { return super.Section.get<string>("default.intelliSenseMode"); }
public get defaultCompilerPath(): string | undefined { return super.Section.get<string | null>("default.compilerPath") ?? undefined; }
public get defaultCompilerArgs(): string[] | undefined { return super.Section.get<string[]>("default.compilerArgs"); }
public get defaultCompilerArgs(): string[] | undefined { return super.getWithUndefinedDefault<string[]>("default.compilerArgs"); }
public get defaultCStandard(): string | undefined { return super.Section.get<string>("default.cStandard"); }
public get defaultCppStandard(): string | undefined { return super.Section.get<string>("default.cppStandard"); }
public get defaultConfigurationProvider(): string | undefined { return super.Section.get<string>("default.configurationProvider"); }
public get defaultMergeConfigurations(): boolean | undefined { return super.Section.get<boolean>("default.mergeConfigurations"); }
public get defaultBrowsePath(): string[] | undefined { return super.Section.get<string[] | null>("default.browse.path") ?? undefined; }
public get defaultBrowsePath(): string[] | undefined { return super.getWithUndefinedDefault<string[] | null>("default.browse.path") ?? undefined; }
public get defaultDatabaseFilename(): string | undefined { return super.Section.get<string>("default.browse.databaseFilename"); }
public get defaultLimitSymbolsToIncludedHeaders(): boolean | undefined { return super.Section.get<boolean>("default.browse.limitSymbolsToIncludedHeaders"); }
public get defaultSystemIncludePath(): string[] | undefined { return super.Section.get<string[]>("default.systemIncludePath"); }
public get defaultSystemIncludePath(): string[] | undefined { return super.getWithUndefinedDefault<string[]>("default.systemIncludePath"); }
public get defaultEnableConfigurationSquiggles(): boolean | undefined { return super.Section.get<boolean>("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<boolean>("debugger.useBacktickCommandSubstitution"); }
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ async function postInstall(info: PlatformInformation): Promise<void> {
}

async function finalizeExtensionActivation(): Promise<void> {
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();
Expand Down
6 changes: 3 additions & 3 deletions Extension/test/unitTests/common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\"");
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit a18b91b

Please sign in to comment.