Sublime Forum

Can I hide the filename when inlining the build output?

#1

Hi, when trying out the build system option, I noticed that ST nicely inlines the build output in the source code view, e.g.:

```
const char* get_version_type() {
    switch(type) {
^^^ **foo\\src\main\\implementation\foo_bar_baz.cpp**:50: error: type is undefined
```

Unfortunately, the filename at the start of the line can take up most of the view (when filenames are long). It’s not necessary to see the filename since you can already tell in which file you are by looking at the screen title.

Is it possible to hide the filename in the build output lines that are mixed with the source code?

0 Likes

#2

Yes, this looks to be possible. What build system are you using and what is some sample output from the tool being called?

0 Likes

#3

I’m using a custom build system that calls a Scons executable which calls g++. My sublime-build file is this one:

{
    "shell_cmd": "scons.bat main --site-dir=build-system/site_scons -j8",
    "working_dir": "c:\\Users\\nieberm\\workspace",
    "file_regex": "([^\\:]+)\\:([0-9]+)\\: error\\:(.+)"
}

And the error output is:

main\foobar.cpp: In function 'int foo()':
main\foobar.cpp:2: error: invalid conversion from 'const char*' to 'int'
main\foobar.cpp:2: error: expected ';' before 'BAR'
main\foobar.cpp:2: error: 'BAR' was not declared in this scope

(For this code)

int foo() {
    return 123 + "aaa" BAR;
}
0 Likes

#4

The third capture group should capture the column of the error. If you Don’t have one, just add an empty capture. The fourth will then be used for the error message instead of the whole match.

1 Like

#5

Thanks, it works! I thought I was already capturing everything.

0 Likes

#6

For the record, I ended up using:

"file_regex": "(.+)\\:([0-9]+)()\\: error\\:(.+)"
0 Likes