Is there an easy way to get selected text into a variable similar to native variable ${lineNumber} which is the current selected line number? It would be very useful as a parameter for link to online help etc. Thank you.
Asked
Active
Viewed 3,442 times
8
-
11the easiest way you can get the current selected text I know of is... const editor = vscode.window.activeTextEditor; var selection = editor.selection; var text = editor.document.getText(selection); – sreenivas Oct 01 '17 at 17:16
1 Answers
2
It will be $(selectedText} once this vscode github code is released.
Edit: It's actually available now.

Alexander Calandra
- 21
- 3
-
3
-
this variable is to be used in debugging and task configurations: https://code.visualstudio.com/docs/editor/variables-reference – Segfault May 04 '20 at 21:51