GNOME Bugzilla – Bug 658000
External Tools: link parsing doesn't seem to work
Last modified: 2019-03-23 20:57:50 UTC
Normally, output of external tools are parsed to convert some text into link. See: http://git.gnome.org/browse/gedit/tree/plugins/externaltools/tools/linkparsing.py However, it doesn't seem to work. 1) Create a Python sample file with an intentional mistake: def a() b = 2 2) Create an external tool: #!/bin/sh # [Gedit Tool] # Name=Link Parsing # Languages=python # Applicability=all # Output=output-panel # Input=nothing # Save-files=nothing python "$GEDIT_CURRENT_DOCUMENT_PATH" 3) Run this tool on "Tools > External Tools". Actual result: Shell Output will display the following: Running tool: Link Parsing
+ Trace 228312
def a()
Exited: 256 No link is created for ' File "/home/user/test.py", line 1'. It's plain text. But see here (REGEXP_PYTHON): http://git.gnome.org/browse/gedit/tree/plugins/externaltools/tools/linkparsing.py#n163 a link should be created.
weird, there are tests for it and all of them pass as expected. See http://git.gnome.org/browse/gedit/tree/plugins/externaltools/tools/linkparsing_test.py
Maybe you can try to make a test that will not pass?
Forget the description above and try this instead: 1) Create this external tool: #!/bin/sh # [Gedit Tool] # Input=word # Save-files=nothing # Name=Link Parsing # Applicability=all # Output=output-panel args=$(xargs) echo "searching for '$args'" grep -nr $args * | sed 's/\(^[^\:]*:[0-9]*:\)/\1 /g' 2) Open a file in gedit, put the cursor on a word and run this tool. Actual result: "Shell Ouput" lists all matching files and lines, for example: test.txt:10: lorem ipsum The string "test.txt:10" is underlined. If the cursor is put over, it changes to inform user that the underlined text is a clickable link. So, click on it. It has no effect with gedit 3.1.5. Nothing happens. Now do the same steps with gedit 2.30.4. A click on the underlined text will open the corresponding file and move the cursor to the specified line. See the attached screenshot.
Created attachment 196133 [details] Screenshot of a working link with gedit 2.30.4
I've found the reason for this to not work if you see in http://git.gnome.org/browse/gedit/tree/plugins/externaltools/tools/linkparsing.py#n177 you can find out that we need an extra comma in order to get the match, so I'd say to remove it.
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.