neodev.nvim icon indicating copy to clipboard operation
neodev.nvim copied to clipboard

fix: improve typing for scoped variables

Open stevearc opened this issue 2 years ago • 1 comments

Problem:

Seeing diagnostic warnings about undefined field when accessing window/buffer/tab scoped variables

vim.w.my_window_var   -- Undefined field `my_window_var`.

Solution:

More correct type definition for vim.b/w/t that accounts for the raw (non-numeric) variable access. This uses the @field annotation syntax to describe all keys of a certain type (detailed here)

stevearc avatar Aug 13 '23 08:08 stevearc

+1, I just ran into this when using vim.b.term_title and came to check for a bug report.

solson avatar Nov 01 '23 01:11 solson