提交 a7a4c6cb 编写于 作者: M Matt Bierner

Fix parameter not being escaped

Fixes #49057
上级 8589b59a
......@@ -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) => {
......
......@@ -70,7 +70,7 @@ suite('typescript.jsDocSnippet', () => {
[
'/**',
' * $0',
' * @param $arg ${1}',
' * @param \\$arg ${1}',
' */'
].join('\n'));
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册