After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658000 - External Tools: link parsing doesn't seem to work
External Tools: link parsing doesn't seem to work
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-01 19:27 UTC by Jean-Philippe Fleury
Modified: 2019-03-23 20:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of a working link with gedit 2.30.4 (99.95 KB, image/png)
2011-09-09 17:23 UTC, Jean-Philippe Fleury
Details

Description Jean-Philippe Fleury 2011-09-01 19:27:23 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

  • File "/home/user/test.py", line 1
    def a()
SyntaxError: invalid syntax

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.
Comment 1 Ignacio Casal Quinteiro (nacho) 2011-09-01 20:26:01 UTC
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
Comment 2 Ignacio Casal Quinteiro (nacho) 2011-09-01 20:26:53 UTC
Maybe you can try to make a test that will not pass?
Comment 3 Jean-Philippe Fleury 2011-09-09 17:00:38 UTC
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.
Comment 4 Jean-Philippe Fleury 2011-09-09 17:23:54 UTC
Created attachment 196133 [details]
Screenshot of a working link with gedit 2.30.4
Comment 5 Ignacio Casal Quinteiro (nacho) 2011-10-09 22:01:38 UTC
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.
Comment 6 Ignacio Casal Quinteiro (nacho) 2011-10-10 08:08:52 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.