Skip to content

Commit a005307

Browse files
authored
Merge pull request #12034 from microsoft/main
2 parents 1868f99 + dcb4b85 commit a005307

10 files changed

+6064
-5705
lines changed

Extension/CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# C/C++ for Visual Studio Code Changelog
22

3+
## Version 1.19.5: February 29, 2024
4+
### Enhancements
5+
* 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)
6+
* Enable C23 IntelliSense support, and add support for `clatest` `std` value for MSVC. [#12020](https://github.com/microsoft/vscode-cpptools/issues/12020)
7+
8+
### Bug Fixes
9+
* 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)
10+
* Fix an issue with changes to `C_Cpp.inlayHints` settings not taking effect immediately. [#12013](https://github.com/microsoft/vscode-cpptools/issues/12013)
11+
* Fix an issue with how Doxygen `brief` and `param` are displayed on hover. [#12015](https://github.com/microsoft/vscode-cpptools/issues/12015)
12+
* Fix an issue preventing the extension from functioning if installed via snap on Linux. [#12021](https://github.com/microsoft/vscode-cpptools/issues/12021)
13+
* Fix a potential cpptools process hang on shutdown.
14+
315
## Version 1.19.4: February 21, 2024
416
### Enhancements
517
* Enable support for fuzzy symbol searches. [#2751](https://github.com/microsoft/vscode-cpptools/issues/2751)

Extension/package.json

+70-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cpptools",
33
"displayName": "C/C++",
44
"description": "C/C++ IntelliSense, debugging, and code browsing.",
5-
"version": "1.19.4-main",
5+
"version": "1.19.5-main",
66
"publisher": "ms-vscode",
77
"icon": "LanguageCCPP_color_128x.png",
88
"readme": "README.md",
@@ -313,12 +313,78 @@
313313
"description": "%c_cpp.taskDefinitions.name.description%"
314314
},
315315
"command": {
316-
"type": "string",
317-
"description": "%c_cpp.taskDefinitions.command.description%"
316+
"oneOf": [
317+
{
318+
"type": "string"
319+
},
320+
{
321+
"type": "object",
322+
"required": [
323+
"value",
324+
"quoting"
325+
],
326+
"properties": {
327+
"value": {
328+
"type": "string",
329+
"description": "%c_cpp.taskDefinitions.args.value.description%"
330+
},
331+
"quoting": {
332+
"type": "string",
333+
"enum": [
334+
"escape",
335+
"strong",
336+
"weak"
337+
],
338+
"enumDescriptions": [
339+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
340+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
341+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
342+
],
343+
"default": "strong",
344+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
345+
}
346+
}
347+
}
348+
]
318349
},
319350
"args": {
320351
"type": "array",
321-
"description": "%c_cpp.taskDefinitions.args.description%"
352+
"description": "%c_cpp.taskDefinitions.args.description%",
353+
"items": {
354+
"oneOf": [
355+
{
356+
"type": "string"
357+
},
358+
{
359+
"type": "object",
360+
"required": [
361+
"value",
362+
"quoting"
363+
],
364+
"properties": {
365+
"value": {
366+
"type": "string",
367+
"description": "%c_cpp.taskDefinitions.args.value.description%"
368+
},
369+
"quoting": {
370+
"type": "string",
371+
"enum": [
372+
"escape",
373+
"strong",
374+
"weak"
375+
],
376+
"enumDescriptions": [
377+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
378+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
379+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
380+
],
381+
"default": "strong",
382+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
383+
}
384+
}
385+
}
386+
]
387+
}
322388
},
323389
"options": {
324390
"type": "object",

Extension/package.nls.json

+5
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,11 @@
928928
"c_cpp.taskDefinitions.name.description": "The name of the task.",
929929
"c_cpp.taskDefinitions.command.description": "The path to either a compiler or script that performs compilation.",
930930
"c_cpp.taskDefinitions.args.description": "Additional arguments to pass to the compiler or compilation script.",
931+
"c_cpp.taskDefinitions.args.value.description": "The actual argument value.",
932+
"c_cpp.taskDefinitions.args.quoting.description": "How the argument value should be quoted.",
933+
"c_cpp.taskDefinitions.args.quoting.escape.description": "Escapes characters using the shell's escape character (e.g. \\ under bash).",
934+
"c_cpp.taskDefinitions.args.quoting.strong.description": "Quotes the argument using the shell's strong quote character (e.g. ' under bash).",
935+
"c_cpp.taskDefinitions.args.quoting.weak.description": "Quotes the argument using the shell's weak quote character (e.g. \" under bash).",
931936
"c_cpp.taskDefinitions.options.description": "Additional command options.",
932937
"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.",
933938
"c_cpp.taskDefinitions.detail.description": "Additional details of the task.",

Extension/src/Debugger/configurationProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
413413
if (buildTasks.length !== 0) {
414414
configs = (await Promise.all(buildTasks.map<Promise<CppDebugConfiguration | undefined>>(async task => {
415415
const definition: CppBuildTaskDefinition = task.definition as CppBuildTaskDefinition;
416-
const compilerPath: string = definition.command;
416+
const compilerPath: string = util.isString(definition.command) ? definition.command : definition.command.value;
417417
// Filter out the tasks that has an invalid compiler path.
418418
const compilerPathExists: boolean = path.isAbsolute(compilerPath) ?
419419
// Absolute path, just check if it exists

Extension/src/LanguageServer/Providers/inlayHintProvider.ts

+63-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ interface FileData
1010
{
1111
version: number;
1212
promise: ManualPromise<vscode.InlayHint[]>;
13+
typeHints: CppInlayHint[];
14+
parameterHints: CppInlayHint[];
1315
inlayHints: vscode.InlayHint[];
16+
17+
inlayHintsAutoDeclarationTypes?: boolean;
18+
inlayHintsAutoDeclarationTypesShowOnLeft?: boolean;
19+
inlayHintsParameterNames?: boolean;
20+
inlayHintsParameterNamesHideLeadingUnderscores?: boolean;
21+
inlayHintsParameterNamesSuppressName?: boolean;
22+
inlayHintsReferenceOperator?: boolean;
23+
inlayHintsReferenceOperatorShowSpace?: boolean;
1424
}
1525

1626
export interface CppInlayHint {
@@ -35,7 +45,7 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
3545
public onDidChangeInlayHints?: vscode.Event<void> = this.onDidChangeInlayHintsEvent.event;
3646
private allFileData: Map<string, FileData> = new Map<string, FileData>();
3747

38-
public async provideInlayHints(document: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[]> {
48+
public async provideInlayHints(document: vscode.TextDocument, _range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[]> {
3949
const uri: vscode.Uri = document.uri;
4050
const uriString: string = uri.toString();
4151
let fileData: FileData | undefined = this.allFileData.get(uriString);
@@ -44,6 +54,36 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
4454
// Make sure file hasn't been changed since the last set of results.
4555
// If a complete promise is present, there should also be a cache.
4656
if (fileData.version === document.version) {
57+
const settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
58+
// Check if any of the settings changed.
59+
if (fileData.inlayHintsAutoDeclarationTypes === settings.inlayHintsAutoDeclarationTypes &&
60+
fileData.inlayHintsAutoDeclarationTypesShowOnLeft === settings.inlayHintsAutoDeclarationTypesShowOnLeft &&
61+
fileData.inlayHintsParameterNames === settings.inlayHintsParameterNames &&
62+
fileData.inlayHintsParameterNamesHideLeadingUnderscores === settings.inlayHintsParameterNamesHideLeadingUnderscores &&
63+
fileData.inlayHintsParameterNamesSuppressName === settings.inlayHintsParameterNamesSuppressName &&
64+
fileData.inlayHintsReferenceOperator === settings.inlayHintsReferenceOperator &&
65+
fileData.inlayHintsReferenceOperatorShowSpace === settings.inlayHintsReferenceOperatorShowSpace) {
66+
return fileData.promise;
67+
}
68+
fileData.inlayHints = [];
69+
fileData.inlayHintsAutoDeclarationTypes = settings.inlayHintsAutoDeclarationTypes;
70+
fileData.inlayHintsAutoDeclarationTypesShowOnLeft = settings.inlayHintsAutoDeclarationTypesShowOnLeft;
71+
fileData.inlayHintsParameterNames = settings.inlayHintsParameterNames;
72+
fileData.inlayHintsParameterNamesHideLeadingUnderscores = settings.inlayHintsParameterNamesHideLeadingUnderscores;
73+
fileData.inlayHintsParameterNamesSuppressName = settings.inlayHintsParameterNamesSuppressName;
74+
fileData.inlayHintsReferenceOperator = settings.inlayHintsReferenceOperator;
75+
fileData.inlayHintsReferenceOperatorShowSpace = settings.inlayHintsReferenceOperatorShowSpace;
76+
if (settings.inlayHintsAutoDeclarationTypes) {
77+
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, fileData.typeHints);
78+
Array.prototype.push.apply(fileData.inlayHints, resolvedTypeHints);
79+
}
80+
if (settings.inlayHintsParameterNames || settings.inlayHintsReferenceOperator) {
81+
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, fileData.parameterHints);
82+
Array.prototype.push.apply(fileData.inlayHints, resolvedParameterHints);
83+
}
84+
fileData.promise = new ManualPromise<vscode.InlayHint[]>();
85+
fileData.promise.resolve(fileData.inlayHints);
86+
this.onDidChangeInlayHintsEvent.fire();
4787
return fileData.promise;
4888
}
4989
} else {
@@ -56,6 +96,8 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
5696
fileData = {
5797
version: document.version,
5898
promise: new ManualPromise<vscode.InlayHint[]>(),
99+
typeHints: [],
100+
parameterHints: [],
59101
inlayHints: []
60102
};
61103
this.allFileData.set(uriString, fileData);
@@ -93,6 +135,8 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
93135
fileData = {
94136
version: editor.document.version,
95137
promise: new ManualPromise<vscode.InlayHint[]>(),
138+
typeHints: [],
139+
parameterHints: [],
96140
inlayHints: []
97141
};
98142
newPromiseCreated = true;
@@ -105,25 +149,38 @@ export class InlayHintsProvider implements vscode.InlayHintsProvider {
105149
}
106150
if (fileData.version !== editor.document.version) {
107151
fileData.version = editor.document.version;
152+
fileData.typeHints = [];
153+
fileData.parameterHints = [];
108154
fileData.inlayHints = [];
109155
}
110156
}
111157
return [fileData, newPromiseCreated];
112158
})();
159+
const settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
113160
if (startNewSet) {
114161
fileData.inlayHints = [];
162+
fileData.typeHints = [];
163+
fileData.parameterHints = [];
164+
fileData.inlayHintsAutoDeclarationTypes = settings.inlayHintsAutoDeclarationTypes;
165+
fileData.inlayHintsAutoDeclarationTypesShowOnLeft = settings.inlayHintsAutoDeclarationTypesShowOnLeft;
166+
fileData.inlayHintsParameterNames = settings.inlayHintsParameterNames;
167+
fileData.inlayHintsParameterNamesHideLeadingUnderscores = settings.inlayHintsParameterNamesHideLeadingUnderscores;
168+
fileData.inlayHintsParameterNamesSuppressName = settings.inlayHintsParameterNamesSuppressName;
169+
fileData.inlayHintsReferenceOperator = settings.inlayHintsReferenceOperator;
170+
fileData.inlayHintsReferenceOperatorShowSpace = settings.inlayHintsReferenceOperatorShowSpace;
115171
}
116172

117-
const typeHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Type);
118-
const paramHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Parameter);
173+
const newTypeHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Type);
174+
const newParameterHints: CppInlayHint[] = cppInlayHints.filter(h => h.inlayHintKind === InlayHintKind.Parameter);
175+
Array.prototype.push.apply(fileData.typeHints, newTypeHints);
176+
Array.prototype.push.apply(fileData.parameterHints, newParameterHints);
119177

120-
const settings: CppSettings = new CppSettings(vscode.Uri.parse(uriString));
121178
if (settings.inlayHintsAutoDeclarationTypes) {
122-
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, typeHints);
179+
const resolvedTypeHints: vscode.InlayHint[] = this.resolveTypeHints(settings, newTypeHints);
123180
Array.prototype.push.apply(fileData.inlayHints, resolvedTypeHints);
124181
}
125182
if (settings.inlayHintsParameterNames || settings.inlayHintsReferenceOperator) {
126-
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, paramHints);
183+
const resolvedParameterHints: vscode.InlayHint[] = this.resolveParameterHints(settings, newParameterHints);
127184
Array.prototype.push.apply(fileData.inlayHints, resolvedParameterHints);
128185
}
129186

0 commit comments

Comments
 (0)