diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2026-09-07 11:43:51 +0100 |
|---|---|---|
| committer | Lewis Russell <me@lewisr.dev> | 2026-09-07 15:33:22 +0100 |
| commit | 65ef6fdaeef86f8341293942c076b320acf03fd1 (patch) | |
| tree | 8cc53d5edb74640ba17e3c2bf0a3d9c9b959071b /runtime/lua/vim/iter.lua | |
| parent | cd52c77cd5ad87ab4950946e0a51a8e13b53b4f5 (diff) | |
| download | rneovim-65ef6fdaeef86f8341293942c076b320acf03fd1.tar.gz rneovim-65ef6fdaeef86f8341293942c076b320acf03fd1.tar.bz2 rneovim-65ef6fdaeef86f8341293942c076b320acf03fd1.zip | |
build: replace LuaLS with EmmyLua
Problem: LuaLS struggles with the generics used in Nvim's runtime,
requiring broad diagnostic suppressions. Indexing is also slow.
Solution: Use EmmyLua for type checks in the build and CI. It offers
more sophisticated type checking, substantially better support for
generics, and much better flow analysis.
Correct the affected annotations. Use `@internal`, supported directly by
EmmyLua, instead of `@nodoc` for shared internal declarations, and
support it in the help parser.
AI-assisted
Diffstat (limited to 'runtime/lua/vim/iter.lua')
| -rw-r--r-- | runtime/lua/vim/iter.lua | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua index b0e00d8dd4..136941e233 100644 --- a/runtime/lua/vim/iter.lua +++ b/runtime/lua/vim/iter.lua @@ -64,13 +64,11 @@ --- -- { "a", "b" } --- ``` --- LuaLS cannot model the variadic EmmyLua generics used by this module. ----@diagnostic disable: no-unknown, undefined-doc-name, luadoc-miss-symbol, missing-return, missing-return-value, param-type-mismatch, return-type-mismatch, redundant-return-value, undefined-field - +-- `never` represents an empty tail for single-value iterators. --- @nodoc --- @class vim.IterModule --- @operator call: vim.Iter<any, any...> ---- @overload fun<T>(src: T[]): vim.IterArray<T> +--- @overload fun<T>(src: T[]): vim.IterArray<T, never> --- @overload fun<K, V>(src: table<K, V>): vim.Iter<K, V> --- @overload fun(src: table, ...): vim.Iter<any, any...> --- @overload fun(src: function, ...): vim.Iter<any, any...> @@ -468,7 +466,7 @@ end --- --- --- @since 12 ---- @overload fun<T>(self: vim.Iter<T>): T[] +--- @overload fun<T>(self: vim.Iter<T, never>): T[] --- @overload fun<V1, V2, V...>(self: vim.Iter<V1, V2, V...>): [V1, V2, V...][] --- @return any[] function Iter:totable() @@ -486,7 +484,7 @@ function Iter:totable() end --- @nodoc ---- @overload fun<T>(self: vim.IterArray<T>): T[] +--- @overload fun<T>(self: vim.IterArray<T, never>): T[] --- @overload fun<V1, V2, V...>(self: vim.IterArray<V1, V2, V...>): [V1, V2, V...][] --- @return any[] function IterArray:totable() @@ -1250,7 +1248,7 @@ end --- @generic R1, R... --- @param src table<R1, R>|fun(s: table, v: any): R1, R... Table or iterator to drain values from --- @return vim.Iter<R1, R...> ---- @overload fun<T>(src: T[]): vim.IterArray<T> +--- @overload fun<T>(src: T[]): vim.IterArray<T, never> --- @overload fun<K, V>(src: table<K, V>): vim.Iter<K, V> --- @private function Iter.new(src, ...) |