bblanchon / SublimeText-HighlightBuildErrors

👻 A plugin for Sublime Text 3 that highlights the lines that caused errors in the build
https://sublime.wbond.net/packages/Highlight%20Build%20Errors
MIT License
12 stars 7 forks source link

Use "line_regex" as well #2

Open bblanchon opened 9 years ago

bblanchon commented 9 years ago

Current implementation only uses the build system's "file_regex", but in some cases "line_regex" might also be needed. http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/build_systems.html

yh-sb commented 8 years ago

I install this plugin and is doesn't work, but in the build output I can jump on the errors using F4, Shift+F4. I use this file_regex: "fileregex": "^(..[^:]):([0-9]+):?([0-9]+)?:? (._)$"

And the error in build output has this syntax: --- compiling .\user-code/main.c... .\user-code/main.c: In function 'main': .\user-code/main.c:44:2: error: expected ')' before '{' token { ^ .\user-code/main.c:54:1: error: expected expression before '}' token } ^

So, what am I doing wrong?

bblanchon commented 8 years ago

Can you copy/paste the output of the console?

yh-sb commented 8 years ago

Do you mean colsol of Sublime Text (Ctrl+`)? Here is:

Running make
Traceback (most recent call last):
  File "HighlightBuildErrors in C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Installed Packages\Highlight Build Errors.sublime-package", line 161, in finish
  File "HighlightBuildErrors in C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Installed Packages\Highlight Build Errors.sublime-package", line 153, in doHighlighting
  File "HighlightBuildErrors in C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Installed Packages\Highlight Build Errors.sublime-package", line 145, in parse
  File "HighlightBuildErrors in C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Installed Packages\Highlight Build Errors.sublime-package", line 145, in <listcomp>
  File "HighlightBuildErrors in C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Installed Packages\Highlight Build Errors.sublime-package", line 114, in __init__
  File "HighlightBuildErrors in C:\Program Files (x86)\Sublime Text\Sublime Text\Data\Installed Packages\Highlight Build Errors.sublime-package", line 98, in get_column
TypeError: int() argument must be a string or a number, not 'NoneType'
bblanchon commented 8 years ago

So there is a problem in converting the column capture into an integer.

Can you try make the column capture mandatory? Like this;

"file_regex": "^(..[^:]):([0-9]+):([0-9]+): (.)$"
yh-sb commented 8 years ago

I tried it. This does not work. With this line I can not even move in error (F4, Shift+F4), as opposed to one line that was in my early. But with your file_regex I don't get HighlightBuildErrors in Sublime Text Console.

bblanchon commented 8 years ago

I think the regex is wrong, please try with: ^(.*):(\\d+):(\\d+):\\s*(.*)$

yh-sb commented 8 years ago

Thank you very much, it works! (But I still do not understand where I can read in details about this regular expression). By the way, I have noticed about fill color in your plugin (At the moment, the fill color is linked to a specific color scheme?). When I use Monokai color scheme - fill color is red, but when I use Spacegray scheme (https://packagecontrol.io/packages/Theme%20-%20Spacegray) - fill color is about gray. How can I change it? fill color Do I understand correct from past issues at githab that the user can not change the color separate from the theme?

yh-sb commented 8 years ago

I came up with the most suitable regex for GCC:

"file_regex": "^(^\S.*\.\w+):(\d+):(\d+): (\w+ ?\w+?): (.*)$"