Compare commits

...

10 Commits

Author SHA1 Message Date
Maria José Solano de822b2cbc
Merge a05b0257fc into 435dee74bb 2024-04-26 19:02:55 -07:00
zeertzjq 435dee74bb
vim-patch:9.1.0374: wrong botline in BufEnter (#28530)
Problem:  When :edit an existing buffer, line('w$') may return a
          wrong result.
Solution: Reset w_valid in curwin_init() (Jaehwang Jung)

`do_ecmd()` reinitializes the current window (`curwin_init()`) whose
`w_valid` field may have `VALID_BOTLINE` set. Resetting `w_botline`
without marking it as invalid makes subsequent `validate_botline()`
calls a no-op, thus resulting in wrong `line('w$')` value.

closes: vim/vim#14642

eb80b8304e

Co-authored-by: Jaehwang Jung <tomtomjhj@gmail.com>
2024-04-27 06:32:25 +08:00
zeertzjq 694756252b
Merge pull request #28529 from zeertzjq/vim-fe1e2b5e2d65
vim-patch: clarify syntax vs matching mechanism
2024-04-27 06:31:55 +08:00
zeertzjq e81eb34aa1 vim-patch:9525f6213604
runtime(doc): fix typo synconcealend -> synconcealed (vim/vim#14644)

9525f62136

Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
2024-04-27 05:52:47 +08:00
zeertzjq a1568f5df0 vim-patch:00ae5c5cba7b
runtime(doc): fix typo

00ae5c5cba

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-27 05:52:15 +08:00
zeertzjq f1f5fb911b vim-patch:fe1e2b5e2d65
runtime(doc): clarify syntax vs matching mechanism

fixes: vim/vim#14643

fe1e2b5e2d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-27 05:51:52 +08:00
Mathias Fußenegger 9b8a075539
fix(lsp): change `silent` in lsp.start.Opts to optional (#28524) 2024-04-26 20:26:21 +02:00
Gregory Anders 73034611c2
feat(diagnostic): add default mappings for diagnostics (#16230) 2024-04-26 13:16:12 -05:00
Brian Cao 3a7c30dc93
fix(man.vim): q quits after jump to different tag in MANPAGER modified (#28495) 2024-04-26 13:14:45 -05:00
Maria José Solano a05b0257fc feat(lsp): markdown diagnostic messages proposal 2024-04-19 11:20:20 -07:00
23 changed files with 275 additions and 107 deletions

View File

@ -8208,6 +8208,10 @@ synconcealed({lnum}, {col}) *synconcealed()*
synconcealed(lnum, 5) [1, 'X', 2]
synconcealed(lnum, 6) [0, '', 0]
Note: Doesn't consider |matchadd()| highlighting items,
since syntax and matching highlighting are two different
mechanisms |syntax-vs-match|.
synstack({lnum}, {col}) *synstack()*
Return a |List|, which is the stack of syntax items at the
position {lnum} and {col} in the current window. {lnum} is

View File

@ -869,7 +869,7 @@ start({config}, {opts}) *vim.lsp.start()*
re-uses a client if name and root_dir matches.
• {bufnr} (`integer`) Buffer handle to attach to if starting
or re-using a client (0 for current).
• {silent} (`boolean`) Suppress error reporting if the LSP
• {silent}? (`boolean`) Suppress error reporting if the LSP
server fails to start (default false).
Return: ~

View File

@ -412,6 +412,10 @@ The following changes to existing APIs or features add new behavior.
• |crr| in Normal and Visual mode maps to |vim.lsp.buf.code_action()|.
• "gr" in Normal mode maps to |vim.lsp.buf.references()| |gr-default|
• |i_CTRL-S| in Insert mode maps to |vim.lsp.buf.signature_help()|
• "]d" and "[d" in Normal mode map to |vim.diagnostic.goto_next()| and
|vim.diagnostic.goto_prev()|, respectively. |]d-default| |[d-default|
• <C-W>d (and <C-W><C-D>) map to |vim.diagnostic.open_float()|
|CTRL-W_d-default|
• Automatic linting of treesitter query files (see |ft-query-plugin|).
Can be disabled via: >lua
vim.g.query_lint_on = {}

View File

@ -1375,6 +1375,19 @@ Finally, these constructs are unique to Perl:
==============================================================================
10. Highlighting matches *match-highlight*
*syntax-vs-match*
Note that the match highlight mechanism is independent
of |syntax-highlighting|, which is (usually) a buffer-local
highlighting, while matching is window-local, both methods
can be freely mixed. Match highlighting functions give you
a bit more flexibility in when and how to apply, but are
typically only used for temporary highlighting, without strict
rules. Both methods can be used to conceal text.
Thus the matching functions like |matchadd()| won't consider
syntax rules and functions like |synconcealed()| and the
other way around.
*:mat* *:match*
:mat[ch] {group} /{pattern}/
Define a pattern to highlight in the current window. It will

View File

@ -3825,7 +3825,9 @@ Whether or not it is actually concealed depends on the value of the
'conceallevel' option. The 'concealcursor' option is used to decide whether
concealable items in the current line are displayed unconcealed to be able to
edit the line.
Another way to conceal text is with |matchadd()|.
Another way to conceal text is with |matchadd()|, but internally this works a
bit differently |syntax-vs-match|.
concealends *:syn-concealends*
@ -3833,7 +3835,9 @@ When the "concealends" argument is given, the start and end matches of
the region, but not the contents of the region, are marked as concealable.
Whether or not they are actually concealed depends on the setting on the
'conceallevel' option. The ends of a region can only be concealed separately
in this way when they have their own highlighting via "matchgroup"
in this way when they have their own highlighting via "matchgroup". The
|synconcealed()| function can be used to retrieve information about conealed
items.
cchar *:syn-cchar*
*E844*

View File

@ -780,9 +780,17 @@ CTRL-W i Open a new window, with the cursor on the first line
beginning of the file. If a count is given, the
count'th matching line is displayed.
*[d-default*
Mapped to |vim.diagnostic.goto_prev()| by default.
|default-mappings|
*]d*
]d like "[d", but start at the current cursor position.
*]d-default*
Mapped to |vim.diagnostic.goto_next()| by default.
|default-mappings|
*:ds* *:dsearch*
:[range]ds[earch][!] [count] [/]string[/]
Like "[d" and "]d", but search in [range] lines
@ -829,6 +837,10 @@ CTRL-W d Open a new window, with the cursor on the first
beginning of the file. If a count is given, the
count'th matching line is jumped to.
*CTRL-W_d-default*
Mapped to |vim.diagnostic.open_float()| by default.
|default-mappings|
*:dsp* *:dsplit*
:[range]dsp[lit][!] [count] [/]string[/]
Like "CTRL-W d", but search in [range] lines

View File

@ -948,7 +948,7 @@ Syntax and highlighting: *syntax-functions* *highlighting-functions*
synIDattr() get a specific attribute of a syntax ID
synIDtrans() get translated syntax ID
synstack() get list of syntax IDs at a specific position
synconcealed() get info about concealing
synconcealed() get info about (syntax) concealing
diff_hlID() get highlight ID for diff mode at a position
matchadd() define a pattern to highlight (a "match")
matchaddpos() define a list of positions to highlight

View File

@ -141,6 +141,9 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y".
- |crr|
- gr |gr-default|
- <C-S> |i_CTRL-S|
- ]d |]d-default|
- [d |[d-default|
- <C-W>d |CTRL-W_d-default|
- Nvim LSP client defaults |lsp-defaults|
- K |K-lsp-default|

View File

@ -24,7 +24,7 @@ if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nnoremap <silent> <buffer> k gk
nnoremap <silent> <buffer> gO :lua require'man'.show_toc()<CR>
nnoremap <silent> <buffer> <2-LeftMouse> :Man<CR>
if get(b:, 'pager')
if get(g:, 'pager')
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>q
else
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c

View File

@ -411,15 +411,13 @@ local function find_man()
return false
end
---@param pager boolean
local function set_options(pager)
local function set_options()
vim.bo.swapfile = false
vim.bo.buftype = 'nofile'
vim.bo.bufhidden = 'unload'
vim.bo.modified = false
vim.bo.readonly = true
vim.bo.modifiable = false
vim.b.pager = pager
vim.bo.filetype = 'man'
end
@ -475,7 +473,7 @@ local function put_page(page)
vim.cmd([[silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g]])
vim.cmd('1') -- Move cursor to first line
highlight_man_page()
set_options(false)
set_options()
end
local function format_candidate(path, psect)
@ -662,7 +660,8 @@ function M.init_pager()
vim.cmd.file({ 'man://' .. fn.fnameescape(ref):lower(), mods = { silent = true } })
end
set_options(true)
vim.g.pager = true
set_options()
end
---@param count integer
@ -730,7 +729,7 @@ function M.open_page(count, smods, args)
if not ok then
error(ret)
else
set_options(false)
set_options()
end
vim.b.man_sect = sect

View File

@ -127,7 +127,9 @@ do
end, { desc = gx_desc })
end
--- Default maps for built-in commenting
--- Default maps for built-in commenting.
---
--- See |gc-default| and |gcc-default|.
do
local operator_rhs = function()
return require('vim._comment').operator()
@ -169,6 +171,35 @@ do
vim.lsp.buf.signature_help()
end, { desc = 'vim.lsp.buf.signature_help()' })
end
--- Map [d and ]d to move to the previous/next diagnostic. Map <C-W>d to open a floating window
--- for the diagnostic under the cursor.
---
--- See |[d-default|, |]d-default|, and |CTRL-W_d-default|.
do
vim.keymap.set('n', ']d', function()
vim.diagnostic.goto_next({ float = false })
end, {
desc = 'Jump to the next diagnostic with the highest severity',
})
vim.keymap.set('n', '[d', function()
vim.diagnostic.goto_prev({ float = false })
end, {
desc = 'Jump to the previous diagnostic with the highest severity',
})
vim.keymap.set('n', '<C-W>d', function()
vim.diagnostic.open_float({ border = 'rounded' })
end, {
desc = 'Open a floating window showing diagnostics under the cursor',
})
vim.keymap.set('n', '<C-W><C-D>', '<C-W>d', {
remap = true,
desc = 'Open a floating window showing diagnostics under the cursor',
})
end
end
--- Default menus

View File

@ -9752,6 +9752,10 @@ function vim.fn.synIDtrans(synID) end
--- synconcealed(lnum, 5) [1, 'X', 2]
--- synconcealed(lnum, 6) [0, '', 0]
---
--- Note: Doesn't consider |matchadd()| highlighting items,
--- since syntax and matching highlighting are two different
--- mechanisms |syntax-vs-match|.
---
--- @param lnum integer
--- @param col integer
--- @return {[1]: integer, [2]: string, [3]: integer}

View File

@ -2,6 +2,8 @@ local api, if_nil = vim.api, vim.F.if_nil
local M = {}
--- @alias vim.diagnostic.MarkupKind lsp.MarkupKind
--- [diagnostic-structure]()
---
--- Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
@ -32,6 +34,9 @@ local M = {}
--- The source of the diagnostic
--- @field source? string
---
--- The kind of the diagnostic's message
--- @field message_kind vim.diagnostic.MarkupKind
---
--- The diagnostic code
--- @field code? string|integer
---
@ -1866,7 +1871,10 @@ function M.open_float(opts, ...)
if not opts.focus_id then
opts.focus_id = scope
end
local float_bufnr, winnr = vim.lsp.util.open_floating_preview(lines, 'plaintext', opts)
local message_kind = vim.iter(diagnostics):any(function (diag)
return diag.message_kind == 'markdown'
end) and 'markdown' or 'plaintext'
local float_bufnr, winnr = vim.lsp.util.open_floating_preview(lines, message_kind, opts)
for i, hl in ipairs(highlights) do
local line = lines[i]
local prefix_len = hl.prefix and hl.prefix.length or 0
@ -1880,6 +1888,26 @@ function M.open_float(opts, ...)
end
end
if message_kind == 'markdown' then
for l, line in ipairs(api.nvim_buf_get_lines(float_bufnr, 0, -1, false)) do
for pattern, hl_group in pairs({
['`%S-`'] = '@markup.raw.markdown_inline',
['[%*_]%S-[%*_]'] = '@markup.italic.markdown_inline',
['[%*_][%*_]%S-[%*_][%*_]'] = '@markup.strong.markdown_inline',
}) do
local from = 1 ---@type integer?
while from do
local to
from, to = line:find(pattern, from)
if from and to then
api.nvim_buf_add_highlight(float_bufnr, -1, hl_group, l - 1, from - 1, to)
end
from = to and to + 1 or nil
end
end
end
end
return float_bufnr, winnr
end
@ -2212,6 +2240,7 @@ function M.fromqflist(list)
end_col = end_col,
severity = severity,
message = item.text,
message_kind = 'plaintext',
}
end
end

