mpv-player / mpv-player/mpv

Add type annotations for lua API

Open
#14,830 5 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

meta:feature-request
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing generated types/mp.lua example and the linked LuaLS/luacats annotation documentation, then compare it with the current mpv API documentation. Done means a repository-supported annotation source or generator is defined and the resulting Lua API types are available for language-server completion and hover documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.