+5

Edit external tool dialog: add a ${line} argument type

Peter Slížik 4 years ago updated by arcadius 6 months ago 3

Some editors, including Sublime Text and Vim, allow to specify the line number on the command line.


Examples:

subl myfile.txt:123

vim myfile.txt +123

If started this way, the editor opens myfile.txt and moves the cursor to line 123. This is very convenient if the editor is launched using a shortcut from another tool, e.g. from a debugger - the cursor is places exactly on the line that requires user attention.

Now it would be convenient if SmartGit allowed to traverse the changes in the Working Tree (in the right page) using the F6 key and then, if manual intervention is needed, to start an editor with the cursor placed on the same line that it is placed in the Working Tree view.


To achieve this, please consider adding a ${line} (or ${lineNo}) variable to the variable list

in the Edit External Tool dialog (as seen in the screenshot).


edit-external-tool.png

Thank you and good luck,

Peter

Update: Sublime Text supports column numbers as well:


$ subl -h

> Filenames may be given a :line or :line:column suffix to open at a specific location.

It would make sense to write expression such as ${filePath}:${lineNo}:${colNo}, or ${filePath}:${line}:${col}, if you wish.

PyCharm's charm launcher is another editor with support for cursor addressing. It supports two syntaxes, --line line and file[:line].

I see this is an old issue. I want to revive it since this would be extremely useful to me.

VS Code also supports opening a file with cursor on specified line and I would like to call it with arguments like: "${filePath}:${line}"

As far as I see, you will be able to just expose variables used in bottom bar to make this work