View File

@ -201,7 +201,7 @@ end
--- @field bufnr integer
---
--- Suppress error reporting if the LSP server fails to start (default false).
--- @field silent boolean
--- @field silent? boolean
--- Create a new LSP client and start a language server or reuses an already
--- running client if one is found matching `name` and `root_dir`.

View File

@ -2534,8 +2534,14 @@ error('Cannot require a meta file')
---@proposed
---@field inlineCompletionProvider? boolean|lsp.InlineCompletionOptions
---
---Text document specific server capabilities.
---
---@since 3.18.0
---@proposed
---@field textDocument? lsp._anonym12.textDocument
---
---Workspace specific server capabilities.
---@field workspace? lsp._anonym12.workspace
---@field workspace? lsp._anonym14.workspace
---
---Experimental server capabilities.
---@field experimental? lsp.LSPAny
@ -2598,8 +2604,10 @@ error('Cannot require a meta file')
---appears in the user interface.
---@field source? string
---
---The diagnostic's message. It usually appears in the user interface
---@field message string
---The diagnostic's message. It usually appears in the user interface.
---
---@since 3.18.0 - support for `MarkupContent`. This is guarded by the client capability `textDocument.diagnostic.markupMessageSupport`.
---@field message string|lsp.MarkupContent
---
---Additional metadata about the diagnostic.
---
@ -2684,7 +2692,7 @@ error('Cannot require a meta file')
---capabilities.
---
---@since 3.17.0
---@field completionItem? lsp._anonym13.completionItem
---@field completionItem? lsp._anonym15.completionItem
---Hover options.
---@class lsp.HoverOptions: lsp.WorkDoneProgressOptions
@ -2811,6 +2819,8 @@ error('Cannot require a meta file')
---errors are currently presented to the user for the given range. There is no guarantee
---that these accurately reflect the error state of the resource. The primary parameter
---to compute code actions is the provided range.
---
---Note that the client should check the `textDocument.diagnostic.markupMessageSupport` server capability before sending diagnostics with markup messages to a server.
---@field diagnostics lsp.Diagnostic[]
---
---Requested kind of actions to return.
@ -3146,7 +3156,7 @@ error('Cannot require a meta file')
---@class lsp.NotebookDocumentSyncOptions
---
---The notebooks to be synced
---@field notebookSelector (lsp._anonym14.notebookSelector|lsp._anonym16.notebookSelector)[]
---@field notebookSelector (lsp._anonym16.notebookSelector|lsp._anonym18.notebookSelector)[]
---
---Whether save notification should be forwarded to
---the server. Will only be honored if mode === `notebook`.
@ -3514,7 +3524,7 @@ error('Cannot require a meta file')
---anymore since the information is outdated).
---
---@since 3.17.0
---@field staleRequestSupport? lsp._anonym18.staleRequestSupport
---@field staleRequestSupport? lsp._anonym20.staleRequestSupport
---
---Client capabilities specific to regular expressions.
---
@ -3590,7 +3600,7 @@ error('Cannot require a meta file')
---create file, rename file and delete file changes.
---
---@since 3.16.0
---@field changeAnnotationSupport? lsp._anonym19.changeAnnotationSupport
---@field changeAnnotationSupport? lsp._anonym21.changeAnnotationSupport
---@class lsp.DidChangeConfigurationClientCapabilities
---
@ -3617,20 +3627,20 @@ error('Cannot require a meta file')
---@field dynamicRegistration? boolean
---
---Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
---@field symbolKind? lsp._anonym20.symbolKind
---@field symbolKind? lsp._anonym22.symbolKind
---
---The client supports tags on `SymbolInformation`.
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.16.0
---@field tagSupport? lsp._anonym21.tagSupport
---@field tagSupport? lsp._anonym23.tagSupport
---
---The client support partial workspace symbols. The client will send the
---request `workspaceSymbol/resolve` to the server to resolve additional
---properties.
---
---@since 3.17.0
---@field resolveSupport? lsp._anonym22.resolveSupport
---@field resolveSupport? lsp._anonym24.resolveSupport
---The client capabilities of a {@link ExecuteCommandRequest}.
---@class lsp.ExecuteCommandClientCapabilities
@ -3775,9 +3785,9 @@ error('Cannot require a meta file')
---
---The client supports the following `CompletionItem` specific
---capabilities.
---@field completionItem? lsp._anonym23.completionItem
---@field completionItem? lsp._anonym25.completionItem
---
---@field completionItemKind? lsp._anonym27.completionItemKind
---@field completionItemKind? lsp._anonym29.completionItemKind
---
---Defines how the client handles whitespace and indentation
---when accepting a completion item that uses multi line
@ -3794,7 +3804,7 @@ error('Cannot require a meta file')
---capabilities.
---
---@since 3.17.0
---@field completionList? lsp._anonym28.completionList
---@field completionList? lsp._anonym30.completionList
---@class lsp.HoverClientCapabilities
---
@ -3813,7 +3823,7 @@ error('Cannot require a meta file')
---
---The client supports the following `SignatureInformation`
---specific properties.
---@field signatureInformation? lsp._anonym29.signatureInformation
---@field signatureInformation? lsp._anonym31.signatureInformation
---
---The client supports to send additional context information for a
---`textDocument/signatureHelp` request. A client that opts into
@ -3891,7 +3901,7 @@ error('Cannot require a meta file')
---
---Specific capabilities for the `SymbolKind` in the
---`textDocument/documentSymbol` request.
---@field symbolKind? lsp._anonym31.symbolKind
---@field symbolKind? lsp._anonym33.symbolKind
---
---The client supports hierarchical document symbols.
---@field hierarchicalDocumentSymbolSupport? boolean
@ -3901,7 +3911,7 @@ error('Cannot require a meta file')
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.16.0
---@field tagSupport? lsp._anonym32.tagSupport
---@field tagSupport? lsp._anonym34.tagSupport
---
---The client supports an additional label presented in the UI when
---registering a document symbol provider.
@ -3920,7 +3930,7 @@ error('Cannot require a meta file')
---set the request can only return `Command` literals.
---
---@since 3.8.0
---@field codeActionLiteralSupport? lsp._anonym33.codeActionLiteralSupport
---@field codeActionLiteralSupport? lsp._anonym35.codeActionLiteralSupport
---
---Whether code action supports the `isPreferred` property.
---
@ -3943,7 +3953,7 @@ error('Cannot require a meta file')
---properties via a separate `codeAction/resolve` request.
---
---@since 3.16.0
---@field resolveSupport? lsp._anonym35.resolveSupport
---@field resolveSupport? lsp._anonym37.resolveSupport
---
---Whether the client honors the change annotations in
---text edits and resource operations returned via the
@ -4051,12 +4061,12 @@ error('Cannot require a meta file')
---Specific options for the folding range kind.
---
---@since 3.17.0
---@field foldingRangeKind? lsp._anonym36.foldingRangeKind
---@field foldingRangeKind? lsp._anonym38.foldingRangeKind
---
---Specific options for the folding range.
---
---@since 3.17.0
---@field foldingRange? lsp._anonym37.foldingRange
---@field foldingRange? lsp._anonym39.foldingRange
---@class lsp.SelectionRangeClientCapabilities
---
@ -4075,7 +4085,7 @@ error('Cannot require a meta file')
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.15.0
---@field tagSupport? lsp._anonym38.tagSupport
---@field tagSupport? lsp._anonym40.tagSupport
---
---Whether the client interprets the version property of the
---`textDocument/publishDiagnostics` notification's parameter.
@ -4119,7 +4129,7 @@ error('Cannot require a meta file')
---`request.range` are both set to true but the server only provides a
---range provider the client might not render a minimap correctly or might
---even decide to not show any semantic tokens at all.
---@field requests lsp._anonym39.requests
---@field requests lsp._anonym41.requests
---
---The token types that the client supports.
---@field tokenTypes string[]
@ -4202,7 +4212,7 @@ error('Cannot require a meta file')
---
---Indicates which properties a client can resolve lazily on an inlay
---hint.
---@field resolveSupport? lsp._anonym42.resolveSupport
---@field resolveSupport? lsp._anonym44.resolveSupport
---Client capabilities specific to diagnostic pull requests.
---
@ -4216,6 +4226,9 @@ error('Cannot require a meta file')
---
---Whether the clients supports related documents for document diagnostic pulls.
---@field relatedDocumentSupport? boolean
---
---Whether the client supports `MarkupContent` in diagnostic messages.
---@field markupMessageSupport? boolean
---Client capabilities specific to inline completions.
---
@ -4244,7 +4257,7 @@ error('Cannot require a meta file')
---@class lsp.ShowMessageRequestClientCapabilities
---
---Capabilities specific to the `MessageActionItem` type.
---@field messageActionItem? lsp._anonym43.messageActionItem
---@field messageActionItem? lsp._anonym45.messageActionItem
---Client capabilities for the showDocument request.
---
@ -4671,7 +4684,7 @@ error('Cannot require a meta file')
---@since 3.17.0
---@alias lsp.DocumentDiagnosticReport lsp.RelatedFullDocumentDiagnosticReport|lsp.RelatedUnchangedDocumentDiagnosticReport
---@alias lsp.PrepareRenameResult lsp.Range|lsp._anonym44.PrepareRenameResult|lsp._anonym45.PrepareRenameResult
---@alias lsp.PrepareRenameResult lsp.Range|lsp._anonym46.PrepareRenameResult|lsp._anonym47.PrepareRenameResult
---A document selector is the combination of one or many document filters.
---
@ -4692,7 +4705,7 @@ error('Cannot require a meta file')
---An event describing a change to a text document. If only a text is provided
---it is considered to be the full content of the document.
---@alias lsp.TextDocumentContentChangeEvent lsp._anonym46.TextDocumentContentChangeEvent|lsp._anonym47.TextDocumentContentChangeEvent
---@alias lsp.TextDocumentContentChangeEvent lsp._anonym48.TextDocumentContentChangeEvent|lsp._anonym49.TextDocumentContentChangeEvent
---MarkedString can be used to render human readable text. It is either a markdown string
---or a code-block that provides a language and a code snippet. The language identifier
@ -4706,7 +4719,7 @@ error('Cannot require a meta file')
---
---Note that markdown strings will be sanitized - that means html will be escaped.
---@deprecated use MarkupContent instead.
---@alias lsp.MarkedString string|lsp._anonym48.MarkedString
---@alias lsp.MarkedString string|lsp._anonym50.MarkedString
---A document filter describes a top level text document or
---a notebook cell document.
@ -4739,14 +4752,14 @@ error('Cannot require a meta file')
---\@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
---
---@since 3.17.0
---@alias lsp.TextDocumentFilter lsp._anonym49.TextDocumentFilter|lsp._anonym50.TextDocumentFilter|lsp._anonym51.TextDocumentFilter
---@alias lsp.TextDocumentFilter lsp._anonym51.TextDocumentFilter|lsp._anonym52.TextDocumentFilter|lsp._anonym53.TextDocumentFilter
---A notebook document filter denotes a notebook document by
---different properties. The properties will be match
---against the notebook's URI (same as with documents)
---
---@since 3.17.0
---@alias lsp.NotebookDocumentFilter lsp._anonym52.NotebookDocumentFilter|lsp._anonym53.NotebookDocumentFilter|lsp._anonym54.NotebookDocumentFilter
---@alias lsp.NotebookDocumentFilter lsp._anonym54.NotebookDocumentFilter|lsp._anonym55.NotebookDocumentFilter|lsp._anonym56.NotebookDocumentFilter
---The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:
---- `*` to match one or more characters in a path segment
@ -4856,7 +4869,19 @@ error('Cannot require a meta file')
---The client's version as defined by the client.
---@field version? string
---@class lsp._anonym12.workspace
---@class lsp._anonym13.textDocument.diagnostic
---
---Whether the server supports `MarkupContent` in diagnostic messages.
---@field markupMessageSupport? boolean
---@class lsp._anonym12.textDocument
---
---Capabilities specific to the diagnostic pull model.
---
---@since 3.18.0
---@field diagnostic? lsp._anonym13.textDocument.diagnostic
---@class lsp._anonym14.workspace
---
---The server supports workspace folder.
---
@ -4868,7 +4893,7 @@ error('Cannot require a meta file')
---@since 3.16.0
---@field fileOperations? lsp.FileOperationOptions
---@class lsp._anonym13.completionItem
---@class lsp._anonym15.completionItem
---
---The server has support for completion item label
---details (see also `CompletionItemLabelDetails`) when
@ -4877,20 +4902,6 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field labelDetailsSupport? boolean
---@class lsp._anonym15.notebookSelector.cells
---
---@field language string
---@class lsp._anonym14.notebookSelector
---
---The notebook to be synced If a string
---value is provided it matches against the
---notebook type. '*' matches every notebook.
---@field notebook string|lsp.NotebookDocumentFilter
---
---The cells of the matching notebook to be synced.
---@field cells? lsp._anonym15.notebookSelector.cells[]
---@class lsp._anonym17.notebookSelector.cells
---
---@field language string
@ -4900,12 +4911,26 @@ error('Cannot require a meta file')
---The notebook to be synced If a string
---value is provided it matches against the
---notebook type. '*' matches every notebook.
---@field notebook string|lsp.NotebookDocumentFilter
---
---The cells of the matching notebook to be synced.
---@field cells? lsp._anonym17.notebookSelector.cells[]
---@class lsp._anonym19.notebookSelector.cells
---
---@field language string
---@class lsp._anonym18.notebookSelector
---
---The notebook to be synced If a string
---value is provided it matches against the
---notebook type. '*' matches every notebook.
---@field notebook? string|lsp.NotebookDocumentFilter
---
---The cells of the matching notebook to be synced.
---@field cells lsp._anonym17.notebookSelector.cells[]
---@field cells lsp._anonym19.notebookSelector.cells[]
---@class lsp._anonym18.staleRequestSupport
---@class lsp._anonym20.staleRequestSupport
---
---The client will actively cancel the request.
---@field cancel boolean
@ -4915,14 +4940,14 @@ error('Cannot require a meta file')
---response with error code `ContentModified`
---@field retryOnContentModified string[]
---@class lsp._anonym19.changeAnnotationSupport
---@class lsp._anonym21.changeAnnotationSupport
---
---Whether the client groups edits with equal labels into tree nodes,
---for instance all edits labelled with "Changes in Strings" would
---be a tree node.
---@field groupsOnLabel? boolean
---@class lsp._anonym20.symbolKind
---@class lsp._anonym22.symbolKind
---
---The symbol kind values the client supports. When this
---property exists the client also guarantees that it will
@ -4934,32 +4959,32 @@ error('Cannot require a meta file')
---the initial version of the protocol.
---@field valueSet? lsp.SymbolKind[]
---@class lsp._anonym21.tagSupport
---@class lsp._anonym23.tagSupport
---
---The tags supported by the client.
---@field valueSet lsp.SymbolTag[]
---@class lsp._anonym22.resolveSupport
---@class lsp._anonym24.resolveSupport
---
---The properties that a client can resolve lazily. Usually
---`location.range`
---@field properties string[]
---@class lsp._anonym24.completionItem.tagSupport
---@class lsp._anonym26.completionItem.tagSupport
---
---The tags supported by the client.
---@field valueSet lsp.CompletionItemTag[]
---@class lsp._anonym25.completionItem.resolveSupport
---@class lsp._anonym27.completionItem.resolveSupport
---
---The properties that a client can resolve lazily.
---@field properties string[]
---@class lsp._anonym26.completionItem.insertTextModeSupport
---@class lsp._anonym28.completionItem.insertTextModeSupport
---
---@field valueSet lsp.InsertTextMode[]
---@class lsp._anonym23.completionItem
---@class lsp._anonym25.completionItem
---
---Client supports snippets as insert text.
---
@ -4988,7 +5013,7 @@ error('Cannot require a meta file')
---a resolve call.
---
---@since 3.15.0
---@field tagSupport? lsp._anonym24.completionItem.tagSupport
---@field tagSupport? lsp._anonym26.completionItem.tagSupport
---
---Client support insert replace edit to control different behavior if a
---completion item is inserted in the text or should replace text.
@ -5001,14 +5026,14 @@ error('Cannot require a meta file')
---and `details` could be resolved lazily.
---
---@since 3.16.0
---@field resolveSupport? lsp._anonym25.completionItem.resolveSupport
---@field resolveSupport? lsp._anonym27.completionItem.resolveSupport
---
---The client supports the `insertTextMode` property on
---a completion item to override the whitespace handling mode
---as defined by the client (see `insertTextMode`).
---
---@since 3.16.0
---@field insertTextModeSupport? lsp._anonym26.completionItem.insertTextModeSupport
---@field insertTextModeSupport? lsp._anonym28.completionItem.insertTextModeSupport
---
---The client has support for completion item label
---details (see also `CompletionItemLabelDetails`).
@ -5016,7 +5041,7 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field labelDetailsSupport? boolean
---@class lsp._anonym27.completionItemKind
---@class lsp._anonym29.completionItemKind
---
---The completion item kind values the client supports. When this
---property exists the client also guarantees that it will
@ -5028,7 +5053,7 @@ error('Cannot require a meta file')
---the initial version of the protocol.
---@field valueSet? lsp.CompletionItemKind[]
---@class lsp._anonym28.completionList
---@class lsp._anonym30.completionList
---
---The client supports the following itemDefaults on
---a completion list.
@ -5040,7 +5065,7 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field itemDefaults? string[]
---@class lsp._anonym30.signatureInformation.parameterInformation
---@class lsp._anonym32.signatureInformation.parameterInformation
---
---The client supports processing label offsets instead of a
---simple label string.
@ -5048,14 +5073,14 @@ error('Cannot require a meta file')
---@since 3.14.0
---@field labelOffsetSupport? boolean
---@class lsp._anonym29.signatureInformation
---@class lsp._anonym31.signatureInformation
---
---Client supports the following content formats for the documentation
---property. The order describes the preferred format of the client.
---@field documentationFormat? lsp.MarkupKind[]
---
---Client capabilities specific to parameter information.
---@field parameterInformation? lsp._anonym30.signatureInformation.parameterInformation
---@field parameterInformation? lsp._anonym32.signatureInformation.parameterInformation
---
---The client supports the `activeParameter` property on `SignatureInformation`
---literal.
@ -5070,7 +5095,7 @@ error('Cannot require a meta file')
---@since 3.18.0
---@field noActiveParameterSupport? boolean
---@class lsp._anonym31.symbolKind
---@class lsp._anonym33.symbolKind
---
---The symbol kind values the client supports. When this
---property exists the client also guarantees that it will
@ -5082,12 +5107,12 @@ error('Cannot require a meta file')
---the initial version of the protocol.
---@field valueSet? lsp.SymbolKind[]
---@class lsp._anonym32.tagSupport
---@class lsp._anonym34.tagSupport
---
---The tags supported by the client.
---@field valueSet lsp.SymbolTag[]
---@class lsp._anonym34.codeActionLiteralSupport.codeActionKind
---@class lsp._anonym36.codeActionLiteralSupport.codeActionKind
---
---The code action kind values the client supports. When this
---property exists the client also guarantees that it will
@ -5095,18 +5120,18 @@ error('Cannot require a meta file')
---to a default value when unknown.
---@field valueSet lsp.CodeActionKind[]
---@class lsp._anonym33.codeActionLiteralSupport
---@class lsp._anonym35.codeActionLiteralSupport
---
---The code action kind is support with the following value
---set.
---@field codeActionKind lsp._anonym34.codeActionLiteralSupport.codeActionKind
---@field codeActionKind lsp._anonym36.codeActionLiteralSupport.codeActionKind
---@class lsp._anonym35.resolveSupport
---@class lsp._anonym37.resolveSupport
---
---The properties that a client can resolve lazily.
---@field properties string[]
---@class lsp._anonym36.foldingRangeKind
---@class lsp._anonym38.foldingRangeKind
---
---The folding range kind values the client supports. When this
---property exists the client also guarantees that it will
@ -5114,7 +5139,7 @@ error('Cannot require a meta file')
---to a default value when unknown.
---@field valueSet? lsp.FoldingRangeKind[]
---@class lsp._anonym37.foldingRange
---@class lsp._anonym39.foldingRange
---
---If set, the client signals that it supports setting collapsedText on
---folding ranges to display custom labels instead of the default text.
@ -5122,52 +5147,52 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field collapsedText? boolean
---@class lsp._anonym38.tagSupport
---@class lsp._anonym40.tagSupport
---
---The tags supported by the client.
---@field valueSet lsp.DiagnosticTag[]
---@class lsp._anonym40.requests.range
---@class lsp._anonym42.requests.range
---@class lsp._anonym41.requests.full
---@class lsp._anonym43.requests.full
---
---The client will send the `textDocument/semanticTokens/full/delta` request if
---the server provides a corresponding handler.
---@field delta? boolean
---@class lsp._anonym39.requests
---@class lsp._anonym41.requests
---
---The client will send the `textDocument/semanticTokens/range` request if
---the server provides a corresponding handler.
---@field range? boolean|lsp._anonym40.requests.range
---@field range? boolean|lsp._anonym42.requests.range
---
---The client will send the `textDocument/semanticTokens/full` request if
---the server provides a corresponding handler.
---@field full? boolean|lsp._anonym41.requests.full
---@field full? boolean|lsp._anonym43.requests.full
---@class lsp._anonym42.resolveSupport
---@class lsp._anonym44.resolveSupport
---
---The properties that a client can resolve lazily.
---@field properties string[]
---@class lsp._anonym43.messageActionItem
---@class lsp._anonym45.messageActionItem
---
---Whether the client supports additional attributes which
---are preserved and send back to the server in the
---request's response.
---@field additionalPropertiesSupport? boolean
---@class lsp._anonym44.PrepareRenameResult
---@class lsp._anonym46.PrepareRenameResult
---
---@field range lsp.Range
---
---@field placeholder string
---@class lsp._anonym45.PrepareRenameResult
---@class lsp._anonym47.PrepareRenameResult
---
---@field defaultBehavior boolean
---@class lsp._anonym46.TextDocumentContentChangeEvent
---@class lsp._anonym48.TextDocumentContentChangeEvent
---
---The range of the document that changed.
---@field range lsp.Range
@ -5180,18 +5205,18 @@ error('Cannot require a meta file')
---The new text for the provided range.
---@field text string
---@class lsp._anonym47.TextDocumentContentChangeEvent
---@class lsp._anonym49.TextDocumentContentChangeEvent
---
---The new text of the whole document.
---@field text string
---@class lsp._anonym48.MarkedString
---@class lsp._anonym50.MarkedString
---
---@field language string
---
---@field value string
---@class lsp._anonym49.TextDocumentFilter
---@class lsp._anonym51.TextDocumentFilter
---
---A language id, like `typescript`.
---@field language string
@ -5202,7 +5227,7 @@ error('Cannot require a meta file')
---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
---@field pattern? string
---@class lsp._anonym50.TextDocumentFilter
---@class lsp._anonym52.TextDocumentFilter
---
---A language id, like `typescript`.
---@field language? string
@ -5213,7 +5238,7 @@ error('Cannot require a meta file')
---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
---@field pattern? string
---@class lsp._anonym51.TextDocumentFilter
---@class lsp._anonym53.TextDocumentFilter
---
---A language id, like `typescript`.
---@field language? string
@ -5224,7 +5249,7 @@ error('Cannot require a meta file')
---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
---@field pattern string
---@class lsp._anonym52.NotebookDocumentFilter
---@class lsp._anonym54.NotebookDocumentFilter
---
---The type of the enclosing notebook.
---@field notebookType string
@ -5235,7 +5260,7 @@ error('Cannot require a meta file')
---A glob pattern.
---@field pattern? string
---@class lsp._anonym53.NotebookDocumentFilter
---@class lsp._anonym55.NotebookDocumentFilter
---
---The type of the enclosing notebook.
---@field notebookType? string
@ -5246,7 +5271,7 @@ error('Cannot require a meta file')
---A glob pattern.
---@field pattern? string
---@class lsp._anonym54.NotebookDocumentFilter
---@class lsp._anonym56.NotebookDocumentFilter
---
---The type of the enclosing notebook.
---@field notebookType? string

