mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.89k stars 2.87k forks source link

Add type annotations for lua API #14830

Open ofseed opened 1 week ago

ofseed commented 1 week ago

Expected behavior of the wanted feature

There is lua language server that provides a type annotation system called luacats.

I have generated it from the document myself before using some simple regex, see https://github.com/ofseed/mpv/blob/main/types/mp.lua.

It is useful if you write mpv scripts with the language server because you can auto-complete APIs provided by mpv or read the docs immediately by hovering, Here is the showcase:

image

If you are interested, I could write a more accurate script or github workflow using tree-sitter or python packages to generate it automated in this repository.

Alternative behavior of the wanted feature

  1. Provide these types in another repository.
  2. Write annotations directly and generate the .rst file from it.

Log File

No response

Sample Files

No response

GalaxySnail commented 4 days ago

related: #11678