Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Select range between two tags VSCode

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading