Using TM_SELECTED_TEXT in my custom snippets

后端 未结 4 1185
醉话见心
醉话见心 2021-01-04 19:06

With the November 2016 (version 1.8) release of VSCode Snippet Variables are now supported, specifically TM_SELECTED_TEXT.

This makes me happy as I have used these h

4条回答
  •  伪装坚强ぢ
    2021-01-04 19:35

    using documentation from https://code.visualstudio.com/docs/editor/userdefinedsnippets i was able to customize snippets, i am using 'surround with' extension and can put my own snippet into settings.json as follows:

    "html_h3-name": {
      "label": "h3",
      "description": "wrap by h3 with , top",
      "snippet": "

    $TM_SELECTED_TEXT\n\ttop\n

    "

    },

    which takes highlighted code in VSCode and creates h3 header from it with a name link:

    it converts  'aaa bbb ccc' to 
    

    aaa bbb ccc top

提交回复
热议问题