Replies: 1 comment
-
For me the ideal solution would be to, instead of the plugin returing a table of diffs, returning another URI which acts as the open file's contents. I have no idea if this is possible and/or wanted. I have some (pseudo)code to explain what I mean: function OnSetText(uri, text)
local extension = uri:match("^.+(%..+)$")
if (extension ~= ".lila") then
return nil
end
local newFileContents = Transpile(text)
local newFileUri = uri .. ".lua"
WriteFile(newFileContents, newFileUri)
return newFileUri
end Which would result in
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey 👋
I'd like to create a simple Lua dialect for personal use called Lila, which adds features such as
+=
operators,continue
statements, preprocessor directives, and a bit more. My goal is for Lila to be fully compatible with the Sumneko language server; I just want to enhance the standard Lua experience.I already have this kind of working with the plugin system: I've made a custom ANTLR grammar, and in the plugin's
OnSetText
use ANTLR to parse the .lila files, walk the tree, figure out the positions of any of my custom tokens, and create a table of diffs. Besides maybe some syntax highlighting issues, this works totally fine.The problem comes when I want Lila to work with multiple files, which means requiring needs to happen, so it needs to transpile files on the fly and save them somewhere, even if the file is not currently being edited, but this causes the following:
Now
diffed.lua
will be have the same contents asa.lua
, which will cause the language server to complain: There are now duplicate definitions.I can't exclude the files from
build
, because the transpiledb.lua
might berequire
'd bya.lua
, and the@package
annotation only works with.lua
files.Is there some way to circumvent this?
Beta Was this translation helpful? Give feedback.
All reactions