Sublime Forum

Clicking on Build Errors doesn't work & other stuff

#1

@OdatNurd thanks for you reply to my last post. I thank you here because as I’m going to use one of your videos to help elucidate (maybe) my issue.

Also I looked at this post:

At about 10.40 ish in this video:

the host (@OdatNurd) says if you get an error in your code you can double click on it. You’ll get a marker in your code too.

I get neither, I noticed a few days ago, but I’ve finally got round to finding and checking out the vid. Am I missing something ?

L

0 Likes

Building with Make, Regex and F4
#2

Navigation of this sort is powered by the file_regex (and sometimes also line_regex) that appears in the sublime-build file. Sublime uses them to determine what part of the output generated by the program (if any) represents a result that you want to navigate to.

The documentation for this feature is at: https://www.sublimetext.com/docs/3/build_systems.html#exec_options

When they’re present (and they match something in the output) Sublime will use the captured file and location information to jump to the file if you double click the line in the output. You can also use the options in Tools > Build Results (or the key bindings you’ll find there) to navigate through errors as well.

If you’re using a sublime-build and it doesn’t have those lines, then result navigation won’t do anything because Sublime has no way to know which output is results. This is often the case when a built in build system doesn’t work for you (say the Python.sublime-build file) because a lot of the advice for build systems on the internet never mentions that file_regex and line_regex are a thing.

There’s also this setting from the Preferences.sublime-settings file (shown here with the default value):

    // Shows build errors just under the line on which they occur.
    "show_errors_inline": true,

If this setting is turned on (and there are results as determined by the regex options mentioned above) then an indicator as in the video (roughly 9:40) will appear pointing at the error. That will happen for any file that’s currently open and they will also appear when files are loaded too.

In addition to this, if your sublime-build file uses a custom target key (for example if you’re using Terminus) then these things also may not work unless the custom target that you’re using supports them.

In the case of Terminus it will honor the file_regex and line_regex items to allow you to navigate, but it doesn’t display inline errors (or at least, it didn’t the last time I checked).

0 Likes

#3

Hi @OdatNurd and anyone else !

Thanks for your reply. I have the icon at the error in the file, but not the ability to double click on the error message and go there.

Am sorry to say that the documentation re file_regex (which is ref’ed in your vids, your reply and other links) is totally and utterly indecipherable for me :crazy_face: (And I write stuff in C++ so am used to all kinds of weird stuff !). I don’t think it’s noob material.

All I did was copy what your youtube vid had in the regex file section at roughly 6.40.
(btw, the git link from that video; the only thing not in there is the build system you’re were using, ho ho!)

So partial solution.
Being able to click on the error to take you to the code, i think, is going to be an important resource, so any further help much appreciated.

Also a link to a simple explination of file_regex would be useful. As a noob all the explinations assume high levels of knowledge. Perhaps all one needs is just

“file_regex”:"^(|…[^:]):([0-9]):?([0-9])?:? (.)$",

pasted into the build file.If so, there’s nowhere that explicitly says that, usually we go straight to beyond noob explanations or no explanations.

If the above is ok, brill thanks, if it needs tweaking to get the functionality I want could you please let me know.

Again thank you for your detailed reply…nearly there !!! :wink:

Ps Just to show I do do some work in trying to solve these things, the file_regex shown the the documentation that you’ve linked to is totally different to the one in your vid !! To quote a famous urangutan, “Eek!”

0 Likes

#4

If the one works the other should work as well, since they’re tied together. I’m not sure what you mean by “icon” though; what you should see is similar to what’s outlined in the video above; a red box inline in the file pointing at the error location with the text of the error on it.

If you’re seeing that, then you have the correct setup because the error message and location information for displaying those comes from the file_regex (and if needed, line_regex) in the build system.

That’s not outlined in my videos because teaching how regular expressions work is outside of the scope that I’m going for currently. I would imagine that the same is also the reason why the documentation doesn’t explain it either. It’s not the sort of topic that lends itself to a one or two minute discussion, at any rate.

You may find this useful though:
https://www.regular-expressions.info/tutorial.html

The one from the video isn’t in the GitHub repository primarily because for the most part sharing them around isn’t super useful. The regular expression needs to match what the tool is outputting, and different tools output messages in different formats (even things like gcc and clang which both compile C code generate messages in a different format).

So basically there’s not really a “one size fits all” value for this setting. It’s something that you need to work out based on the tools you’re using.

0 Likes

#5

The regular expression needs to match what the tool is outputting, and different tools output messages in different formats (even things like gcc and clang which both compile C code generate messages in a different format).

So basically there’s not really a “one size fits all” value for this setting. It’s something that you need to work out based on the tools you’re using.

Thank you and hmmm, I think I’m back to my standard moan somewhat sadly…phooee. Anyway as per previous post it’s kind of working, thanks again !

Ps Yes, by icon I meant the red box

0 Likes

#6

You are right. It is the magic of the exec command. We could copy the code to Terminus. It is just a matter of free time to implement it.

1 Like