Home > Back-end >  Select range between two tags VSCode
Select range between two tags VSCode

Time:10-29

Is there a way or an extension in VSCode to select a range of lines between 2 tags,

i have a large file about 90000 lines of code, lets say i will put two tags in two different lines, at line 331 and 2210 for example

331   #MY_TAG
332   .......
333   .......
334   .......
2210  #MY_TAG

is there a way to select the lines between #MY_TAG with a keyboard shortcut or an extension which allow that.

CodePudding user response:

You can use the extension Select By

Define a keybinding:

{
    "key": "ctrl shift alt T",  // or any other combo
    "when": "editorTextFocus",
    "command": "selectby.regex",
    "args": {
      "backward": "#MY_TAG(\\r?\\n)?",
      "forward": "#MY_TAG",
      "forwardInclude": false,
      "backwardInclude": false
    }
  }

Place the cursor anywhere between the 2 tags and use the key binding.

  • Related