Skip to content

Commit 8eae60d

Browse files
authored
Merge pull request microsoft#135197 from thebinarysearchtree/Tagged-templates
Remove backticks from word character fix
2 parents a993ada + 5382a52 commit 8eae60d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/vs/editor/common/controller/cursorTypeOperations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ export class TypeOperations {
598598
}
599599

600600
// Do not auto-close ' or " after a word character
601-
if (autoClosingPair.open.length === 1 && chIsQuote && autoCloseConfig !== 'always') {
601+
if (autoClosingPair.open.length === 1 && (ch === '\'' || ch === '"') && autoCloseConfig !== 'always') {
602602
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
603603
if (insertOpenCharacter && position.column > 1 && wordSeparators.get(lineText.charCodeAt(position.column - 2)) === WordCharacterClass.Regular) {
604604
return null;

src/vs/editor/test/browser/controller/cursor.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4878,6 +4878,18 @@ suite('autoClosingPairs', () => {
48784878
model.undo();
48794879
}
48804880

4881+
test('issue #61070: backtick (`) should auto-close after a word character', () => {
4882+
let mode = new AutoClosingMode();
4883+
usingCursor({
4884+
text: ['const markup = highlight'],
4885+
languageId: mode.languageId
4886+
}, (editor, model, viewModel) => {
4887+
model.forceTokenization(1);
4888+
assertType(editor, model, viewModel, 1, 25, '`', '``', `auto closes \` @ (1, 25)`);
4889+
});
4890+
mode.dispose();
4891+
});
4892+
48814893
test('open parens: default', () => {
48824894
let mode = new AutoClosingMode();
48834895
usingCursor({

0 commit comments

Comments
 (0)