Home > Back-end >  Go to line in vs code, but with offset instead of exact line number
Go to line in vs code, but with offset instead of exact line number

Time:11-05

Long story short, I get call stacks, and they indicate a line number, but that number is an offset within the method. So i get line 40, but because the procedure starts at 120, it's really 160.

What I would love is to be able to enter that offset in the go to line function (ctrl g). I don't know if there is a way to do it and I am just completely missing it / google failing me, or if it's something I'd have to write my own extension for.

Thanks.

CodePudding user response:

With the extension Select By v1.18.0 you can construct a Relative Goto Line command

Add the following key binding:

  {
    "key": "ctrl alt g",  // or any other key binding
    "when": "editorTextFocus",
    "command": "moveby.calculation",
    "args": {
      "lineNrEx": "selection.start.line relative",
      "charNrEx": "selection.start.character"
    }
  }
  • Related