-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust linter plugin to match sublime linter v4 API #39
Conversation
} | ||
|
||
def run(self, cmd, code): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to admit, that after reading the documentation I have no real idea of how to reproduce this behavior in V4 as syntax
has been deprecated.
@bcomnes It does work against embedded JS like this just fine. The only thing we'd possibly be losing is excluding trailing blank lines in the embedded JS from linting. Or am I missing something completely here about what the code in |
I looks like a contextual hack for linting JS inside of html, where the whitespace at the end of the script block isn't interpreted correctly. I'm fine with removing that till someone wants to fix it. |
I would also like to take this moment to appreciate how effing backwards sublime's peer dependency system is that a working plugin would just break on account of something it depends on, but can't declare the version it needs. |
Just tested this, this is good. |
v3.1.4 |
Its probably just space before closing. | ||
script tag | ||
""" | ||
if code and self.syntax == 'html': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just read this here and thought I comment even if it's old.
The new way to do this is if code and self.view.match_selector(0, 'text.html.basic'):
, t.i. there is basically no new way you just use the (more powerful) Sublime Text API. The scope text.html.basic
is debatable, I'm no experts in the scope namings thing. But there is also text.html.vue
iirc and you probably want to exclude that.
Besides that, there is a faster way to check if the trailing line of a string is just whitespace, no? Probably you don't start at char 0 but come from the end 😁.
When run against Sublime Linter >= 4.12.0 SublimeLinter-contrib-standard stops working due to API deprecations: #38
This adjusts the plugin to use the expected v4 attributes. I can use this locally against plain JS, JS embedded in Markdown as well as in HTML and JSX.
Probably also related to #36 and #31