Skip to content

Commit 7fec8ba

Browse files
authored
Merge pull request #10196 from microsoft/seanmcm/cherrypick_1_13_5
Cherry-picks for 1.13.5
2 parents c549c07 + 24f5fdd commit 7fec8ba

File tree

5 files changed

+207
-13
lines changed

5 files changed

+207
-13
lines changed

Extension/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# C/C++ for Visual Studio Code Changelog
22

3+
## Version 1.13.5: November 28, 2022
4+
### Bug Fixes
5+
* Fix "Step Over past a logpoint stops at the wrong place". [#9995](https://github.com/microsoft/vscode-cpptools/issues/9995)
6+
* Fix "Don't hardcode path to kill in UnixUtilities". [#10124](https://github.com/microsoft/vscode-cpptools/issues/10124)
7+
* Ellie Hermaszewska (@expipiplus1) [PR #1373](https://github.com/microsoft/MIEngine/pull/1373)
8+
* Fix the create declaration/definition feature not adding the definition if a new source file needs to be created. [#10159](https://github.com/microsoft/vscode-cpptools/issues/10159)
9+
* Fix the create declaration/definition feature not having the correct cursor location after adding a definition. [#10160](https://github.com/microsoft/vscode-cpptools/issues/10160)
10+
* Fix the create declaration/definition feature not formatting inserted definitions. [#10161](https://github.com/microsoft/vscode-cpptools/issues/10161)
11+
* This has the side-effect of fixing the extra newlines created in a new file if clang-format is used. [#10164](https://github.com/microsoft/vscode-cpptools/issues/10164)
12+
* However, clang-format 15 has a bug which can cause formatting of newly inserted definitions to fail in some cases: [LLVM#59178](https://github.com/llvm/llvm-project/issues/59178)
13+
* Fix formatting when clang-format 11 or earlier is used (and another issue for version 8 or earlier). [#10178](https://github.com/microsoft/vscode-cpptools/issues/10178)
14+
315
## Version 1.13.4: November 17, 2022
416
### New Features
517
* Add the ability to generate definitions from declarations and vice versa. [#664](https://github.com/microsoft/vscode-cpptools/issues/664)

Extension/package.json

Lines changed: 102 additions & 8 deletions
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.13.4-main",
5+
"version": "1.13.5-main",
66
"publisher": "ms-vscode",
77
"icon": "LanguageCCPP_color_128x.png",
88
"readme": "README.md",
@@ -286,7 +286,7 @@
286286
"name": "iar",
287287
"source": "iar",
288288
"owner": "cpptools",
289-
"fileLocation" : "absolute",
289+
"fileLocation": "absolute",
290290
"pattern": {
291291
"regexp": "^\"(.*?)\",(\\d+)\\s+(?:[Ff]atal\\s+)?([Ww]arning|[Ee]rror)\\[(\\w+\\d+)\\]:\\s+(.*)$",
292292
"file": 1,
@@ -3453,9 +3453,30 @@
34533453
"default": true
34543454
},
34553455
"engineLogging": {
3456-
"type": "boolean",
3457-
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
3458-
"default": false
3456+
"anyOf": [
3457+
{
3458+
"type": "string",
3459+
"enum": [
3460+
"verbose",
3461+
"warning",
3462+
"error",
3463+
"none"
3464+
],
3465+
"enumDescriptions": [
3466+
"%c_cpp.debuggers.logging.category.verbose.description%",
3467+
"%c_cpp.debuggers.logging.category.warning.description%",
3468+
"%c_cpp.debuggers.logging.category.error.description%",
3469+
"%c_cpp.debuggers.logging.category.none.description%"
3470+
],
3471+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
3472+
"default": "none"
3473+
},
3474+
{
3475+
"type": "boolean",
3476+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
3477+
"default": false
3478+
}
3479+
]
34593480
},
34603481
"trace": {
34613482
"type": "boolean",
@@ -3466,6 +3487,32 @@
34663487
"type": "boolean",
34673488
"description": "%c_cpp.debuggers.logging.traceResponse.description%",
34683489
"default": false
3490+
},
3491+
"natvisDiagnostics": {
3492+
"anyOf": [
3493+
{
3494+
"type": "string",
3495+
"enum": [
3496+
"verbose",
3497+
"warning",
3498+
"error",
3499+
"none"
3500+
],
3501+
"enumDescriptions": [
3502+
"%c_cpp.debuggers.logging.category.verbose.description%",
3503+
"%c_cpp.debuggers.logging.category.warning.description%",
3504+
"%c_cpp.debuggers.logging.category.error.description%",
3505+
"%c_cpp.debuggers.logging.category.none.description%"
3506+
],
3507+
"description": "%c_cpp.debuggers.logging.natvisDiagnostics.description%",
3508+
"default": "none"
3509+
},
3510+
{
3511+
"type": "boolean",
3512+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
3513+
"default": false
3514+
}
3515+
]
34693516
}
34703517
}
34713518
},
@@ -4194,9 +4241,30 @@
41944241
"default": true
41954242
},
41964243
"engineLogging": {
4197-
"type": "boolean",
4198-
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
4199-
"default": false
4244+
"anyOf": [
4245+
{
4246+
"type": "string",
4247+
"enum": [
4248+
"verbose",
4249+
"warning",
4250+
"error",
4251+
"none"
4252+
],
4253+
"enumDescriptions": [
4254+
"%c_cpp.debuggers.logging.category.verbose.description%",
4255+
"%c_cpp.debuggers.logging.category.warning.description%",
4256+
"%c_cpp.debuggers.logging.category.error.description%",
4257+
"%c_cpp.debuggers.logging.category.none.description%"
4258+
],
4259+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
4260+
"default": "none"
4261+
},
4262+
{
4263+
"type": "boolean",
4264+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
4265+
"default": false
4266+
}
4267+
]
42004268
},
42014269
"trace": {
42024270
"type": "boolean",
@@ -4207,6 +4275,32 @@
42074275
"type": "boolean",
42084276
"description": "%c_cpp.debuggers.logging.traceResponse.description%",
42094277
"default": false
4278+
},
4279+
"natvisDiagnostics": {
4280+
"anyOf": [
4281+
{
4282+
"type": "string",
4283+
"enum": [
4284+
"verbose",
4285+
"warning",
4286+
"error",
4287+
"none"
4288+
],
4289+
"enumDescriptions": [
4290+
"%c_cpp.debuggers.logging.category.verbose.description%",
4291+
"%c_cpp.debuggers.logging.category.warning.description%",
4292+
"%c_cpp.debuggers.logging.category.error.description%",
4293+
"%c_cpp.debuggers.logging.category.none.description%"
4294+
],
4295+
"description": "%c_cpp.debuggers.logging.natvisDiagnostics.description%",
4296+
"default": "none"
4297+
},
4298+
{
4299+
"type": "boolean",
4300+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
4301+
"default": false
4302+
}
4303+
]
42104304
}
42114305
}
42124306
},

Extension/package.nls.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,5 +394,10 @@
394394
"c_cpp.semanticTokenTypes.numberLiteral.description": "Style for C++ user-defined literal numbers.",
395395
"c_cpp.semanticTokenTypes.stringLiteral.description": "Style for C++ user-defined literal strings.",
396396
"c_cpp.semanticTokenModifiers.global.description": "Style to use for symbols that are global.",
397-
"c_cpp.semanticTokenModifiers.local.description": "Style to use for symbols that are local."
397+
"c_cpp.semanticTokenModifiers.local.description": "Style to use for symbols that are local.",
398+
"c_cpp.debuggers.logging.natvisDiagnostics.description": "Optional flag to determine whether diagnostic natvis messages should be logged to the Debug Console. Defaults to None.",
399+
"c_cpp.debuggers.logging.category.verbose.description": "Logs that are used for interactive investigation during development. These logs should primarily contain information useful for debugging and have no long-term value.",
400+
"c_cpp.debuggers.logging.category.warning.description": "Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.",
401+
"c_cpp.debuggers.logging.category.error.description": "Logs that highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure.",
402+
"c_cpp.debuggers.logging.category.none.description": "Not used for writing log messages. Specifies that a logging category should not write any messages."
398403
}

Extension/src/LanguageServer/client.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3000,11 +3000,15 @@ export class DefaultClient implements Client {
30003000
const workspaceEdit: vscode.WorkspaceEdit = new vscode.WorkspaceEdit();
30013001
let modifiedDocument: vscode.Uri | undefined;
30023002
let lastEdit: vscode.TextEdit | undefined;
3003+
let numNewlinesFromPreviousEdits: number = 0;
30033004
for (const file in result.changes) {
30043005
const uri: vscode.Uri = vscode.Uri.file(file);
30053006
const edits: vscode.TextEdit[] = [];
30063007
for (const edit of result.changes[file]) {
30073008
const range: vscode.Range = makeVscodeRange(edit.range);
3009+
if (lastEdit && lastEdit.range.isEqual(range)) {
3010+
numNewlinesFromPreviousEdits += (lastEdit.newText.match(/\n/g) || []).length;
3011+
}
30083012
lastEdit = new vscode.TextEdit(range, edit.newText);
30093013
edits.push(lastEdit);
30103014
}
@@ -3013,8 +3017,40 @@ export class DefaultClient implements Client {
30133017
};
30143018
if (modifiedDocument && lastEdit) {
30153019
await vscode.workspace.applyEdit(workspaceEdit);
3016-
const selectionRange: vscode.Range = lastEdit.range; // TODO: range should be the new range after text edit was applied.
3020+
let numNewlines: number = (lastEdit.newText.match(/\n/g) || []).length;
3021+
3022+
// Move the cursor to the new code, accounting for \n or \n\n at the start.
3023+
let startLine: number = lastEdit.range.start.line;
3024+
if (lastEdit.newText.startsWith("\r\n\r\n") || lastEdit.newText.startsWith("\n\n")) {
3025+
startLine += 2;
3026+
numNewlines -= 2;
3027+
} else if (lastEdit.newText.startsWith("\r\n") || lastEdit.newText.startsWith("\n")) {
3028+
startLine += 1;
3029+
numNewlines -= 1;
3030+
}
3031+
if (!lastEdit.newText.endsWith("\n")) {
3032+
numNewlines++; // Increase the format range.
3033+
}
3034+
3035+
const selectionPosition: vscode.Position = new vscode.Position(startLine + numNewlinesFromPreviousEdits, 0);
3036+
const selectionRange: vscode.Range = new vscode.Range(selectionPosition, selectionPosition);
30173037
await vscode.window.showTextDocument(modifiedDocument, { selection: selectionRange });
3038+
3039+
// Run formatRange.
3040+
const formatEdits: vscode.WorkspaceEdit = new vscode.WorkspaceEdit();
3041+
const formatRange: vscode.Range = new vscode.Range(selectionRange.start, new vscode.Position(selectionRange.start.line + numNewlines, 0));
3042+
const settings: OtherSettings = new OtherSettings(vscode.workspace.getWorkspaceFolder(modifiedDocument)?.uri);
3043+
const formatOptions: vscode.FormattingOptions = {
3044+
insertSpaces: settings.editorInsertSpaces ?? true,
3045+
tabSize: settings.editorTabSize ?? 4
3046+
};
3047+
const formatTextEdits: vscode.TextEdit[] | undefined = await vscode.commands.executeCommand<vscode.TextEdit[] | undefined>("vscode.executeFormatRangeProvider", modifiedDocument, formatRange, formatOptions);
3048+
if (formatTextEdits && formatTextEdits.length > 0) {
3049+
formatEdits.set(modifiedDocument, formatTextEdits);
3050+
}
3051+
if (formatEdits.size > 0) {
3052+
await vscode.workspace.applyEdit(formatEdits);
3053+
}
30183054
}
30193055
}
30203056
}

Extension/tools/OptionsSchema.json

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,30 @@
7676
"default": true
7777
},
7878
"engineLogging": {
79-
"type": "boolean",
80-
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
81-
"default": false
79+
"anyOf": [
80+
{
81+
"type": "string",
82+
"enum": [
83+
"verbose",
84+
"warning",
85+
"error",
86+
"none"
87+
],
88+
"enumDescriptions": [
89+
"%c_cpp.debuggers.logging.category.verbose.description%",
90+
"%c_cpp.debuggers.logging.category.warning.description%",
91+
"%c_cpp.debuggers.logging.category.error.description%",
92+
"%c_cpp.debuggers.logging.category.none.description%"
93+
],
94+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
95+
"default": "none"
96+
},
97+
{
98+
"type": "boolean",
99+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
100+
"default": false
101+
}
102+
]
82103
},
83104
"trace": {
84105
"type": "boolean",
@@ -89,6 +110,32 @@
89110
"type": "boolean",
90111
"description": "%c_cpp.debuggers.logging.traceResponse.description%",
91112
"default": false
113+
},
114+
"natvisDiagnostics": {
115+
"anyOf": [
116+
{
117+
"type": "string",
118+
"enum": [
119+
"verbose",
120+
"warning",
121+
"error",
122+
"none"
123+
],
124+
"enumDescriptions": [
125+
"%c_cpp.debuggers.logging.category.verbose.description%",
126+
"%c_cpp.debuggers.logging.category.warning.description%",
127+
"%c_cpp.debuggers.logging.category.error.description%",
128+
"%c_cpp.debuggers.logging.category.none.description%"
129+
],
130+
"description": "%c_cpp.debuggers.logging.natvisDiagnostics.description%",
131+
"default": "none"
132+
},
133+
{
134+
"type": "boolean",
135+
"description": "%c_cpp.debuggers.logging.engineLogging.description%",
136+
"default": false
137+
}
138+
]
92139
}
93140
}
94141
},

0 commit comments

Comments
 (0)