Sublime Forum

Opening file:line:col:

#1

Lots of tools output file:line:col, and sublime accepts such specifications on the command line. However, some tools additionally append another colon before the message pertaining to that location in the file: foo.go:1:2: you did it wrong. Double-clicking (in my terminal at least) will highlight the string including the final colon, so I have to remember to delete it before passing it to sublime (otherwise, it opens a file by that literal name). It would be helpful to instead parse that as file:line:col even with the extra colon at the end.

2 Likes

#2

Those commands are called through a callback - meaning if something is added to the menu you can remove it in code - or simply extract the values you need…

The highlighting would be done using a Region ( which is the number of chars from 0 to all in a file or from x to y to select what you want… There are many helper functions to translate line numbers to regions, get the number of chars on a line, etc…

But you’re not asking for help or? Which addons are doing this? You should notify them to use an alternate command to jump to the line - or submit a feature request to Sublime Text devs to only extract relevant data so other data added is ignored…

0 Likes

#3

Sorry, you have not understood what I wrote. For example, I didn’t say anything about commands, menus, highlighting, or addons.

This is about Sublime Text interpreting file:line:col as a filename with line and column number specifications, and mentioning that it would be nice if a final : were ignored for additional convenience.

Please note that the Clipboard Path package does this already, but that doesn’t affect filename specifications on the command line.

0 Likes