Page 1 of 1

Parse output and jump to file location

Posted: 20.05.2026 03:43
by egfips
I have been looking around the available documentation, searched the forum, scanned the available plugins and abused google quite a bit but I was unable to find anything even close to what I am looking for. It could of course be that I am just searching for the wrong terms. I place this message here, because I think what I am looking for is a plugin.

What I am looking for is typically available in IDEs but I also had it in a previous stand alone editor.I want a tool that
  • parses the text in the output window
  • identifies file names, line and column numbers and the associated messages
  • jumps to the file location in the editor and displays the message
  • allows stepping forward and back through a list of all messages in the output window
The use should be obvious. The output window captures compiler output or the output of some other tool and the feature would allow stepping through the compiler warnings and errors in an efficient manner.

The text to be parsed is of course tool specific, so it is extremely unlikely a universal parser can be written for this. Though it might be possible to write one that works for a considerable number of tools. Anyway, from my (non)findings it is pretty obvious such a thing does not yet exist for CudaText. What I am looking for is sufficient information that allows me to write such tools to match my personal needs.

Re: Parse output and jump to file location

Posted: 20.05.2026 06:08
by main Alexey
API exists for this, for Output/Validate panels, app_log()
* LOG_SET_REGEX: Sets parsing RegEx for log panel. Param "text" is RegEx string. RegEx must have some groups in round brackets, indexes of these groups must be passed in separate API calls. All lines in log panel, which can be parsed by this regex, will allow navigation to source code by click or double-click.
* LOG_SET_LINE_ID: Sets index of regex group for line-number. Param "text" is one-char string from "1" to "8", and "0" means "not used".
* LOG_SET_COL_ID: Sets index of regex group for column-number. Param "text" must be str(number).
* LOG_SET_NAME_ID: Sets index of regex group for file-name. Param "text" must be str(number).
Plugins use this api: Runner, CudaLint, HTML Tidy.
Plugin don't use this api: External Tools. it uses custom code to parse output lines. it uses named groups in regex:

Code: Select all

        {   "run": "dart2js.bat",
            "re": "(?P<file>.+?):(?P<line>\\d+):(?P<col>\\d+): Error:.+",
            "name": "Dart"   
In these plugins, configuration exists to change the regex and IDs.
Is support in Runner / ExtTools / CudaLint enough for you?

Re: Parse output and jump to file location

Posted: 22.05.2026 00:19
by egfips
Thanks, I will have at this and see how far I get. I have to figure out how this is all implemented, there is very little actual information.

Re: Parse output and jump to file location

Posted: 22.05.2026 08:42
by main Alexey
1) ExtTools plugin - information is in the GUI, it gives dialog to configure regex for output lines.
2) Runner - information is in the SublimeText build-systems (inspiration for Runner) docs. Their docs must have info about "file_regex" field of build-systems. This configures the regex for output lines. Authors of build-systems for Runner, seems, know this info.

...
You can suggest what text to add to ExtTools/others readme-files.
Or to the wiki https://wiki.freepascal.org/CudaText_plugins

Re: Parse output and jump to file location

Posted: 23.05.2026 21:39
by egfips
@Alexey, thanks for your responses. I must confess it didn't really help in itself. You are assuming I am a near expert in CudaText and know how to navigate its space. But really I am a rookie and haven't got the first idea about it. Already the term 'Log Panel' means nothing to me as there is no such thing as far as I can see. I suspect you mean 'Output Panel' and that is actually called 'LogPanel' internally in the code (which I have no knowledge of).

Anyway, to make a long story short. Here is what I did and what I found out. It might help others searching for this feature and perhaps can inspire some wiki improvements (I can help a bit with that if you are interested):
  • The feature I was asking about already exists
  • The one thing that steered me in the right direction was the statement about the 'external tools'
  • I searched the .config directory and found cuda_exttools and in there 'readme.txt'. That helped decidedly more than the help provided when clicking the 'Help' button.
  • This file had a hint about the configuration of the external tools plugin. This is the only place where I could find a little information about the meaning of the 'Capture output' and 'Pattern' fields in the tool configuration dialog.
  • Setting the parsing pattern is not simple and I could not manage to implement it correctly. It's easy if you know how it works under the hood. If you don't you are pretty much lost.
  • However, I found you can load a preset by clicking a button at the bottom of the dialog. And wouldn't you know, there are a whole bunch of parsers for different compilers already defined, including one for Java.
  • So, I simply loaded that and it worked right away.
  • The regex for that preset also showed me what I did wrong with my matching pattern. That might serve as a hint for others. If there is no preset for your compiler or tool, just load any preset and study the regex. In my case I needed to match single colons and had used ([:]) but it turns out it should be just the colon by itself (:). You also need to parse all the way to the end of the line, so it must be closed with (.+) which I had omitted. In hindsight it's obvious, but when you are working on it with no feedback what might be wrong it's really difficult.
So, at this point I got the feature working, thank you very much for providing.

At this point the only ask I have left is about improving the implementation. At present it is mouse centric, by requiring a double click on the line of interest in the Output Panel. For me and I guess for most folks that like to work more keyboard centric this feels a bit clumsy. What could be done is this (in addition to the mouse double click):
  • When the tool has run to completion, automatically start the parser and keep running it for every line of the output and build a list of all matches
  • Provide a hotkey response. In my current editor it is shift+ctrl+down arrow for next and shift+ctrl+up arrow for previous
  • This steps forward and reverse through the list and does two things: (1) it jumps to the corresponding text location in the editor, just like the double click and (2) it highlights the corresponding line in the Output Panel.

Re: Parse output and jump to file location

Posted: 25.05.2026 16:45
by main Alexey
yes, by API "app_log" I mean API which work with the Output panel and Validate panel. (wiki page for API app_log must tell that fact, AFAIR).

yes, ExtTools plugin is very mouse centric. your suggested idea makes sense. but the author is not me, it is @kvichans (github name). he is passive now, sorry. so someone, not me / not kvichans, should improve the ExtTools. Claude AI tools can write python code very good, maybe someone can use AI to make the feature you suggest...

i am glad that ExtTools already has the preset for Java.

Re: Parse output and jump to file location

Posted: 25.05.2026 16:54
by main Alexey
btw, I looked at the INF file of ExtTools
py/cuda_exttools/install.inf

and i see it has 2 such commands

Code: Select all

[item4]
section=commands
caption=Tools: Jump to next tool result
method=show_next_result
menu=0

[item5]
section=commands
caption=Tools: Jump to previous tool result
method=show_prev_result
menu=0
did you find these commands? you can find them in the CommandPalette of cudatext, and set hotkeys. it is almost what you suggested.

Re: Parse output and jump to file location

Posted: 25.05.2026 23:14
by egfips
Indeed they do exist and it really is what I am looking for. So it is already implemented. How it is actually coded under the hood is not so important. In any event, it does work as expected.

Now, the implementation is of course even worse than double clicking on the result in the output window. You have to
  • click on the Tools menu
  • once that has opened click on the Results entry
  • another menu opens and you have to click on either Next tool result or Previous tool result
But after I assigned these to the key combinations I am used to from my previous editor I am in business!

Thanks for being patient. If one isn't used to how things are organized in a new environment and what they are called, it can sometimes be a bit hard to find things, even if they look obvious to a seasoned user.

So far I am finding the experience a bit rough round the edges with CudaText. But at the same time eventually I was able to find every functionality that I am used to and that is important to me for an efficient work flow. To top it of everything is working exactly the way I want it and in some cases the implementation is even better/smoother than I was expecting. Given that experience, my feeling about this project is primarily that it is lacking good documentation in order to attract a bigger following.

Re: Parse output and jump to file location

Posted: 26.05.2026 05:49
by main Alexey
>it is lacking good documentation in order to attract a bigger following.

documentation can be improved. we have

- wiki page; for plugins it's https://wiki.freepascal.org/CudaText_plugins
- readme.txt file in the py/cuda_exttools/readme
- some GUI dialogs from 'Help' button, in plugins (open src on github)

maybe you can suggest changes.