LuaExtended icon indicating copy to clipboard operation
LuaExtended copied to clipboard

SublimeLinter: syntax_map has been Deprecated

Open zwtderek1986 opened this issue 7 years ago • 11 comments

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

zwtderek1986 avatar May 24 '18 06:05 zwtderek1986

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

InternetUnexplorer avatar May 25 '18 03:05 InternetUnexplorer

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.

viluon avatar May 27 '18 12:05 viluon

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

zwtderek1986 avatar May 28 '18 03:05 zwtderek1986

@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 avatar May 28 '18 12:05 viluon

@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!

zwtderek1986 avatar May 28 '18 23:05 zwtderek1986

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 avatar May 29 '18 16:05 viluon

  • [x] bug confirmed
  • [x] cause identified
  • [x] 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 :heart_eyes: 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 (https://github.com/SublimeLinter/SublimeLinter-lua/pull/8), and opened an issue to see whether a universally applicable solution is a possibility (https://github.com/SublimeLinter/SublimeLinter/issues/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 avatar May 29 '18 16:05 viluon

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

zwtderek1986 avatar May 30 '18 00:05 zwtderek1986

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

zwtderek1986 avatar May 30 '18 00:05 zwtderek1986

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

viluon avatar May 30 '18 17:05 viluon

ok

zwtderek1986 avatar May 31 '18 00:05 zwtderek1986