-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Opening an issue based on discussion at: #277 (comment)
For “cheap” editor support, I am considering running --emit-lua and then, for example, run Luacheck on the .lua file(s) and use this to drive the editor (for example, [neo]vim quickfix functionality). @sumneko's Lua language server can be jury-rigged for Pallene in a similar fashion (roundtripping via --emit-lua).
The diagnostics (and editor highlighting/cursor positioning) could be more accurate if the columns were preserved in the Lua output. Basically the point of this issue is to add a flag to revert the change in #277. The proposed name is --emit-lua-preserve-columns. It is long, but better descriptive than short, I guess. Other suggestions are welcome.
@hugomg said “maybe it's useful if there are extra error messages you can get from luacheck but not from pallenec.” As a motivating example:
local m = {}
local function f(x : any) : float
local y : integer
local x : integer = y
end
return mLuacheck output:
Checking lck.lua 6 warnings
lck.lua:1:1: setting undefined field ln of global math
lck.lua:3:16: unused function f
lck.lua:3:18: unused argument x
lck.lua:4:10: variable y is never set
lck.lua:5:10: unused variable x
lck.lua:5:10: variable x was previously defined as an argument on line 3
Total: 6 warnings / 0 errors in 1 file
In this simple case the column numbers were OK. The point was to demonstrate that Luacheck adds value on top of pallenec. (The first warning should to be ignored with Luacheck ignore pattern.)
A PR will follow (although feel free if anyone is less time constrained).
Note that I'm not using any of this in my editor yet. I might try to add it in @JLPLabs' pallene-vim.