Sublime Forum

SublimeLint (Realtime lint highlighting)

#41

[quote=“rdougan”]

Which language are you trying to lint, which fork of sublimelint?

I’m using github.com/Kronuz/SublimeLint.git

It was working a few days ago, so it is a recent thing.[/quote]

There must be some error messages in the console. Try opening SublimeLint/sublimelint_plugin.py, save it, then see what the console says.

0 Likes

#42

Writing file /Users/Robert/Desktop/untitled.js with encoding UTF-8 Traceback (most recent call last): File "./sublime_plugin.py", line 147, in on_post_save File "./sublimelint_plugin.py", line 594, in on_post_save File "./sublimelint_plugin.py", line 302, in queue_linter File "./sublimelint_plugin.py", line 286, in select_linter TypeError: argument of type 'NoneType' is not utterable

0 Likes

#43

I fixed it myself by removing the check to see if the language is disabled. I’m not familiar enough with python to fix it properly…

0 Likes

#44

Change line 283 to:

disable = view.settings().get(‘sublimelint_disable’, ])

0 Likes

#45

I’m having some issues trying to get customize Kronuz’s fork. It doesn’t seem like any of the settings take effect. I’ve tried adding them to “Global Settings - User” and also to “File Settings - User”, but neither seem to be picked up. Am I looking in the right place?

0 Likes

#46

A fixed version can be found here:

github.com/aparajita/SublimeLint

0 Likes

#47

Thanks!

Linting used to work when you simply modified the file, but no longer seems to? You have to save. I tried debugging last night and the queue method gets called, but I’m getting the file must be saved for it to ‘lint’?

0 Likes

#48

Small issue: The example theme syntax for annotations says the scope is sublimelint.notes, but it should be sublimelint.annotations.

0 Likes

#49

@andymccurdy, You should use User File Settings to put the SublimeLint settings. What settings aren’t working?

0 Likes

#50

@andymccurdy Also, make sure there are no errors in the console. Has happened a few times for me

0 Likes

#51

@andymccurdy, the setting you have to add to the User File Settings is something like this, to ignore pep8 errors (David Cramer told me you were asking him):

"pep8_ignore":  "E501" ],
0 Likes

#52

@Kronuz Ah, I was putting in in User Global Settings. Thanks!

0 Likes

#53

It’s working for me interactively. Are you getting any console errors?

0 Likes

#54

Nope, nothing. And I was debugging it last night (putting a bunch of 'print’s everywhere) and the same things seemed to be called in the code. Very odd.

0 Likes

#55

By the way there’s a small and inconsequential bug in sublimelint. When there’s nothing selected a bunch of errors go on the console. Basically the line which causes the error is in on_selection_modified where it assumes there’s at least one selection.

A simple git diff for a fix is:

diff --git a/sublimelint_plugin.py b/sublimelint_plugin.py
index e7e3293..c56fd04 100755
--- a/sublimelint_plugin.py
+++ b/sublimelint_plugin.py
@@ -181,8 +181,9 @@ class pyflakes(sublime_plugin.EventListener):

        def on_selection_modified(self, view):
                vid = view.id()
-               lineno = view.rowcol(view.sel()[0].end())[0]
-               if vid in lineMessages and lineno in lineMessages[vid]:
-                       view.set_status('pyflakes', '; '.join(lineMessages[vid][lineno]))
-               else:
-                       view.erase_status('pyflakes')
+               if len(view.sel()):
+                       lineno = view.rowcol(view.sel()[0].end())[0]
+                       if vid in lineMessages and lineno in lineMessages[vid]:
+                               view.set_status('pyflakes', '; '.join(lineMessages[vid][lineno]))
+                       else:
+                               view.erase_status('pyflakes')

As can be seen, all I’ve done is checked that there is at least one selection (using “if len(view.sel())”) before executing the code on it. There may be other work that needs doing for this, (maybe adding an “else:” that does the “view.erase_status(‘pyflakes’)” bit, I didn’t want to get that far into it).

If you want a pull request let me know, but I’m not exactly all up on github and whatnot so I figured I’d just present the patch here in code and words.

0 Likes

#56

even a single cursor selection counts as a selection with the same start/end point

0 Likes

#57

I’m having a problem where SublimeLint tries to parse HAML files as ruby, throwing errors in the process. Any ideas?

0 Likes

#58

I cant seem to get this working for javascript

im on windows, and added nodejs to my path (node -v returns the current version)

When i try node it returns errors (ie javascript file contains errors), and on a correct file it returns nothing, but i dont see the borders appear where the errors actually are

Also is anyone interested or wiling to write a jquery linting plugin - that would be very very helpful with all the brackets in jquery :smile:

Any help is much appreciated

Thank you for this wonderful plugin!

0 Likes

#59

I’m pretty sure Open Komodo has a Javascript linter written in python… I don’t know how good that might be, but it’s there. The main problem with it is …the license :frowning:

0 Likes

#60

While I don’t know how difficult it would be (or even possible), I would love to have lint highlighting for Java.

Just a request…

0 Likes