MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / expandString

Function expandString

Extension/src/expand.ts:46–63  ·  view source on GitHub ↗
(input: string, options: ExpansionOptions)

Source from the content-addressed store, hash-verified

44}
45
46export async function expandString(input: string, options: ExpansionOptions): Promise<string> {
47 const MAX_RECURSION: number = 10;
48 let result: string = input;
49 let didReplacement: boolean = false;
50
51 let i: number = 0;
52 do {
53 // TODO: consider a full circular reference check?
54 [result, didReplacement] = await expandStringImpl(result, options);
55 i++;
56 } while (i < MAX_RECURSION && options.recursive && didReplacement);
57
58 if (i === MAX_RECURSION && didReplacement) {
59 void getOutputChannelLogger().showErrorMessage(localize('max.recursion.reached', 'Reached max string expansion recursion. Possible circular reference.'));
60 }
61
62 return replaceAll(result, '${dollar}', '$');
63}
64
65/** Returns [expandedString, didReplacement] */
66async function expandStringImpl(input: string, options: ExpansionOptions): Promise<[string, boolean]> {

Callers 1

expandAllStringsFunction · 0.85

Calls 4

getOutputChannelLoggerFunction · 0.90
replaceAllFunction · 0.90
expandStringImplFunction · 0.85
showErrorMessageMethod · 0.80

Tested by

no test coverage detected