Skip to content
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

A total rewrite of the API generation with attention specifically paid to compatibility with sumneko/lua-language-server #12

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from

Conversation

ImpleLee
Copy link

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。)
  • 使用了多行注释。
  • ……

ImpleLee added 30 commits March 6, 2021 15:33
commit 307cce3
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:21:25 2021 +0800

    add merge as a condition of packaging

commit 7361d6c
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:19:22 2021 +0800

    rename the name of api

commit 1031eb2
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:17:45 2021 +0800

    upload the zipped artifact

commit 2071439
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:11:51 2021 +0800

    keep the `lua` version the same with my own

commit d3adb8a
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:08:30 2021 +0800

    test symbolic links

commit 52eb08a
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:06:35 2021 +0800

    test symbolic links

commit 422d4b2
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:05:19 2021 +0800

    test symbolic links

commit 10beba3
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:03:00 2021 +0800

    fix enum description

commit 477badf
Author: Imple Lee <[email protected]>
Date:   Sun Mar 7 00:00:35 2021 +0800

    add upload-related actions

commit b9300ad
Author: Imple Lee <[email protected]>
Date:   Sat Mar 6 23:55:28 2021 +0800

    fix repository position and checkout submodules

commit 6ba8c47
Author: Imple Lee <[email protected]>
Date:   Sat Mar 6 23:51:51 2021 +0800

    fix `lua -v`

commit 7b5c815
Author: Imple Lee <[email protected]>
Date:   Sat Mar 6 23:49:35 2021 +0800

    try another lua library

commit ad78619
Author: Imple Lee <[email protected]>
Date:   Sat Mar 6 23:45:20 2021 +0800

    second try on github actions

commit b9c2c7a
Author: Imple Lee <[email protected]>
Date:   Sat Mar 6 23:41:56 2021 +0800

    first try on github actions
maybe Github will automatically zip it again...
@ImpleLee
Copy link
Author

Also note that to correctly clone this module, you should recursively clone with symbolic links enabled(--recursive --config core.symlinks=true).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant