mirror of
https://github.com/neovim/neovim.git
synced 2026-05-06 08:26:45 -04:00
fix(lua): not obvious which _meta/ files are generated #39035
Problem:
- Not obvious which _meta/ are generated and which should be edited
manually.
- The require guard (`error('Cannot require a meta file')`) is not
consistently present in all meta files.
Solution:
- Update headers.
- Add require() guard to all meta files.
- Rename generated meta files with `.gen.lua`.
This commit is contained in:
+2
-5
@@ -5,11 +5,8 @@
|
||||
runtime/doc/* linguist-documentation
|
||||
runtime/doc/builtin.txt linguist-generated
|
||||
|
||||
runtime/lua/vim/_meta/vimfn.lua linguist-generated
|
||||
runtime/lua/vim/_meta/vvars.lua linguist-generated
|
||||
runtime/lua/vim/_meta/api.lua linguist-generated
|
||||
runtime/lua/vim/_meta/api_keysets.lua linguist-generated
|
||||
runtime/lua/vim/_meta/options.lua linguist-generated
|
||||
# api.gen.lua, vimfn.gen.lua, etc.
|
||||
runtime/lua/vim/_meta/*.gen.lua linguist-generated
|
||||
|
||||
src/xdiff/** linguist-vendored
|
||||
src/cjson/** linguist-vendored
|
||||
|
||||
+2
-2
@@ -46,8 +46,8 @@ exclude_files = {
|
||||
'test/_meta.lua',
|
||||
'test/functional/fixtures/lua/syntax_error.lua',
|
||||
'runtime/lua/vim/treesitter/_meta.lua',
|
||||
'runtime/lua/vim/_meta/vimfn.lua',
|
||||
'runtime/lua/vim/_meta/api.lua',
|
||||
'runtime/lua/vim/_meta/vimfn.gen.lua',
|
||||
'runtime/lua/vim/_meta/api.gen.lua',
|
||||
'runtime/lua/vim/re.lua',
|
||||
'runtime/lua/uv/_meta.lua',
|
||||
'runtime/lua/coxpcall.lua',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--- @meta _
|
||||
-- THIS FILE IS GENERATED
|
||||
-- DO NOT EDIT
|
||||
--
|
||||
-- DO NOT EDIT. GENERATED BY: src/gen/gen_eval_files.lua
|
||||
--
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- This file embeds vimdoc as the function descriptions
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
--- @meta _
|
||||
-- THIS FILE IS GENERATED
|
||||
-- DO NOT EDIT
|
||||
--
|
||||
-- DO NOT EDIT. GENERATED BY: src/gen/gen_eval_files.lua
|
||||
--
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- @class vim.api.keyset.buf_attach
|
||||
@@ -1,4 +1,5 @@
|
||||
--- @meta _
|
||||
-- This file is NOT generated, edit it directly. See also _meta/api_keysets.gen.lua.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Extra types we can't generate keysets for
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
vim.base64 = {}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---@meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
-- luacheck: no unused args
|
||||
|
||||
error('Cannot require a meta file')
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- @class vim.fn.sign
|
||||
--- @field group string
|
||||
--- @field id integer
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
---@meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
---@nodoc
|
||||
vim.json = {}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- These types were taken from https://github.com/LuaCATS/lpeg
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
---@meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- luacheck: no unused args
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- luacheck: no unused args
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--- @meta _
|
||||
-- THIS FILE IS GENERATED
|
||||
-- DO NOT EDIT
|
||||
--
|
||||
-- DO NOT EDIT. GENERATED BY: src/gen/gen_eval_files.lua
|
||||
--
|
||||
error('Cannot require a meta file')
|
||||
|
||||
---@class vim.bo
|
||||
@@ -1,4 +1,5 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- Documentations and Lua types for vim.re (vendored re.lua, lpeg-1.1.0)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- luacheck: no unused args
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
--- @meta
|
||||
-- This file is NOT generated, edit it directly.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- luacheck: no unused args
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--- @meta _
|
||||
-- THIS FILE IS GENERATED
|
||||
-- DO NOT EDIT
|
||||
--
|
||||
-- DO NOT EDIT. GENERATED BY: src/gen/gen_eval_files.lua
|
||||
--
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Return the absolute value of {expr}. When {expr} evaluates to
|
||||
@@ -1,6 +1,7 @@
|
||||
--- @meta _
|
||||
-- THIS FILE IS GENERATED
|
||||
-- DO NOT EDIT
|
||||
--
|
||||
-- DO NOT EDIT. GENERATED BY: src/gen/gen_eval_files.lua
|
||||
--
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- @class vim.v
|
||||
@@ -1,4 +1,5 @@
|
||||
--- @meta _
|
||||
-- This file is NOT generated, edit it directly. See also _meta/vvars.gen.lua.
|
||||
error('Cannot require a meta file')
|
||||
|
||||
--- Extra types for vim.v dictionary fields
|
||||
|
||||
+14
-25
@@ -30,29 +30,22 @@ local LUA_API_RETURN_OVERRIDES = {
|
||||
|
||||
local LUA_META_HEADER = {
|
||||
'--- @meta _',
|
||||
'-- THIS FILE IS GENERATED',
|
||||
'-- DO NOT EDIT',
|
||||
'--',
|
||||
'-- DO NOT EDIT. GENERATED BY: src/gen/gen_eval_files.lua',
|
||||
'--',
|
||||
"error('Cannot require a meta file')",
|
||||
}
|
||||
|
||||
local LUA_API_META_HEADER = {
|
||||
'--- @meta _',
|
||||
'-- THIS FILE IS GENERATED',
|
||||
'-- DO NOT EDIT',
|
||||
"error('Cannot require a meta file')",
|
||||
local LUA_API_META_HEADER = vim.list_extend(vim.deepcopy(LUA_META_HEADER), {
|
||||
'',
|
||||
'--- This file embeds vimdoc as the function descriptions',
|
||||
'--- so ignore any doc related errors.',
|
||||
'--- @diagnostic disable: undefined-doc-name,luadoc-miss-symbol',
|
||||
'',
|
||||
'vim.api = {}',
|
||||
}
|
||||
})
|
||||
|
||||
local LUA_OPTION_META_HEADER = {
|
||||
'--- @meta _',
|
||||
'-- THIS FILE IS GENERATED',
|
||||
'-- DO NOT EDIT',
|
||||
"error('Cannot require a meta file')",
|
||||
local LUA_OPTION_META_HEADER = vim.list_extend(vim.deepcopy(LUA_META_HEADER), {
|
||||
'',
|
||||
'---@class vim.bo',
|
||||
'---@field [integer] vim.bo',
|
||||
@@ -61,17 +54,13 @@ local LUA_OPTION_META_HEADER = {
|
||||
'---@class vim.wo',
|
||||
'---@field [integer] vim.wo',
|
||||
'vim.wo = vim.wo',
|
||||
}
|
||||
})
|
||||
|
||||
local LUA_VVAR_META_HEADER = {
|
||||
'--- @meta _',
|
||||
'-- THIS FILE IS GENERATED',
|
||||
'-- DO NOT EDIT',
|
||||
"error('Cannot require a meta file')",
|
||||
local LUA_VVAR_META_HEADER = vim.list_extend(vim.deepcopy(LUA_META_HEADER), {
|
||||
'',
|
||||
'--- @class vim.v',
|
||||
'vim.v = ...',
|
||||
}
|
||||
})
|
||||
|
||||
local LUA_KEYWORDS = {
|
||||
['and'] = true,
|
||||
@@ -879,19 +868,19 @@ end
|
||||
--- @type nvim.gen_eval_files.elem[]
|
||||
local CONFIG = {
|
||||
{
|
||||
path = 'runtime/lua/vim/_meta/vimfn.lua',
|
||||
path = 'runtime/lua/vim/_meta/vimfn.gen.lua',
|
||||
header = LUA_META_HEADER,
|
||||
funcs = get_eval_meta,
|
||||
render = render_eval_meta,
|
||||
},
|
||||
{
|
||||
path = 'runtime/lua/vim/_meta/api.lua',
|
||||
path = 'runtime/lua/vim/_meta/api.gen.lua',
|
||||
header = LUA_API_META_HEADER,
|
||||
funcs = get_api_meta,
|
||||
render = render_api_meta,
|
||||
},
|
||||
{
|
||||
path = 'runtime/lua/vim/_meta/api_keysets.lua',
|
||||
path = 'runtime/lua/vim/_meta/api_keysets.gen.lua',
|
||||
header = LUA_META_HEADER,
|
||||
funcs = get_api_keysets_meta,
|
||||
render = render_api_keyset_meta,
|
||||
@@ -943,7 +932,7 @@ local CONFIG = {
|
||||
},
|
||||
},
|
||||
{
|
||||
path = 'runtime/lua/vim/_meta/options.lua',
|
||||
path = 'runtime/lua/vim/_meta/options.gen.lua',
|
||||
header = LUA_OPTION_META_HEADER,
|
||||
funcs = get_option_meta,
|
||||
render = render_option_meta,
|
||||
@@ -959,7 +948,7 @@ local CONFIG = {
|
||||
render = render_option_doc,
|
||||
},
|
||||
{
|
||||
path = 'runtime/lua/vim/_meta/vvars.lua',
|
||||
path = 'runtime/lua/vim/_meta/vvars.gen.lua',
|
||||
header = LUA_VVAR_META_HEADER,
|
||||
funcs = get_vvar_meta,
|
||||
render = render_vvar_meta,
|
||||
|
||||
Reference in New Issue
Block a user