LuaLS / LuaLS/lua-language-server
How to override a meta file definition?
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
I am using a 3rd party library for neovim runtime (neodev) which defines types for the global variables. There's a table which it generally annotates as:
---@meta
---@type table<integer, table<string, any>>
vim.b = {}
Is there way I can override this definition in my project scope as shown below?
---@meta
---@type table<integer, {autoformat?: boolean}>
vim.b = {}
The problem that I have currently is that the LSP infers vim.b[0].autoformat as any because the definitions annotate it as any|boolean.
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
Reproduce the example with neodev's global vim.b definition and the project-level @meta declaration shown in the issue. Start by tracing how LuaLS resolves competing @meta and @type declarations, then determine what supported override behavior would mean; the issue is complete when the behavior is implemented or clearly documented with a focused validation case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100