-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add flag --emit-lua-preserve-columns to benefit from Lua diagnostics tools #567
Comments
I also realize now that |
I agree that this deserves a separate issue. I also expect that it shouldn't be too difficult to implement. Add a couple of lines to the compile_pln_to_lua function in driver.lua local function compile_pln_to_lua(input_ext, output_ext, input_file_name, base_name)
assert(input_ext == "pln")
local input, err = driver.load_input(input_file_name)
if not input then
return false, { err }
end
local prog_ast, errs = driver.compile_internal(input_file_name, input, "checker")
if not prog_ast then
return false, errs
end
-- HERE
-- Add some code to continue the compilation up to step "uninitialized"
local translation = translator.translate(input, prog_ast)
assert(util.set_file_contents(base_name .. "." .. output_ext, translation))
return true, {}
end
|
Including test case.
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:
Luacheck output:
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.
The text was updated successfully, but these errors were encountered: