vscode: Snippet with `TM_SELECTED_TEXT` does not work well
This problem still occurs even if you disable all extensions. This problem was confirmed in Markdown file.
To reproduce
-
Create a snippet containing
TM_SELECTED_TEXT
like below:
"TM_SELECTED_TEXT": { "prefix": "tm_selected_text", "body": "the original ${1:$TM_SELECTED_TEXT} is gone.", "description": "Snippet included TM_SELECTED_TEXT" },
-
Use the snippet made in 1
Version
-
Windows 11
-
VS Code
Version : 1.73.0 (user setup) Commit : 8fa188b2b301d36553cbc9ce1b0a146ccb93351f Date : 2022-11-01T15: 34: 06.111Z Electron : 19.0.17 Chromium : 102.0.5005.167 Node.js : 16.14.2 V8 : 10.2.154.15-electron.0 OS : Windows_NT x64 10.0.22000 Sandboxed: No
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (6 by maintainers)
Glad this is opened. Following this one. Hopefully this is resolved quickly.
fixed via https://github.com/microsoft/vscode/pull/165871
You need to use “F1 > Insert Snippet”, “F1 > Surround With Snippet”, or the surround with quick fix (from the light bulb) for this
Still, $TM_SELECTED_TEXT does not work!
this is a regression from https://github.com/microsoft/vscode/commit/1e662b070fd9f847dfefbdf3f45d0fe538d7e974
It seems there is still something wrong with version 1.74.0. Consider the following snippet and register it for
plaintext
,markdown
andlatex
(without LaTeX-Workshop enabled)Select
some text
and type pair with quick suggestions enabled. Observe that.txt
files,some text
is replaced byxx((some text))xx
as expected.md
or.tex
files,some replaced
is replaced byxx(())xx
.I can open a new issue if you prefer.
NVM - I can reproduce with the following steps
echo
-snippet provided aboveddd
and select it allech
, see and accept the snippet suggestionecho
is inserted, notecho ddd
I would like to say,
TM_SELECTED_TEXT
was working the past week, I was able to surround/wrap text using snippets, so this issue is recent and a regresion.I have some snippets to wrap a text like
this
between php tags like this:<?php this ?>
, they all stopped working this week.Others wrapping snippets that stopped working this week: