Sublime Forum

How can result_file_regex be debugged and properly setup?


I am trying to create a custom build system integration (generally running a build inside a docker container with some custom build commands) and looking at

Generally things work, except I have never been able to make result_file_regex or result_line_regex to work at all. I tried things that seemed valid and even went as far as trying settings.set('result_file_regex', r"^(.*)$") to try anything to be displayed, yet I see nothing.

I also attempted to use sublime.log_result_regex(True) in console, the output is still empty. I see no proof that the results regexexes are executed at all - no idea how to narrow down where my issue lies. Is there some global toggle on when the regexes are executed or some better logging (e.g. reporting line by line match attempts and results)?



Possibly, you may be running into the issue seen here:

    if hha_setting("lint_output_to_view"):
        # In views, find results fail until the focus is lost and regained.
        # This is a bug in Sublime, so work around it by changing the focus.
        window.run_command("show_panel", {"panel": "output.HyperHelpAuthor Lint"})

In this particular example, view is the view that the lint output is going to be displayed in and prev_view is the view that had the focus before it was switched/changed to the output view.



Thank you for the answer.

Is there some way I can check if really is the case? I have tried to switch focus between file (C++ source where I forced a compiler error) and output panel, yet I have not seen any indication that errors are detected.

The results you show seem to output to a view vs panel (and view is the one requiring a focus switch). I only ever use panels via self.window.create_output_panel('exec')

I would be willing to switch to views however I have not seen examples of this - is output to views also able to do do result_file_regex and/or result_line_regex? Any chance you could point me to documentation/examples? The only example I was guiding myself through is the custom build system one, which was using panels.



I tried to show the panel only after the compilation completes and double-clicking error lines worked, but then I noticed that showing the panel at start still has double-clicking wokring, so I wonder if I got hit by some combination of not restarting sublime in time or never trying double-click at the right place as there seem to be no highlighting of found errors.

Are errors expected to be highlighted in some way? I seem to recall a rectangle border around errors when using a regular compile step.



Errors aren’t called out in any fashion, no; the regexes find them, and you can use key bindings to navigate through the found errors or double click on them to cause the file that they reference to open (also positioning the file at the line the error was on).

Anything apart from that is up to plugin code to handle. For example the exec command (whose source is visible via the command palette by using View Package File to open Default/ uses line annotations in ST4 and phantoms in ST3 to mark the locations of found errors as files are opened.