Closed Sharsie closed 1 year ago
I would recommend adding it to globals for the workplace settings for now. It should stop complaining about them being undefined at that point.
"Lua.diagnostics.globals": [
"Properties",
"JSON",
"C4"
]
I do have plans to expand these as an addon to the Lua extension using @meta files, at that point it would better trigger the auto completion and have much better typing support: https://github.com/LuaLS/lua-language-server/wiki/Addons#creating-an-addon
Started work on it here: https://github.com/annex4/lua-addon-control4
If you'd like to contribute I've added some basic examples of the various methods. Annotation information here: https://github.com/LuaLS/lua-language-server/wiki/Annotations
Yea I'm not too worried about it complaining, would rather get this working, just starting with the development and it's especially useful at the beginning. I'll check it out after work, if it helps, I'll be happy to contribute. Thanks Shall I leave this open until it's implemented? Otherwise lets close it
Alright, I'll need to update this extension to remove the function suggestions. They're nearly entirely defined in the new Lua addon now: https://github.com/annex4/lua-addon-control4
Clone it somewhere local and then point your Lua settings at it like the following:
{
"Lua.workspace.userThirdParty": ["E:/Software Development/LuaLibraries"],
"Lua.workspace.library": ["E:/Software Development/LuaLibraries/lua-addon-control4/library"]
}
Thanks, I did, I actually already started writing a parser for the Driverworks api reference. I guess that's not gonna be of much use anymore, but I wonder how it's gonna differ. Would be nice to get this automated, although there are some quirks, like differently written definitions and it looks like return values are also not properly documented... Will continue working on it tomorrow just to see what can be retrieved from it
The Lua extension addon now has fairly elaborate typing's and I believe every function: https://github.com/annex4/lua-addon-control4. I've added a basic README to the repository for others. Once I'm done cleaning everything up and making sure everything has a proper type I'll push it to the official addon repo for the Lua extension.
I'm going to close the issue here as this extension is going to contextually suggest parameter values instead of supplying everything. If there are autocompletion issues feel free to open an issue on the other repository.
On another note I had a CHM parser I was using to create the JSON files for the functions and hooks you can find in this repository. Sadly the documentation isn't formatted similarly between all of the functions and there are typos for some function names so they don't actually exist. The same happens with the parameter values. It did an alright job but there was quite a bit of manual fixing required.
You are right, the documentation is a mess, once I ran the parser, I noticed how many disrepancies there are. Thanks a lot for all the work you have done :)
Hey @annex4, sorry for the issue, I realize I'm probably alone, but I can't figure out how to get the LSP working properly.
To eliminate any problems with other extensions, I currently have only the following installed: https://marketplace.visualstudio.com/items?itemName=sumneko.lua as a requirement and your extensions with LSP: https://marketplace.visualstudio.com/items?itemName=annex4-inc.vscode-control4
I have autocompletion enabled for sumneko, I have DriverEditor 301 installed and the paths pointing to the executables. I tried different versions of node (from 12 - 18) to no avail I downloaded one of your repositories - the kodi control to test it there to make sure it's not an issue with my project, still no go...
I'm getting the function descriptions, but that's pretty much it. Everything is
unknown
and the autocompletion is not available.I've been at this for two days now and I just can't figure it out. Does it require something? Some other extensions, some configuration, something to run? I have reset all the settings and have defaults for everything now.
Other functionalities work ok, I can see the properties,, events etc in the Control4 panel. Just the autocompletion is eluding me.