Sublime Forum

Support for multiple file_regex in sublime-build

#1

It would be nice if file_regex supported an array of patterns. I use bazel as a build system and matching all the possible outputs for each language is difficult in a single regexp.

I guess ideally I would like to see the file and line regex’s grouped in a message and make that message a list.

"regexs": [
  {"file_regex": "...", "line_regex": "..."},
  {"file_regex": "...", "line_regex": "..."},
]
1 Like

#2

Thinking about this a little more, how about adding the ability for scopes to be used instead. This way a build output syntax can define all the patterns. Things like bazel, make or any other build system the calls other compilers can include the error syntax of their respective languages.

foo/bar.baz:10:4: my error
^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.build.error
^^^^^^^^^^^ build.file.name
            ^^ build.file.row
               ^ build.file.column
                  ^^^^^^^^ build.error

This opens up the possibility of capturing multiline errors too.

We should also support something like lines_regex:

error: foo/bar.baz
^^^^^^^^^^^^^^^^^^ meta.build.error
       ^^^^^^^^^^^ build.file.name
  line:12: not good
  ^^^^^^^^^^^^^^^^^ meta.build.error.line
       ^^ build.file.row
           ^^^^^^^^ build.error
  line:52: it's broken
  ^^^^^^^^^^^^^^^^^ meta.build.error.line
       ^^ build.file.row
           ^^^^^^^^^^ build.error
0 Likes

#3

I don’t think this is feasible. However you can just write your own build command and set the result_file_regex for the corresponding language.

0 Likes

#4

I guess you’d have to set a different syntax depending whether the return code indicated a failure or not, but that’d only work after the process exits… maybe as soon as something is written to stderr?

0 Likes