Home Download Buy Blog Forum Support

sublime text 2 syntax errors highlighting

sublime text 2 syntax errors highlighting

Postby blazin1 on Sun Nov 13, 2011 3:03 pm

In Sublime text 2 when I make an error like forget a ";" or add an extra closing or opening tag there is no highlighting that tells me that I have made a misstake. And only after running the code will I know that a misstake was made. Is this normal for sublime text 2 or is it just me? If this is normal, is there any extension to fix this?
blazin1
 
Posts: 2
Joined: Sun Nov 13, 2011 2:14 pm

Re: sublime text 2 syntax errors highlighting

Postby C0D312 on Sun Nov 13, 2011 3:51 pm

ST2 does not include error highlighting by default. However, I strongly suggest you use SublimeLinter (available on github: https://github.com/kronuz/SublimeLinter/ or through package control: http://wbond.net/sublime_packages/package_control). SublimeLinter includes support for Javascript, Objective-J, Python, Ruby, PHP, Java, and Perl.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: sublime text 2 syntax errors highlighting

Postby facelessuser on Sun Nov 13, 2011 3:56 pm

Sublime Text 2 doen't do any linting. If you want to do that, you may need a plugin.

With that said, syntax files can highlight stuff like that for you to some degree, but the author of the syntax file has to code in that functionality. Syntax files are essentially just big tables of regex that assign some scope based on defined rules. If you put in the right regex to find missing ";", you can then assign the "invalid" scope to the line and show the issue. It just gets hard to do it this way because of all the other things it is also trying to highlight; it can be unreliable.

So I would see if the linting plugins available already support your language, or find a good linter and write a plugin to utilize it and highlight the issues, or make a request to the authors of the current lint plugins to add in the linter support (if available) for your language.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: sublime text 2 syntax errors highlighting

Postby blazin1 on Sun Nov 13, 2011 4:15 pm

C0D312 wrote:ST2 does not include error highlighting by default. However, I strongly suggest you use SublimeLinter (available on github: https://github.com/kronuz/SublimeLinter/ or through package control: http://wbond.net/sublime_packages/package_control). SublimeLinter includes support for Javascript, Objective-J, Python, Ruby, PHP, Java, and Perl.


Ty, but it seems like the error highlighting is not automaticly done. You have to press the keybinded buttons to find the errors if I am not misstaken.
blazin1
 
Posts: 2
Joined: Sun Nov 13, 2011 2:14 pm

Re: sublime text 2 syntax errors highlighting

Postby C0D312 on Sun Nov 13, 2011 4:55 pm

SublimeLinter can be set to on, off or on-save (Which can be set under Preferences > Package Settings > Sublime Linter > Default). "On" will lint as you type. "On save" will only lint when you save the file. No keybinding necessary.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: sublime text 2 syntax errors highlighting

Postby kakubei on Fri Jan 06, 2012 10:56 am

Just wanted to point out that I tracked an error when using SublimeLinter and dropbox on the Mac. If a file is on a dropbox folder, ST2 will immediately quit after opening that file. Removing SublimeLinter fixes the error.

I rely heavily on SublimeLinter. Can someone suggest an alternative that does real-time Ruby and PHP syntax checking?
kakubei
 
Posts: 58
Joined: Sun Sep 25, 2011 9:19 am

Re: sublime text 2 syntax errors highlighting

Postby aparajita on Sat Jan 07, 2012 9:07 am

kakubei wrote:Just wanted to point out that I tracked an error when using SublimeLinter and dropbox on the Mac. If a file is on a dropbox folder, ST2 will immediately quit after opening that file. Removing SublimeLinter fixes the error.

I rely heavily on SublimeLinter. Can someone suggest an alternative


Perhaps you could report it as a bug (with details and a sample file) instead of giving up and looking for alternatives.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], Orlmente and 23 guests