A total rewrite of the API generation with attention specifically paid to compatibility with sumneko/lua-language-server
What is this
This is a fork that basically rewrite the entire API generation, and I have also documented some known limitations. This rewrite specifically targets the Lua language server on VS Code without much attention paid to compatibility to the original EmmyLua, so I only want to ask for a draft pull request for now, and when the API generated can also be smoothly loaded by an EmmyLua plugin, I will make this a regular pull request.
Why rewrite
We are also developing a game on LOVE, and have been using the Lua language server on VS Code. The old API generated is kind of incompatible with that plugin, so I made some modification. Some time later, I realize that, to cover more information provided in the original lua table, maybe it is better to just rewrite the whole generation according to its format. By the way, to make it more friendly to the user, I also automate the API generation procedure with GitHub Actions. (Note that the link in the README points to GitHub Actions in my own fork.) Also, to make it more modular, I have also made love-api a submodule instead of directories. (In fact the submodule links to my own fork of love-api, and I have made some modification there.)
Why merge
Because I wanted to promote my fork in your issue and just realized that is kind of inappropriate
I want to promote this rewrite, and make it a default to somewhere like the default plugins provided in the Lua language server on VS Code...
When to merge
There are still some incompatibilities in the generated API, but I do not have a IntelliJ-based IDE installed on my own computer (neither do I want to), so maybe ... may someone do the favor and report the incompatibility at my issue? Some possible incompatibilities that just came to my mind include:
- use multiple definitions of the same function to denote the overloads.
- use
-as a delimiter in the auto-generated type names. - use multiline comments.
- ...
这是什么
我在这个fork里基本上重写了API生成算法,并整理了一些目前已知的不足(见我的issue)。这个重写基本上只追求了能让VS Code上的lua插件能加载这些API,而并没有太关注和原来的EmmyLua的兼容性,所以这个pull request以draft的模式申请,等修改到EmmyLua的插件也能很好地兼容的时候希望能从draft pull request改成正式的pull request并得到通过。
为什么要重写
我们也在使用LOVE开发游戏,并且原来就在VS Code上使用sumneko的插件开发。原来生成的API在配合该插件使用时会有这样那样的不兼容,所以进行了一些修改。后来为了能比较全面地覆盖love-api提供的信息,按它的格式,针对地重写了生成的算法。 另外,为了方便使用,还写了一些Github Actions来自动化生产api的流程。(注意README里的action的链接指向的是fork那边的地址。) 另外,为了更模块化一点,将love-api改为了子模块。(实际上使用的是我自己fork的项目26F-Studio/love-api,里面进行了一些修改。)
为什么要合并
说实话,是因为想在这边的issue里推广自己写的fork,但感觉过于ky
想推广这个重写,提供到像sumneko的预加载插件之类的地方……
何时应该合并
现在生成的API里还有一些不兼容之处,但我没有IntelliJ家的IDE(也不是很打算有),所以可能……需要哪位好心人帮忙提供一下不兼容之处到fork的issue? 一些我觉得可能不兼容的地方:
- 用同一函数的多个定义来指代不同的overload。
- 用
-来在自动生成的类型名字中当分隔符。(这可能是lua language server的一个bug。) - 使用了多行注释。
- ……
Also note that to correctly clone this module, you should recursively clone with symbolic links enabled(--recursive --config core.symlinks=true).