diff options
Diffstat (limited to 'runtime/lua')
-rw-r--r-- | runtime/lua/nvim/health.lua | 12 | ||||
-rw-r--r-- | runtime/lua/provider/python/health.lua | 4 | ||||
-rw-r--r-- | runtime/lua/provider/ruby/health.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/api.lua | 45 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/api_keysets.lua | 3 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/highlight.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/inlay_hint.lua | 18 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter/dev.lua | 2 |
10 files changed, 65 insertions, 27 deletions
diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua index 1a440c9827..0480e4df4e 100644 --- a/runtime/lua/nvim/health.lua +++ b/runtime/lua/nvim/health.lua @@ -23,9 +23,15 @@ local function check_runtime() health.start('Runtime') -- Files from an old installation. local bad_files = { + ['plugin/health.vim'] = false, + ['autoload/health/nvim.vim'] = false, + ['autoload/health/provider.vim'] = false, + ['autoload/man.vim'] = false, ['plugin/man.vim'] = false, + ['queries/help/highlights.scm'] = false, + ['queries/help/injections.scm'] = false, ['scripts.vim'] = false, - ['autoload/man.vim'] = false, + ['syntax/syncolor.vim'] = false, } local bad_files_msg = '' for k, _ in pairs(bad_files) do @@ -42,10 +48,10 @@ local function check_runtime() if not ok then health.error( string.format( - '$VIMRUNTIME has files from an old installation (this can cause weird behavior):\n%s', + 'Found old files in $VIMRUNTIME (this can cause weird behavior):\n%s', bad_files_msg ), - { 'Delete $VIMRUNTIME (or uninstall Nvim), then reinstall Nvim.' } + { 'Delete the $VIMRUNTIME directory (or uninstall Nvim), then reinstall Nvim.' } ) end end diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua index 825fddc917..8f77f1d4ba 100644 --- a/runtime/lua/provider/python/health.lua +++ b/runtime/lua/provider/python/health.lua @@ -255,7 +255,7 @@ function M.check() 'See :help provider-python for more information.', 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim', }) - elseif pyname ~= '' and python_exe == '' then + elseif pyname and pyname ~= '' and python_exe == '' then if not vim.g[host_prog_var] then local message = string.format( '`g:%s` is not set. Searching for %s in the environment.', @@ -343,7 +343,7 @@ function M.check() end end - if python_exe == '' and pyname ~= '' then + if pyname and python_exe == '' and pyname ~= '' then -- An error message should have already printed. health.error('`' .. pyname .. '` was not found.') elseif python_exe ~= '' and not check_bin(python_exe) then diff --git a/runtime/lua/provider/ruby/health.lua b/runtime/lua/provider/ruby/health.lua index b102cbe535..d43d7cf9b3 100644 --- a/runtime/lua/provider/ruby/health.lua +++ b/runtime/lua/provider/ruby/health.lua @@ -22,7 +22,7 @@ function M.check() local ruby_detect_table = require('vim.provider.ruby').detect() local host = ruby_detect_table[1] - if host:find('^%s*$') then + if (not host) or host:find('^%s*$') then health.warn('`neovim-ruby-host` not found.', { 'Run `gem install neovim` to ensure the neovim RubyGem is installed.', 'Run `gem environment` to ensure the gem bin directory is in $PATH.', diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index f9fa364158..77a29cb4c1 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1483,15 +1483,24 @@ function vim.api.nvim_notify(msg, log_level, opts) end --- @return integer function vim.api.nvim_open_term(buffer, opts) end ---- Open a new window. ---- Currently this is used to open floating and external windows. Floats are ---- windows that are drawn above the split layout, at some anchor position in ---- some other window. Floats can be drawn internally or by external GUI with ---- the `ui-multigrid` extension. External windows are only supported with ---- multigrid GUIs, and are displayed as separate top-level windows. +--- Opens a new split window, or a floating window if `relative` is specified, +--- or an external window (managed by the UI) if `external` is specified. +--- Floats are windows that are drawn above the split layout, at some anchor +--- position in some other window. Floats can be drawn internally or by +--- external GUI with the `ui-multigrid` extension. External windows are only +--- supported with multigrid GUIs, and are displayed as separate top-level +--- windows. --- For a general overview of floats, see `api-floatwin`. ---- Exactly one of `external` and `relative` must be specified. The `width` ---- and `height` of the new window must be specified. +--- The `width` and `height` of the new window must be specified when opening +--- a floating window, but are optional for normal windows. +--- If `relative` and `external` are omitted, a normal "split" window is +--- created. The `win` property determines which window will be split. If no +--- `win` is provided or `win == 0`, a window will be created adjacent to the +--- current window. If -1 is provided, a top-level split will be created. +--- `vertical` and `split` are only valid for normal windows, and are used to +--- control split direction. For `vertical`, the exact direction is determined +--- by `'splitright'` and `'splitbelow'`. Split windows cannot have +--- `bufpos`/`row`/`col`/`border`/`title`/`footer` properties. --- With relative=editor (row=0,col=0) refers to the top-left corner of the --- screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right --- corner. Fractional values are allowed, but the builtin implementation @@ -1515,6 +1524,15 @@ function vim.api.nvim_open_term(buffer, opts) end --- {relative='win', width=12, height=3, bufpos={100,10}}) --- ``` --- +--- Example (Lua): vertical split left of the current window +--- +--- ```lua +--- vim.api.nvim_open_win(0, false, { +--- split = 'left', +--- win = 0 +--- }) +--- ``` +--- --- @param buffer integer Buffer to display, or 0 for current buffer --- @param enter boolean Enter the window (make it the current window) --- @param config vim.api.keyset.float_config Map defining the window configuration. Keys: @@ -1526,7 +1544,8 @@ function vim.api.nvim_open_term(buffer, opts) end --- • "cursor" Cursor position in current window. --- • "mouse" Mouse position --- ---- • win: `window-ID` for relative="win". +--- • win: `window-ID` window to split, or relative window when +--- creating a float (relative="win"). --- • anchor: Decides which corner of the float to place at --- (row,col): --- • "NW" northwest (default) @@ -1623,6 +1642,8 @@ function vim.api.nvim_open_term(buffer, opts) end --- • fixed: If true when anchor is NW or SW, the float window --- would be kept fixed even if the window would be truncated. --- • hide: If true the floating window will be hidden. +--- • vertical: Split vertically `:vertical`. +--- • split: Split direction: "left", "right", "above", "below". --- @return integer function vim.api.nvim_open_win(buffer, enter, config) end @@ -1952,6 +1973,12 @@ function vim.api.nvim_tabpage_list_wins(tabpage) end --- @param value any Variable value function vim.api.nvim_tabpage_set_var(tabpage, name, value) end +--- Sets the current window in a tabpage +--- +--- @param tabpage integer Tabpage handle, or 0 for current tabpage +--- @param win integer Window handle, must already belong to {tabpage} +function vim.api.nvim_tabpage_set_win(tabpage, win) end + --- Calls a function with window as temporary current window. --- --- @param window integer Window handle, or 0 for current window diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index 00d3ff5bb4..1b6c6811a2 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -118,10 +118,12 @@ error('Cannot require a meta file') --- @field height? integer --- @field anchor? string --- @field relative? string +--- @field split? string --- @field win? integer --- @field bufpos? any[] --- @field external? boolean --- @field focusable? boolean +--- @field vertical? boolean --- @field zindex? integer --- @field border? any --- @field title? any @@ -274,6 +276,7 @@ error('Cannot require a meta file') --- @field ui_watched? boolean --- @field undo_restore? boolean --- @field url? string +--- @field _subpriority? integer --- @class vim.api.keyset.user_command --- @field addr? any diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 2280eec5c8..acf3750500 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -2562,6 +2562,8 @@ function vim.fn.getbufinfo(buf) end --- bufnr Buffer number. --- changed TRUE if the buffer is modified. --- changedtick Number of changes made to the buffer. +--- command TRUE if the buffer belongs to the +--- command-line window |cmdwin|. --- hidden TRUE if the buffer is hidden. --- lastused Timestamp in seconds, like --- |localtime()|, when the buffer was diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 7e1803f640..fbcca2dcfd 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1909,7 +1909,7 @@ local pattern = { ['.*baseq[2-3]/.*%.cfg'] = 'quake', ['.*quake[1-3]/.*%.cfg'] = 'quake', ['.*id1/.*%.cfg'] = 'quake', - ['.*/queries/.*%.scm'] = 'query', -- tree-sitter queries (Neovim only) + ['.*/queries/.*%.scm'] = 'query', -- treesitter queries (Neovim only) ['.*,v'] = 'rcs', ['%.reminders.*'] = starsetf('remind'), ['[rR]akefile.*'] = starsetf('ruby'), diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua index fc2fd43c97..1d04f95d2d 100644 --- a/runtime/lua/vim/highlight.lua +++ b/runtime/lua/vim/highlight.lua @@ -26,7 +26,7 @@ local M = {} --- Table with default priorities used for highlighting: --- - `syntax`: `50`, used for standard syntax highlighting ---- - `treesitter`: `100`, used for tree-sitter-based highlighting +--- - `treesitter`: `100`, used for treesitter-based highlighting --- - `semantic_tokens`: `125`, used for LSP semantic token highlighting --- - `diagnostics`: `150`, used for code analysis such as diagnostics --- - `user`: `200`, used for user-triggered highlights such as LSP document diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua index 4816b873ba..62138c0edf 100644 --- a/runtime/lua/vim/lsp/inlay_hint.lua +++ b/runtime/lua/vim/lsp/inlay_hint.lua @@ -6,7 +6,7 @@ local M = {} ---@class lsp.inlay_hint.bufstate ---@field version? integer ----@field client_hint? table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints) +---@field client_hints? table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints) ---@field applied table<integer, integer> Last version of hints applied to this line ---@field enabled boolean Whether inlay hints are enabled for this buffer ---@type table<integer, lsp.inlay_hint.bufstate> @@ -39,11 +39,11 @@ function M.on_inlayhint(err, result, ctx, _) if not bufstate or not bufstate.enabled then return end - if not (bufstate.client_hint and bufstate.version) then - bufstate.client_hint = vim.defaulttable() + if not (bufstate.client_hints and bufstate.version) then + bufstate.client_hints = vim.defaulttable() bufstate.version = ctx.version end - local hints_by_client = bufstate.client_hint + local hints_by_client = bufstate.client_hints local client = assert(vim.lsp.get_client_by_id(client_id)) local new_hints_by_lnum = vim.defaulttable() @@ -162,7 +162,7 @@ function M.get(filter) end local bufstate = bufstates[bufnr] - if not (bufstate and bufstate.client_hint) then + if not (bufstate and bufstate.client_hints) then return {} end @@ -185,7 +185,7 @@ function M.get(filter) --- @type vim.lsp.inlay_hint.get.ret[] local hints = {} for _, client in pairs(clients) do - local hints_by_lnum = bufstate.client_hint[client.id] + local hints_by_lnum = bufstate.client_hints[client.id] if hints_by_lnum then for lnum = range.start.line, range['end'].line do local line_hints = hints_by_lnum[lnum] or {} @@ -218,11 +218,11 @@ local function clear(bufnr) return end local bufstate = bufstates[bufnr] - local client_lens = (bufstate or {}).client_hint or {} + local client_lens = (bufstate or {}).client_hints or {} local client_ids = vim.tbl_keys(client_lens) --- @type integer[] for _, iter_client_id in ipairs(client_ids) do if bufstate then - bufstate.client_hint[iter_client_id] = {} + bufstate.client_hints[iter_client_id] = {} end end api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1) @@ -319,7 +319,7 @@ api.nvim_set_decoration_provider(namespace, { if bufstate.version ~= util.buf_versions[bufnr] then return end - local hints_by_client = assert(bufstate.client_hint) + local hints_by_client = assert(bufstate.client_hints) for lnum = topline, botline do if bufstate.applied[lnum] ~= bufstate.version then diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua index 399d0ef03e..5020dd87e7 100644 --- a/runtime/lua/vim/treesitter/dev.lua +++ b/runtime/lua/vim/treesitter/dev.lua @@ -14,7 +14,7 @@ local M = {} local TSTreeView = {} ---@class TSP.Node ----@field node TSNode Tree-sitter node +---@field node TSNode Treesitter node ---@field field string? Node field ---@field depth integer Depth of this node in the tree ---@field text string? Text displayed in the inspector for this node. Not computed until the |