Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to release for 1.19.5 #12034

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# C/C++ for Visual Studio Code Changelog

## Version 1.19.5: February 29, 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 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 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 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)
Expand Down
74 changes: 70 additions & 4 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.19.4-main",
"version": "1.19.5-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
Expand Down Expand Up @@ -313,12 +313,78 @@
"description": "%c_cpp.taskDefinitions.name.description%"
},
"command": {
"type": "string",
"description": "%c_cpp.taskDefinitions.command.description%"
"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%"
}
}
}
]
},
"args": {
"type": "array",
"description": "%c_cpp.taskDefinitions.args.description%"
"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%"
}
}
}
]
}
},
"options": {
"type": "object",
Expand Down
5 changes: 5 additions & 0 deletions Extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,11 @@
"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.",
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = definition.command;
const compilerPath: string = util.isString(definition.command) ? definition.command : definition.command.value;
// Filter out the tasks that has an invalid compiler path.
const compilerPathExists: boolean = path.isAbsolute(compilerPath) ?
// Absolute path, just check if it exists
Expand Down
69 changes: 63 additions & 6 deletions Extension/src/LanguageServer/Providers/inlayHintProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ 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 {
Expand All @@ -35,7 +45,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);
Expand All @@ -44,6 +54,36 @@ 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 {
Expand All @@ -56,6 +96,8 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
fileData = {
version: document.version,
promise: new ManualPromise<vscode.InlayHint[]>(),
typeHints: [],
parameterHints: [],
inlayHints: []
};
this.allFileData.set(uriString, fileData);
Expand Down Expand Up @@ -93,6 +135,8 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
fileData = {
version: editor.document.version,
promise: new ManualPromise<vscode.InlayHint[]>(),
typeHints: [],
parameterHints: [],
inlayHints: []
};
newPromiseCreated = true;
Expand All @@ -105,25 +149,38 @@ 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 typeHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Type);
const paramHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Parameter);
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 settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
if (settings.inlayHintsAutoDeclarationTypes) {
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, typeHints);
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, newTypeHints);
Array.prototype.push.apply(fileData.inlayHints, resolvedTypeHints);
}
if (settings.inlayHintsParameterNames || settings.inlayHintsReferenceOperator) {
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, paramHints);
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, newParameterHints);
Array.prototype.push.apply(fileData.inlayHints, resolvedParameterHints);
}

Expand Down
Loading
Loading