aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bump_deps.lua6
-rwxr-xr-xscripts/gen_eval_files.lua14
-rw-r--r--scripts/gen_help_html.lua75
-rw-r--r--scripts/gen_lsp.lua43
-rwxr-xr-xscripts/gen_vimdoc.lua9
-rwxr-xr-xscripts/vim-patch.sh4
6 files changed, 75 insertions, 76 deletions
diff --git a/scripts/bump_deps.lua b/scripts/bump_deps.lua
index e332ef475f..ad71da5150 100755
--- a/scripts/bump_deps.lua
+++ b/scripts/bump_deps.lua
@@ -325,10 +325,8 @@ function M.commit(dependency_name, commit)
end
function M.version(dependency_name, version)
- vim.validate {
- dependency_name = { dependency_name, 's' },
- version = { version, 's' },
- }
+ vim.validate('dependency_name', dependency_name, 'string')
+ vim.validate('version', version, 'string')
local dependency = assert(get_dependency(dependency_name))
verify_cmakelists_committed()
local commit_sha = get_gh_commit_sha(dependency.repo, version)
diff --git a/scripts/gen_eval_files.lua b/scripts/gen_eval_files.lua
index b9ea4e73f0..a9431ae2e5 100755
--- a/scripts/gen_eval_files.lua
+++ b/scripts/gen_eval_files.lua
@@ -617,8 +617,8 @@ local function render_option_meta(_f, opt, write)
end
for _, s in pairs {
- { 'wo', 'window' },
- { 'bo', 'buffer' },
+ { 'wo', 'win' },
+ { 'bo', 'buf' },
{ 'go', 'global' },
} do
local id, scope = s[1], s[2]
@@ -661,8 +661,8 @@ end
local function scope_to_doc(s)
local m = {
global = 'global',
- buffer = 'local to buffer',
- window = 'local to window',
+ buf = 'local to buffer',
+ win = 'local to window',
tab = 'local to tab page',
}
@@ -670,7 +670,7 @@ local function scope_to_doc(s)
return m[s[1]]
end
assert(s[1] == 'global')
- return 'global or ' .. m[s[2]] .. ' |global-local|'
+ return 'global or ' .. m[s[2]] .. (s[2] ~= 'tab' and ' |global-local|' or '')
end
-- @param o vim.option_meta
@@ -717,7 +717,9 @@ local function get_option_meta()
local optinfo = vim.api.nvim_get_all_options_info()
local ret = {} --- @type table<string,vim.option_meta>
for _, o in ipairs(opts) do
- if o.desc then
+ local is_window_option = #o.scope == 1 and o.scope[1] == 'win'
+ local is_option_hidden = o.immutable and not o.varname and not is_window_option
+ if not is_option_hidden and o.desc then
if o.full_name == 'cmdheight' then
table.insert(o.scope, 'tab')
end
diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua
index f6e799508b..b8f80e94be 100644
--- a/scripts/gen_help_html.lua
+++ b/scripts/gen_help_html.lua
@@ -554,11 +554,8 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
return '' -- Spurious "===" or "---" in the help doc.
end
- -- Use the first *tag* node as the heading anchor, if any.
- local tagnode = first(heading_node, 'tag')
- -- Use the *tag* as the heading anchor id, if possible.
- local tagname = tagnode and url_encode(trim(node_text(tagnode:child(1), false)))
- or to_heading_tag(hname)
+ -- Generate an anchor id from the heading text.
+ local tagname = to_heading_tag(hname)
if node_name == 'h1' or #headings == 0 then
---@type nvim.gen_help_html.heading
local heading = { name = hname, subheadings = {}, tag = tagname }
@@ -678,7 +675,7 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
table.insert(stats.first_tags, tagname)
return ''
end
- local el = in_heading and 'span' or 'code'
+ local el = 'span'
local encoded_tagname = url_encode(tagname)
local s = ('%s<%s id="%s" class="%s"><a href="#%s">%s</a></%s>'):format(
ws(),
@@ -694,15 +691,6 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
end
if in_heading and prev ~= 'tag' then
- -- Don't set "id", let the heading use the tag as its "id" (used by search engines).
- s = ('%s<%s class="%s"><a href="#%s">%s</a></%s>'):format(
- ws(),
- el,
- cssclass,
- encoded_tagname,
- trimmed,
- el
- )
-- Start the <span> container for tags in a heading.
-- This makes "justify-content:space-between" right-align the tags.
-- <h2>foo bar<span>tag1 tag2</span></h2>
@@ -957,7 +945,7 @@ local function gen_one(fname, text, to_fname, old, commit, parser_path)
<div class="container golden-grid help-body">
<div class="col-wide">
- <a name="%s"></a><h1 id="%s">%s</h1>
+ <a name="%s" href="#%s"><h1 id="%s">%s</h1></a>
<p>
<i>
Nvim <code>:help</code> pages, <a href="https://github.com/neovim/neovim/blob/master/scripts/gen_help_html.lua">generated</a>
@@ -970,8 +958,9 @@ local function gen_one(fname, text, to_fname, old, commit, parser_path)
</div>
]]):format(
logo_svg,
- stats.first_tags[2] or '',
stats.first_tags[1] or '',
+ stats.first_tags[2] or '',
+ stats.first_tags[2] or '',
title,
vim.fs.basename(fname),
main
@@ -1300,25 +1289,15 @@ end
---
--- @return nvim.gen_help_html.gen_result result
function M.gen(help_dir, to_dir, include, commit, parser_path)
- vim.validate {
- help_dir = {
- help_dir,
- function(d)
- return vim.fn.isdirectory(vim.fs.normalize(d)) == 1
- end,
- 'valid directory',
- },
- to_dir = { to_dir, 's' },
- include = { include, 't', true },
- commit = { commit, 's', true },
- parser_path = {
- parser_path,
- function(f)
- return f == nil or vim.fn.filereadable(vim.fs.normalize(f)) == 1
- end,
- 'valid vimdoc.{so,dll} filepath',
- },
- }
+ vim.validate('help_dir', help_dir, function(d)
+ return vim.fn.isdirectory(vim.fs.normalize(d)) == 1
+ end, 'valid directory')
+ vim.validate('to_dir', to_dir, 'string')
+ vim.validate('include', include, 'table', true)
+ vim.validate('commit', commit, 'string', true)
+ vim.validate('parser_path', parser_path, function(f)
+ return vim.fn.filereadable(vim.fs.normalize(f)) == 1
+ end, true, 'valid vimdoc.{so,dll} filepath')
local err_count = 0
local redirects_count = 0
@@ -1421,23 +1400,13 @@ end
---
--- @return nvim.gen_help_html.validate_result result
function M.validate(help_dir, include, parser_path)
- vim.validate {
- help_dir = {
- help_dir,
- function(d)
- return vim.fn.isdirectory(vim.fs.normalize(d)) == 1
- end,
- 'valid directory',
- },
- include = { include, 't', true },
- parser_path = {
- parser_path,
- function(f)
- return f == nil or vim.fn.filereadable(vim.fs.normalize(f)) == 1
- end,
- 'valid vimdoc.{so,dll} filepath',
- },
- }
+ vim.validate('help_dir', help_dir, function(d)
+ return vim.fn.isdirectory(vim.fs.normalize(d)) == 1
+ end, 'valid directory')
+ vim.validate('include', include, 'table', true)
+ vim.validate('parser_path', parser_path, function(f)
+ return vim.fn.filereadable(vim.fs.normalize(f)) == 1
+ end, true, 'valid vimdoc.{so,dll} filepath')
local err_count = 0 ---@type integer
local files_to_errors = {} ---@type table<string, string[]>
ensure_runtimepath()
diff --git a/scripts/gen_lsp.lua b/scripts/gen_lsp.lua
index c8dcf8c018..8afbae239a 100644
--- a/scripts/gen_lsp.lua
+++ b/scripts/gen_lsp.lua
@@ -58,14 +58,6 @@ end
---@param protocol vim._gen_lsp.Protocol
local function gen_methods(protocol)
- local output = {
- '-- Generated by gen_lsp.lua, keep at end of file.',
- '---',
- '---@enum vim.lsp.protocol.Methods',
- '---@see https://microsoft.github.io/language-server-protocol/specification/#metaModel',
- '--- LSP method names.',
- 'protocol.Methods = {',
- }
local indent = (' '):rep(2)
--- @class vim._gen_lsp.Request
@@ -98,6 +90,41 @@ local function gen_methods(protocol)
table.sort(all, function(a, b)
return to_luaname(a.method) < to_luaname(b.method)
end)
+
+ local output = {
+ '-- Generated by gen_lsp.lua, keep at end of file.',
+ '--- @alias vim.lsp.protocol.Method.ClientToServer',
+ }
+ for _, item in ipairs(all) do
+ if item.method and item.messageDirection == 'clientToServer' then
+ output[#output + 1] = ("--- | '%s',"):format(item.method)
+ end
+ end
+
+ vim.list_extend(output, {
+ '',
+ '--- @alias vim.lsp.protocol.Method.ServerToClient',
+ })
+ for _, item in ipairs(all) do
+ if item.method and item.messageDirection == 'serverToClient' then
+ output[#output + 1] = ("--- | '%s',"):format(item.method)
+ end
+ end
+
+ vim.list_extend(output, {
+ '',
+ '--- @alias vim.lsp.protocol.Method',
+ '--- | vim.lsp.protocol.Method.ClientToServer',
+ '--- | vim.lsp.protocol.Method.ServerToClient',
+ '',
+ '-- Generated by gen_lsp.lua, keep at end of file.',
+ '---',
+ '--- @enum vim.lsp.protocol.Methods',
+ '--- @see https://microsoft.github.io/language-server-protocol/specification/#metaModel',
+ '--- LSP method names.',
+ 'protocol.Methods = {',
+ })
+
for _, item in ipairs(all) do
if item.method then
if item.documentation then
diff --git a/scripts/gen_vimdoc.lua b/scripts/gen_vimdoc.lua
index 8908097397..9cd5b598da 100755
--- a/scripts/gen_vimdoc.lua
+++ b/scripts/gen_vimdoc.lua
@@ -135,7 +135,7 @@ local config = {
lua = {
filename = 'lua.txt',
section_order = {
- 'highlight.lua',
+ 'hl.lua',
'diff.lua',
'mpack.lua',
'json.lua',
@@ -174,7 +174,7 @@ local config = {
'runtime/lua/vim/filetype.lua',
'runtime/lua/vim/keymap.lua',
'runtime/lua/vim/fs.lua',
- 'runtime/lua/vim/highlight.lua',
+ 'runtime/lua/vim/hl.lua',
'runtime/lua/vim/secure.lua',
'runtime/lua/vim/version.lua',
'runtime/lua/vim/_inspector.lua',
@@ -221,7 +221,7 @@ local config = {
end
if
contains(name, {
- 'highlight',
+ 'hl',
'mpack',
'json',
'base64',
@@ -289,6 +289,9 @@ local config = {
},
fn_xform = function(fun)
fun.name = fun.name:gsub('result%.', '')
+ if fun.module == 'vim.lsp.protocol' then
+ fun.classvar = nil
+ end
end,
section_fmt = function(name)
if name:lower() == 'lsp' then
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index bfa9f6d99c..b0ec225633 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -213,8 +213,8 @@ preprocess_patch() {
# Remove "Last change ..." changes in doc files.
2>/dev/null $nvim --cmd 'set dir=/tmp' +'%s/^@@.*\n.*For Vim version.*Last change.*\n.*For Vim version.*Last change.*//' +w +q "$file"
- # Remove gui, option, setup, screen dumps, testdir/Make_*.mak files
- local na_src_testdir='gen_opt_test\.vim\|gui_.*\|Make_amiga\.mak\|Make_dos\.mak\|Make_ming\.mak\|Make_vms\.mms\|dumps/.*\.dump\|setup_gui\.vim'
+ # Remove gui, setup, screen dumps, testdir/Make_*.mak files
+ local na_src_testdir='gui_.*\|Make_amiga\.mak\|Make_dos\.mak\|Make_ming\.mak\|Make_vms\.mms\|dumps/.*\.dump\|setup_gui\.vim'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('"${na_src_testdir}"'\)\>@exe "norm! d/\\v(^diff)|%$\r"' +w +q "$file"
# Remove testdir/test_*.vim files