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

SublimeLinter: syntax_map has been Deprecated #17

Open
zwtderek1986 opened this issue May 24, 2018 · 11 comments
Open

SublimeLinter: syntax_map has been Deprecated #17

zwtderek1986 opened this issue May 24, 2018 · 11 comments
Assignees
Labels

Comments

@zwtderek1986
Copy link

After installing and setting LuaExtended, SublimeLinter can not work properly and lose detection capability.

@InternetUnexplorer
Copy link
Collaborator

Hmm, that's odd. LuaExtended should be compatible with SublimeLinter.
Did you follow the instructions in the README for configuring it?

@viluon
Copy link
Owner

viluon commented May 27, 2018

As @InternetUnexplorer said, LuaExtended should be fully compatible with SublimeLinter (there are literally no opportunities for clashes between the two packages, as far as we know).

To be able to fix the issue, we first need to find out what exactly is going on. Would you mind sharing a bit more information? Notably what SublimeLinter plugins are you using, which files did you try to open (does linting fail with Lua files only or does LuaExtended also break the linters for other languages?), whether Sublime Text crashes or shows any errors in dialogues or in the console, and whether you've followed the linked instructions for linters.

My best guess is you meant to say that Lua files aren't linted after installing LuaExtended - note that our package takes precedence over the stock Lua syntax (so *.lua files open with LuaExtended by default) and needs a syntax map entry so that SublimeLinter knows how to treat it. Without this manual change, SublimeLinter doesn't know which linters to apply when LuaExtended is in use.

@zwtderek1986
Copy link
Author

1
2
3
SublimeLinter has been updated recently. After setting up, SublimeLinter has reported an error

@viluon
Copy link
Owner

viluon commented May 28, 2018

@zwtderek1986 thanks for the clarification. From the error message, it appears that LuaExtended is not the issue here. SublimeLinter-luacheck can't seem to find the luacheck executable. Please make sure that luacheck is in your path and the linter has access to it. If you still think LuaExtended is the cause, try uninstalling it and opening a Lua source file again. I suspect the error will persist.

I'll verify this myself once I find a bit of spare time, I have an exam on linear algebra tomorrow.

@viluon viluon self-assigned this May 28, 2018
@zwtderek1986
Copy link
Author

zwtderek1986 commented May 28, 2018

@viluon After uninstalling the LuaExtended, Sublimelluacheck runs normally. I tested the problem before committing the bug. I hope this problem can be solved as soon as possible. LuaExtended is a great plug-in! Besides, I hope you take a good exam!

1

The error was that the sublimelinter-luacheck was not set. I deleted the sublimelinter-luacheck. The sublimelinter-lua does fail after installing the LuaExtended, and the sublimelinter-lua works fine after uninstalling the LuaExtended!

@viluon
Copy link
Owner

viluon commented May 29, 2018

Thank you @zwtderek1986! Now then, this is very peculiar. I'm starting my own investigation into what is causing this right now. I will update on my progress here once I find out more.

EDIT: Also, pardon me for being so dismissive before. I did not expect this to be a major bug.

@viluon viluon added the bug label May 29, 2018
@viluon
Copy link
Owner

viluon commented May 29, 2018

  • bug confirmed
  • cause identified
  • workaround found
  • waiting for maintainer (@viluon)
  • issue resolved
  • patch released

Bug Confirmed

Happens with SublimeLinter-lua but not with SublimeLinter-luacheck.

Cause Identified

SublimeLinter-luacheck has native support for LuaExtended -- something I was not aware of! Very cool 😍 This is why the bug may not be apparent to all users.

The cause of the issue seems to be a change in SublimeLinter 4.0, which moved from using names for syntax definitions to scope selectors. While this change is wonderful, SL plugins now seem to disregard the syntax_map setting.

From the new default settings file for SublimeLinter:

// DEPRECATED: use the selector linter setting instead:
// http://www.sublimelinter.com/en/stable/linter_settings.html#selector
// ...
"syntax_map": {
	...
},

Workaround Found

Scope selectors can be overridden per-plugin. This is a temporary fix to enable LuaExtended linting everywhere.

Temporary Solution

Add a "linters" section to your SublimeLinter settings, if it doesn't have one already. Then configure the linters of your choice like so:

"linters": {
	// for SublimeLinter-lua
	"lua": {
		"selector": "source.lua, source.luae"
	},
	// for SublimeLinter-someotherlinter
	"someotherlinter": {
		"selector": "source.lua, source.luae"
	},
},

Resolution is Underway Stalling

I have opened a pull request for the most popular Lua linter out there (SublimeLinter/SublimeLinter-lua#8), and opened an issue to see whether a universally applicable solution is a possibility (SublimeLinter/SublimeLinter#1441).


Update (4th July)

From the comments I got on the PR, I found out what needs to be done (make LuaExtended replace the official Lua syntax definition and/or merge the two). I'm unfortunately really busy with work at the moment and I can't do that now. I'm also on a vacation next week, hopefully I'll be able to get back to this issue and fix it all when I come back (week 16th - 22nd).


More Changes

Since SublimeLinter-luacheck supports us out of the box, it wouldn't hurt at all to give them a shoutout in the readme! It is also the best Lua linter I have come across thus far.

@viluon viluon changed the title LuaExtended invalidates SublimeLinter SublimeLinters Don't Follow syntax_map May 29, 2018
@viluon viluon changed the title SublimeLinters Don't Follow syntax_map SublimeLinter: syntax_map has been Deprecated May 29, 2018
@zwtderek1986
Copy link
Author

😍Great. I'm looking forward to solving this problem. Also hope LuaExtended gets better!

@zwtderek1986
Copy link
Author

In addition, is there any code prompt for "table"? Examples: "table.remove", "table.sort", "table.insert", "table.concat"
1

@viluon
Copy link
Owner

viluon commented May 30, 2018

@zwtderek1986 Yes, there is! I don't know why they aren't showing up for you, however 🤔 They work for me, but I can't provide a screenshot due to technical reasons. Would you mind opening another issue?

@zwtderek1986
Copy link
Author

ok

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

No branches or pull requests

3 participants