Variables of VSC snipped are ignored using macro
- Dominant language
- JavaScript
- Stars
- 177
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'm using macro to insert custom snippet from selected var in newline.
My snippet is:
```
"customprintr": {
"prefix": "customprintr",
"body": [
"\t \\$printMe = ${CLIPBOARD}; "
],
"description": "Insert custom print_r"
}
```
and my macro is:
```
"macros": {
"printr": [
"editor.action.smartSelect.grow",
"editor.action.clipboardCopyAction",
"editor.action.insertLineAfter",
{
"command": "editor.action.insertSnippet",
"args": {
"name": "customprintr",
"langId": "php",
}
},
]
},
```
The problem is that after macro execution my clipboard is changed. My goal is obtain the same thing without change my clipboard, using for example ${TM_SELECTED_TEXT} in the snippet. I tried, but used with macro this variable is ignored.
Link to snippet variables https://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets
Someone can help me?
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the `printr` macro in VS Code using the shown `customprintr` PHP snippet, first comparing `${CLIPBOARD}` with `${TM_SELECTED_TEXT}`. Trace how the macro runs `editor.action.clipboardCopyAction` before `editor.action.insertSnippet`; done when the selected text is inserted without changing the user's clipboard.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100