LuaLS / LuaLS/lua-language-server
How do I annotate an imported global?
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
I have the following use case. There's a library that defines a global `vim.g` as `table`. In my application code, I want to utilise only the "autoformat" key of that table, i.e. `vim.g.autoformat`. I want to enforce this key as a `boolean?` but the language server marks it as `any`.
Is there any way I could achieve this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named. Start by reproducing the `vim.g.autoformat` annotation case described in the issue and trace how the language server types imported globals and table fields. Done should be a confirmed supported approach, with coverage or documentation showing how to enforce `autoformat` as `boolean?`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100