Skip to content

Commit 8bff10f

Browse files
authored
Fix resolve variable with non-string. (#9403)
* Fix resolve variable with non-string. * Fix spelling errors.
1 parent baf58c8 commit 8bff10f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ interface CodeActionWorkspaceEdit {
8888

8989
interface CodeActionPerUriInfo {
9090
// These two arrays have the same length, i.e. index i of identifiers
91-
// is usee to index into workspaceEdits to get the corresponding edit.
91+
// is used to index into workspaceEdits to get the corresponding edit.
9292
identifiers: CodeAnalysisDiagnosticIdentifier[];
9393
workspaceEdits?: CodeActionWorkspaceEdit[];
9494

@@ -2246,7 +2246,7 @@ export class DefaultClient implements Client {
22462246
configJson = `Current Configuration:\n${JSON.stringify(this.configuration.CurrentConfiguration, null, 4)}\n`;
22472247
}
22482248

2249-
// Get diagnotics for configuration provider info.
2249+
// Get diagnostics for configuration provider info.
22502250
let configurationLoggingStr: string = "";
22512251
const tuSearchStart: number = response.diagnostics.indexOf("Translation Unit Mappings:");
22522252
if (tuSearchStart >= 0) {

Extension/src/common.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,14 @@ export function resolveVariables(input: string | undefined, additionalEnvironmen
342342
return "";
343343
}
344344

345+
// jsonc parser may assign a non-string object to a string.
346+
// TODO: https://github.com/microsoft/vscode-cpptools/issues/9414
347+
if (!isString(input)) {
348+
const inputAny: any = input;
349+
input = inputAny.toString();
350+
return input ?? "";
351+
}
352+
345353
// Replace environment and configuration variables.
346354
let regexp: () => RegExp = () => /\$\{((env|config|workspaceFolder|file|fileDirname|fileBasenameNoExtension|execPath|pathSeparator)(\.|:))?(.*?)\}/g;
347355
let ret: string = input;

0 commit comments

Comments
 (0)