mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Fix bug for completing function name parameters if function name contained special snippet syntax
This commit is contained in:
@@ -107,4 +107,14 @@ suite('typescript function call snippets', () => {
|
||||
).snippet.value,
|
||||
'methoda(${1:x})$0');
|
||||
});
|
||||
|
||||
test('Should escape snippet syntax in method name', async () => {
|
||||
assert.strictEqual(
|
||||
snippetForFunctionCall(
|
||||
{ label: '$abc', },
|
||||
[]
|
||||
).snippet.value,
|
||||
'\\$abc()$0');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -16,7 +16,8 @@ export function snippetForFunctionCall(
|
||||
}
|
||||
|
||||
const parameterListParts = getParameterListParts(displayParts);
|
||||
const snippet = new vscode.SnippetString(`${item.insertText || item.label}(`);
|
||||
const snippet = new vscode.SnippetString();
|
||||
snippet.appendText(`${item.insertText || item.label}(`);
|
||||
appendJoinedPlaceholders(snippet, parameterListParts.parts, ', ');
|
||||
if (parameterListParts.hasOptionalParameters) {
|
||||
snippet.appendTabstop();
|
||||
|
||||
Reference in New Issue
Block a user