Skip to content

Commit

Permalink
Fix parameter not being escaped
Browse files Browse the repository at this point in the history
Fixes #49057
  • Loading branch information
mjbvz committed May 30, 2018
1 parent 8589b59 commit a7a4c6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ suite('typescript.jsDocSnippet', () => {
[
'/**',
' * $0',
' * @param $arg ${1}',
' * @param \\$arg ${1}',
' */'
].join('\n'));
});
Expand Down

0 comments on commit a7a4c6c

Please sign in to comment.