Sublime Forum

Problem displaying inline build errors with custom build system

#1

I’m trying to configure Sublime to show inline build errors (as introduced in this blog post). The problem is that my build system doesn’t report paths to files with errors contiguously. Here’s a toy example:

(node:11) UnhandledThing: Unhandled rejection (r id: 2): Error: Error parsing script in /relative/path/script.js at 36:81
SyntaxError: Unexpected token ;```

So the build system reports the fully qualified path to the BUILD file, and then separately reports a path to the file in which the error occurred relative to the BUILD file (and there are BUILD files at multiple levels in my repository, so I couldn't hard code this even if I knew how to). In this case, the fully qualified path to the file would be `/path/to/relative/path/script.js`

I can easily capture these two path fragments separately, but Sublime expects them to appear in the same capture group in `file_regex`, and this has me stumped. You can find a sample regex I've experimented with [here](https://regex101.com/r/1X0byV/1). Capture groups 2 and 3 contain the two parts of the needed file path.

I've reviewed the discussion in this (https://forum.sublimetext.com/t/not-able-to-show-errors-messages-inline-for-my-custom-build-system/24196) forum post, but wasn't able to pull out anything that helped me solve this problem.

I'd appreciate any suggestions or pointers to help me get inline build errors up and running for my system. Thanks!
0 Likes

#2

If you are able to figure out the path of the build file before running it, you could make it work by setting the working_dir key in the build system to that, which the exec command will then transfer to the result_base_dir setting. Any relative file path matches will be based on that.

self.output_view.settings().set("result_base_dir", working_dir)

If the build file is not known or even changes during the build, you’re out of luck.

2 Likes

#3

Awesome, thanks! I’ll see what I can do with that information.

0 Likes