Sublime Forum

Capture errors in custom build

#1

I work with custom build system in ST3.
My compiler generates me errors something like this:* MyFileName.cpp:413: error: expected ‘;’ before ‘return’*
I want to capture them and navigate to corresponding file and line using F4.
My build system: { "shell_cmd": "gmake debug" ,"working_dir": "/Disk/PathToProject" ,"file_regex": "^(.*.cpp):(\\d*): error: (.*)$" }
Everything works fine, ST3 highlights row with error message in the build log and navigates to corresponding file and row, but only if file is under /PathToProject. If file is for ex. under /PathToProject/Subfolder1 then row with error is highlighted, but ST3 doesn’t navigate to correct file, instead of this it creates an empty file under /PathToProject.

According to doc I should use “line_regex”

Ok, I have in my build log row like this: Entering directory `/Disk/PathToProject/Subfolder1’. And I can easy capture it in file_regex. So my build settings becomes:

{ "shell_cmd": "gmake debug" ,"working_dir": "/Disk/PathToProject" ,"file_regex": "^.*Entering directory `/Disk/PathToProject/(.*)'$" ,"line_regex": "^(.*.cpp):(\\d*): error: (.*)$" }

My question is: what is the way to concatenate paths from file_regex and line_regex and tell ST3 correctly which file to open when I press F4?

Thank you for your time.

0 Likes

Building with Make, Regex and F4
#2

I found, that the only one way to do it - override exec function for my build system. From doc:

[quote]target - Optional. Sublime Text command to run. Defaults to exec (Packages/Default/exec.py). This command receives the configuration data specified in the .build-system file.
Used to override the default build system command. Note that if you choose to override the default command for build systems, you can add arbitrary variables in the .sublime-build file.[/quote]

But this doc describes the way to do it only for ST2. ST3 has different arhitecture and it doesn’t have exec.py file. Does anybody know the correct way to override default exec function for custom build system?

0 Likes

#3

I have the same problem as here: Build system with recursive make
So the only way to resolve the problem - external tool/script, that will change the output before it will be captured by sublime regex…

0 Likes