提交 24ca702d 编写于 作者: R Ramya Achutha Rao

Escape $ so that it doesnt get treated as variable Fixes #31032

上级 bbfdd063
......@@ -17,6 +17,8 @@ interface ExpandAbbreviationInput {
preceedingWhiteSpace?: string;
}
const selectedTextToWrap = '\n\$TM_SELECTED_TEXT\n';
export function wrapWithAbbreviation(args) {
const syntax = getSyntaxFromArgs(args);
if (!syntax || !validate()) {
......@@ -72,7 +74,7 @@ export function wrapWithAbbreviation(args) {
if (!allTextToReplaceSame) {
expandAbbrList.forEach(input => {
input.textToWrap = '\n\$TM_SELECTED_TEXT\n';
input.textToWrap = selectedTextToWrap;
});
}
......@@ -230,6 +232,9 @@ function expandAbbr(input: ExpandAbbreviationInput, newLine: string): string {
let expandedText;
try {
expandedText = expand(input.abbreviation, expandOptions);
if (input.textToWrap !== selectedTextToWrap) {
expandedText = expandedText.replace(/\$/g, '\\$');
}
} catch (e) {
vscode.window.showErrorMessage('Failed to expand abbreviation');
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册