View File

@ -845,6 +845,7 @@ function M.code_action(options)
local bufnr = api.nvim_get_current_buf()
context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics(bufnr)
end
local mode = api.nvim_get_mode().mode
local bufnr = api.nvim_get_current_buf()
local win = api.nvim_get_current_win()
@ -887,6 +888,14 @@ function M.code_action(options)
params = util.make_range_params(win, client.offset_encoding)
end
params.context = context
-- Don't send markup to clients that don't support it.
if not client.server_capabilities.textDocument.diagnostic.markupMessageSupport then
context.diagnostics = vim.iter(context.diagnostics):filter(function(diag)
return type(diag.message) == 'string'
end)
end
client.request(ms.textDocument_codeAction, params, on_result, bufnr)
end
end

View File

@ -110,6 +110,15 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
return vim.tbl_map(function(diagnostic)
local start = diagnostic.range.start
local _end = diagnostic.range['end']
local message, message_kind --- @type string, lsp.MarkupKind
if type(diagnostic.message) == 'string' then
--- @cast diagnostic { message: string }
message_kind = protocol.MarkupKind.PlainText
message = diagnostic.message
else
message_kind = diagnostic.message.kind
message = diagnostic.message.value
end
--- @type vim.Diagnostic
return {
lnum = start.line,
@ -117,7 +126,8 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
end_lnum = _end.line,
end_col = line_byte_from_position(buf_lines, _end.line, _end.character, offset_encoding),
severity = severity_lsp_to_vim(diagnostic.severity),
message = diagnostic.message,
message = message,
message_kind = message_kind,
source = diagnostic.source,
code = diagnostic.code,
_tags = tags_lsp_to_vim(diagnostic, client_id),

View File

@ -841,6 +841,9 @@ function protocol.make_client_capabilities()
inlayHint = {
refreshSupport = true,
},
diagnostic = {
markupMessageSupport = true,
}
},
experimental = nil,
window = {

View File

@ -47,8 +47,8 @@ typedef struct {
#define VALID_VIRTCOL 0x04 // w_virtcol (file col) is valid
#define VALID_CHEIGHT 0x08 // w_cline_height and w_cline_folded valid
#define VALID_CROW 0x10 // w_cline_row is valid
#define VALID_BOTLINE 0x20 // w_botine and w_empty_rows are valid
#define VALID_BOTLINE_AP 0x40 // w_botine is approximated
#define VALID_BOTLINE 0x20 // w_botline and w_empty_rows are valid
#define VALID_BOTLINE_AP 0x40 // w_botline is approximated
#define VALID_TOPLINE 0x80 // w_topline is valid (for cursor position)
// flags for b_flags

View File

@ -11621,6 +11621,10 @@ M.funcs = {
synconcealed(lnum, 4) [1, 'X', 2]
synconcealed(lnum, 5) [1, 'X', 2]
synconcealed(lnum, 6) [0, '', 0]
Note: Doesn't consider |matchadd()| highlighting items,
since syntax and matching highlighting are two different
mechanisms |syntax-vs-match|.
]=],
name = 'synconcealed',
params = { { 'lnum', 'integer' }, { 'col', 'integer' } },

View File

@ -2467,6 +2467,7 @@ void win_init_empty(win_T *wp)
wp->w_topline = 1;
wp->w_topfill = 0;
wp->w_botline = 2;
wp->w_valid = 0;
wp->w_s = &wp->w_buffer->b_s;
}

View File

@ -192,6 +192,7 @@ describe(':Man', function()
'--headless',
'+autocmd VimLeave * echo "quit works!!"',
'+Man!',
'+tag ls',
'+call nvim_input("q")',
}
matches('quit works!!', fn.system(args, { 'manpage contents' }))

View File

@ -4105,4 +4105,16 @@ func Test_SwapExists_set_other_buf_modified()
bwipe!
endfunc
func Test_BufEnter_botline()
set hidden
call writefile(range(10), 'Xxx1', 'D')
call writefile(range(20), 'Xxx2', 'D')
edit Xxx1
edit Xxx2
au BufEnter Xxx1 call assert_true(line('w$') > 1)
edit Xxx1
au! BufEnter Xxx1
set hidden&vim
endfunc
" vim: shiftwidth=2 sts=2 expandtab