Skip to content

Commit

Permalink
Merge pull request #10501 from microsoft/main
Browse files Browse the repository at this point in the history
Merge for 1.14.2
  • Loading branch information
sean-mcmanus authored Feb 9, 2023
2 parents b745ebc + e4696c5 commit 4083075
Show file tree
Hide file tree
Showing 10 changed files with 523 additions and 350 deletions.
12 changes: 12 additions & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# C/C++ for Visual Studio Code Changelog

## Version 1.14.2: February 9, 2023
### Enhancements
* Add error messages for Create Declaration / Definition. [#10163](https://github.com/microsoft/vscode-cpptools/issues/10163)
* Follow up changes to the new status UI. [#10413](https://github.com/microsoft/vscode-cpptools/issues/10413)
* Add Ada to supported languages for debugging. [#10475](https://github.com/microsoft/vscode-cpptools/issues/10475)
* Anthony Leonardo Gracio (@AnthonyLeonardoGracio) [PR #10476](https://github.com/microsoft/vscode-cpptools/pull/10476)

### Bug Fixes
* Show a reload prompt after `C_Cpp.hover` is changed. [#10076](https://github.com/microsoft/vscode-cpptools/issues/10076)
* Fix a crash with empty PATH entries on Linux/Mac.

## Version 1.14.1: February 2, 2023
### New Features
* Add recursive macro expansion on hover. [#3579](https://github.com/microsoft/vscode-cpptools/issues/3579)
Expand Down Expand Up @@ -40,6 +51,7 @@
* Fix an incorrect IntelliSense error with `std::bind`, c++17, and windows-msvc-arm64 mode. [#10304](https://github.com/microsoft/vscode-cpptools/issues/10304)
* Fix vcFormat when using lambda functions. [#10326](https://github.com/microsoft/vscode-cpptools/issues/10326)
* Fix IntelliSense crash in field_for_lambda_capture. [#10359](https://github.com/microsoft/vscode-cpptools/issues/10359)
* Fix an IntelliSense crash when using the French language pack. [#10374](https://github.com/microsoft/vscode-cpptools/issues/10374)

## Version 1.13.9: January 4, 2023
### Bug Fix
Expand Down
15 changes: 10 additions & 5 deletions 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.14.1-main",
"version": "1.14.2-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
Expand Down Expand Up @@ -3146,6 +3146,7 @@
"type": "cppdbg",
"label": "C++ (GDB/LLDB)",
"languages": [
"ada",
"c",
"cpp",
"cuda-cpp",
Expand Down Expand Up @@ -3515,7 +3516,7 @@
},
{
"type": "boolean",
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
"description": "%c_cpp.debuggers.logging.natvisDiagnostics.description%",
"default": false
}
]
Expand Down Expand Up @@ -4303,7 +4304,7 @@
},
{
"type": "boolean",
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
"description": "%c_cpp.debuggers.logging.natvisDiagnostics.description%",
"default": false
}
]
Expand Down Expand Up @@ -4893,6 +4894,7 @@
"label": "C++ (Windows)",
"when": "workspacePlatform == windows",
"languages": [
"ada",
"c",
"cpp",
"cuda-cpp",
Expand Down Expand Up @@ -5289,6 +5291,9 @@
}
],
"breakpoints": [
{
"language": "ada"
},
{
"language": "c"
},
Expand Down Expand Up @@ -5962,8 +5967,8 @@
"vscode-debugprotocol": "^1.35.0",
"vscode-dts": "^0.3.2",
"vscode-nls-dev": "^4.0.0-next.1",
"webpack": "^5.28.0",
"webpack-cli": "^4.5.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"xml2js": "^0.4.19"
},
"dependencies": {
Expand Down
169 changes: 105 additions & 64 deletions Extension/src/LanguageServer/client.ts

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,15 @@ export class CppProperties {
(isUnset(settings.defaultCompileCommands) || settings.defaultCompileCommands === "") && !configuration.compileCommands) {
// compile_commands.json already specifies a compiler. compilerPath overrides the compile_commands.json compiler so
// don't set a default when compileCommands is in use.
configuration.compilerPath = this.defaultCompilerPath;

// if the compiler is a cl.exe compiler, replace the full path with the "cl.exe" string.
const compiler: string = path.basename(this.defaultCompilerPath).toLowerCase();

if (compiler === "cl.exe") {
configuration.compilerPath = "cl.exe";
} else {
configuration.compilerPath = this.defaultCompilerPath;
}
}
if ((isUnset(settings.defaultCStandard) || settings.defaultCStandard === "") && this.defaultCStandard) {
configuration.cStandard = this.defaultCStandard;
Expand Down
4 changes: 3 additions & 1 deletion Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,10 @@ export function registerCommands(enabled: boolean): void {
}

async function logForUIExperiment(command: string): Promise<void> {
const settings: CppSettings = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined);
const isNewUI: string = ui.isNewUI.toString();
telemetry.logLanguageServerEvent(`experiment${command}`, { newUI: isNewUI });
const isOverridden: string = (settings.experimentalFeatures ?? false).toString();
telemetry.logLanguageServerEvent(`experiment${command}`, { newUI: isNewUI, uiOverride: isOverridden });
}

function onDisabledCommand(): void {
Expand Down
8 changes: 0 additions & 8 deletions Extension/src/LanguageServer/settingsTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type FilterFunction = (key: string, val: string, settings: vscode.WorkspaceConfi
type KeyValuePair = { key: string; value: string };

const maxSettingLengthForTelemetry: number = 50;
let cache: SettingsTracker;

export class SettingsTracker {
private previousCppSettings: { [key: string]: any } = {};
Expand Down Expand Up @@ -207,10 +206,3 @@ export class SettingsTracker {
return value1 === value2;
}
}

export function getTracker(resource: vscode.Uri | undefined): SettingsTracker {
if (!cache) {
cache = new SettingsTracker(resource);
}
return cache;
}
59 changes: 43 additions & 16 deletions Extension/src/LanguageServer/ui_new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export class NewUI implements UI {
private codeAnalysisTotal: number = 0;
private readonly workspaceParsingRunningText: string = localize("running.tagparser.text", "Parsing Workspace");
private readonly workspaceParsingPausedText: string = localize("paused.tagparser.text", "Parsing Workspace: Paused");
private readonly workspaceParseingDoneText: string = localize("complete.tagparser.text", "Parsing Complete");
private readonly workspaceParsingDoneText: string = localize("complete.tagparser.text", "Parsing Complete");
private readonly workspaceParsingInitializing: string = localize("initializing.tagparser.text", "Initializing Workspace");
private readonly workspaceParsingIndexing: string = localize("indexing.tagparser.text", "Indexing Workspace");
private workspaceParsingStatus: string = "";
private workspaceParsingProgress: string = "";
private readonly workspaceRescanText = localize("rescan.tagparse.text", "Rescan Workspace");
Expand Down Expand Up @@ -109,7 +111,7 @@ export class NewUI implements UI {

this.browseEngineStatusBarItem = vscode.languages.createLanguageStatusItem(`cpptools.status.${LanguageStatusPriority.Mid}.tagparser`, documentSelector);
this.browseEngineStatusBarItem.name = localize("cpptools.status.tagparser", "C/C++ Tag Parser Status");
this.browseEngineStatusBarItem.detail = localize("indexing.files.tooltip", "Indexing Workspace");
this.browseEngineStatusBarItem.detail = localize("cpptools.detail.tagparser", "Initializing...");
this.browseEngineStatusBarItem.text = "$(database)";
this.browseEngineStatusBarItem.command = {
command: "C_Cpp.RescanWorkspaceUI_Telemetry",
Expand Down Expand Up @@ -143,27 +145,38 @@ export class NewUI implements UI {
}
}

private setIsInitializingWorkspace(val: boolean): void {
if (val) {
this.browseEngineStatusBarItem.text = "$(database)";
this.browseEngineStatusBarItem.detail = this.workspaceParsingInitializing;
}
}
private setIsIndexingWorkspace(val: boolean): void {
if (val) {
this.browseEngineStatusBarItem.text = "$(database)";
this.browseEngineStatusBarItem.detail = this.workspaceParsingIndexing;
this.browseEngineStatusBarItem.busy = true;
}
}

private dbTimeout?: NodeJS.Timeout;
private setIsParsingWorkspace(val: boolean): void {
this.isParsingWorkspace = val;
const showIcon: boolean = val || this.isParsingFiles;
const twoStatus: boolean = val && this.isParsingFiles;

// Leave this outside for more realtime respone
this.browseEngineStatusBarItem.busy = showIcon;

if (showIcon) {
this.browseEngineStatusBarItem.text = "$(database)";
this.browseEngineStatusBarItem.detail = (this.isParsingFiles ? this.parsingFilesTooltip : "")
+ (twoStatus ? " | " : "")
+ (val ? this.workspaceParsingStatus : "");
this.browseEngineStatusBarItem.detail = this.tagParseText();

if (this.dbTimeout) {
clearTimeout(this.dbTimeout);
}
} else {
this.dbTimeout = setTimeout(() => {
this.browseEngineStatusBarItem.text = this.workspaceParseingDoneText;
this.browseEngineStatusBarItem.text = this.workspaceParsingDoneText;
this.browseEngineStatusBarItem.detail = "";
this.browseEngineStatusBarItem.command = {
command: "C_Cpp.RescanWorkspaceUI_Telemetry",
Expand All @@ -173,6 +186,17 @@ export class NewUI implements UI {
}
}

private tagParseText(): string {
if (this.isParsingWorkspacePaused) {
const twoStatus: boolean = this.isParsingFiles && this.isParsingWorkspace;
return (this.isParsingFiles ? this.parsingFilesTooltip : "")
+ (twoStatus ? " | " : "")
+ (this.isParsingWorkspace ? this.workspaceParsingStatus : "");
} else {
return this.isParsingWorkspace ? this.workspaceParsingStatus : this.parsingFilesTooltip;
}
}

private setIsParsingWorkspacePausable(val: boolean): void {
if (val && this.isParsingWorkspace) {
this.browseEngineStatusBarItem.command = {
Expand All @@ -183,11 +207,15 @@ export class NewUI implements UI {
}

private setIsParsingWorkspacePaused(val: boolean): void {
if (!this.isParsingFiles && !this.isParsingWorkspace) {
// Ignore a pause change if no parsing is actually happening.
return;
}
this.isParsingWorkspacePaused = val;
this.browseEngineStatusBarItem.busy = !val || this.isParsingFiles;
this.browseEngineStatusBarItem.text = "$(database)";
this.workspaceParsingStatus = val ? this.workspaceParsingPausedText : this.workspaceParsingRunningText;
this.browseEngineStatusBarItem.detail = (this.isParsingFiles ? `${this.parsingFilesTooltip} | ` : "") + this.workspaceParsingStatus;
this.browseEngineStatusBarItem.detail = this.tagParseText();
this.browseEngineStatusBarItem.command = val ? {
command: "C_Cpp.ResumeParsingUI_Telemetry",
title: localize("tagparser.resume.text", "Resume")
Expand All @@ -210,24 +238,21 @@ export class NewUI implements UI {
private setIsParsingFiles(val: boolean): void {

this.isParsingFiles = val;
const showIcon: boolean = val || (!this.isParsingWorkspacePaused && this.isParsingWorkspace);
const twoStatus: boolean = val && this.isParsingWorkspace;
const showIcon: boolean = val || this.isParsingWorkspace;

// Leave this outside for more realtime respone
this.browseEngineStatusBarItem.busy = showIcon;
this.browseEngineStatusBarItem.busy = val || (!this.isParsingWorkspacePaused && this.isParsingWorkspace);

if (showIcon) {
this.browseEngineStatusBarItem.text = "$(database)";
this.browseEngineStatusBarItem.detail = (val ? this.parsingFilesTooltip : "")
+ (twoStatus ? " | " : "")
+ (this.isParsingWorkspace ? this.workspaceParsingStatus : "");
this.browseEngineStatusBarItem.detail = this.tagParseText();

if (this.dbTimeout) {
clearTimeout(this.dbTimeout);
}
} else if (!this.isParsingWorkspace && !val) {
} else {
this.dbTimeout = setTimeout(() => {
this.browseEngineStatusBarItem.text = this.workspaceParseingDoneText;
this.browseEngineStatusBarItem.text = this.workspaceParsingDoneText;
this.browseEngineStatusBarItem.detail = "";
this.browseEngineStatusBarItem.command = {
command: "C_Cpp.RescanWorkspaceUI_Telemetry",
Expand Down Expand Up @@ -376,6 +401,8 @@ export class NewUI implements UI {
}

public bind(client: Client): void {
client.InitializingWorkspaceChanged(value => { this.setIsInitializingWorkspace(value); });
client.IndexingWorkspaceChanged(value => { this.setIsIndexingWorkspace(value); });
client.ParsingWorkspaceChanged(value => { this.setIsParsingWorkspace(value); });
client.ParsingWorkspacePausableChanged(value => { this.setIsParsingWorkspacePausable(value); });
client.ParsingWorkspacePausedChanged(value => { this.setIsParsingWorkspacePaused(value); });
Expand Down
73 changes: 71 additions & 2 deletions Extension/src/nativeStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
"file_tag": "File",
"compiler_default_language_standard_version_old" : "Compiler returned default language standard version: {0}. Since this version is old, will try to use newer version {1} as default.",
"unexpected_output_from_clang_tidy": "Unexpected output from clang-tidy: {0}. Expected: {1}.",
"generate_doxygen_comment": "Generate Doxygen Comment",
"generate_doxygen_comment": "Generate Doxygen comment",
"offer_create_declaration": {
"text": "Create declaration of '{0}' in {1}",
"hint": "{0} is the name of a C/C++ function, {1} is a file name."
Expand Down Expand Up @@ -368,5 +368,74 @@
},
"cm_addfunction": {
"text": "Automatic add function"
}
},
"e_com_virtual_redundant": {
"text": "vsCMFunctionVirtual is redundant and must not be specified when with vsCMFunctionComMethod.",
"hint": "Do not localize 'vsCMFunctionVirtual' and 'vsCMFunctionComMethod', they are code implementation."
},
"e_static_com_method": {
"text": "vsCMFunctionComMethod cannot be static.",
"hint": "Do not localize 'vsCMFunctionComMethod', it is code implementation."
},
"e_invalid_ftype": {
"text": "Invalid C/C++ file: '%s'.",
"hint": "%s is the invalid file."
},
"e_fname_to_long": {
"text": "File name too long: '%s'.",
"hint": "%s is the file that has a long name."
},
"e_create_file": {
"text": "Cannot create file '%s'.",
"hint": "%s is the file that could not be created."
},
"e_access_file": {
"text": "Cannot access directory or file '%s' for writing.",
"hint": "%s is the directory or file that could not be accessed for writing."
},
"e_invalid_pathname": {
"text": "Invalid file path: '%s'.",
"hint": "%s is the file that has an invalid path."
},
"e_cm_file_not_in_project": {
"text": "File '%s' was not found.",
"hint": "%s is the file that was not found."
},
"refactor_create_declaration_definition_failed":
{
"text": "Create Declaration / Definition failed: %s",
"hint": "The operation 'Create Declaration / Definition' on a function was not successful. %s is the error info that has a period at the end of the string."
},
"refactor_create_default_delete":
{
"text": "Unable to create function '%s'. Creating defaulted or deleted functions is not supported.",
"hint": "%s is the function that could not be created."
},
"refactor_function_copied_to_clipboard": "The function signature was copied to the clipboard.",
"refactor_function_not_created":
{
"text": "Unable to create function '%s'.",
"hint": "%s is the function that could not be created."
},
"refactor_ambiguous_locations":
{
"text": "Unable to find an unambiguous location for function '%s'.",
"hint": "%s is the function for the unambiguous location."
},
"refactor_file_not_in_project":
{
"text": "File '%s' was not found.",
"hint": "%s is the file that was not found."
},
"refactor_not_class_namespace":
{
"text": "Could not find class or namespace '%s'.",
"hint": "%s is the class or namespace code that could not be found."
},
"refactor_operation_unsupported":
{
"text": "The operation is not supported for '%s'.",
"hint": "%s is the function that is not supported for an operation that involves automatically generating code."
},
"unknown_error": "Unknown error."
}
2 changes: 1 addition & 1 deletion Extension/tools/OptionsSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
},
{
"type": "boolean",
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
"description": "%c_cpp.debuggers.logging.natvisDiagnostics.description%",
"default": false
}
]
Expand Down
Loading

0 comments on commit 4083075

Please sign in to comment.