Sublime Forum

Bug report: the file_regex in the Make Build System is wrong

#1

Hello there,

The file_regex in the Make Build System (in $SUBLIME_DIR/Packages/Makefile/Make.sublime-build) is subtly wrong and it sometimes breaks the Next Result/Previous Result commands. The problem is, the regex matches more than it should. For example, in the project I’m currently working on, the makefile sometimes produces output like this:

o src/Foo.cpp
o src/Bar.cpp
src/Bar.cpp: error: something something error...

The file_regex being this:

"file_regex": "^(..^:]*):([0-9]+):?([0-9]+)?:? (.*)$"

so the first capturing parentheses will match o src/Bar.cpp\nsrc/Bar.cpp. It will then try to interpret it as a file path which is invalid, so the Next Result / Previous Result commands won’t work. The fix is simple, just tell the regex to not match newlines:

"file_regex": "^(..^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$"

That way it will correctly match only src/Bar.cpp in the above example.

0 Likes