Skip to content
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

Merged
merged 1 commit into from
Aug 2, 2019
Merged

Adjust linter plugin to match sublime linter v4 API #39

merged 1 commit into from
Aug 2, 2019

Conversation

m90
Copy link
Contributor

@m90 m90 commented Jul 24, 2019

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

}

def run(self, cmd, code):
"""
Copy link
Contributor Author

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
Copy link
Collaborator

bcomnes commented Jul 26, 2019

A working plugin for javascript files but one that does not work for embedded js in html would be better than a plugin that doesn't work at all.

@Flet @feross any thoughts?

@m90
Copy link
Contributor Author

m90 commented Jul 26, 2019

@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 run does?

@bcomnes
Copy link
Collaborator

bcomnes commented Jul 26, 2019

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.

@bcomnes
Copy link
Collaborator

bcomnes commented Jul 26, 2019

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.

@bcomnes
Copy link
Collaborator

bcomnes commented Aug 2, 2019

Just tested this, this is good.

@bcomnes bcomnes merged commit 9e13597 into Flet:master Aug 2, 2019
@bcomnes
Copy link
Collaborator

bcomnes commented Aug 2, 2019

v3.1.4

@feross
Copy link
Collaborator

feross commented Aug 4, 2019

Thanks for fixing this @m90 and @bcomnes!

Its probably just space before closing.
script tag
"""
if code and self.syntax == 'html':
Copy link

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 😁.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants