Fix parameter not being escaped

Fixes #49057
This commit is contained in:
Matt Bierner
2018-05-30 10:44:20 -07:00
parent 8589b59ac4
commit a7a4c6cb6a
2 changed files with 2 additions and 1 deletions

View File

@@ -206,6 +206,7 @@ class TryCompleteJsDocCommand implements Command {
export function templateToSnippet(template: string): SnippetString {
// TODO: use append placeholder
let snippetIndex = 1;
template = template.replace(/\$/g, '\\$');
template = template.replace(/^\s*(?=(\/|[ ]\*))/gm, '');
template = template.replace(/^(\/\*\*\s*\*[ ]*)$/m, (x) => x + `\$0`);
template = template.replace(/\* @param([ ]\{\S+\})?\s+(\S+)\s*$/gm, (_param, type, post) => {

View File

@@ -70,7 +70,7 @@ suite('typescript.jsDocSnippet', () => {
[
'/**',
' * $0',
' * @param $arg ${1}',
' * @param \\$arg ${1}',
' */'
].join('\n'));
});