This allows the user to detach an active buffer from the language
client. If no clients remain attached to a buffer, the on_lines callback
is used to cancel nvim_buf_attach.
Previously, the `_str_utfindex_enc` and `_str_byteindex_enc` helper functions would return `nil` when `offset_encoding == "utf-8"` and `index == nil`. Clearly, this doesn't reflect the expected behavior of the functions they're wrapping which would return the length of the line in this case. This should fix behavior with servers that use UTF-8 `offset_encoding` when applying text edits, formatting a range, and doing range code actions (though this isn't tested currently).
Closes https://github.com/neovim/neovim/issues/16562https://github.com/neovim/neovim/issues/16249https://github.com/neovim/neovim/issues/16297
* buf_attach_client can be called on an unloaded buffer
* on_attach will prematurely fail, while the language server client
tracks this buffer as attached
* The language server client will track this buffer as attached despite
textDocument/didChange notifications not being sent to the server
* Instead, check if the buffer is loaded and return early, warning via
the lsp logger that buf_attach_client was called on an invalid buffer
Problem: Dep3patch files are not recognized.
Solution: Recognize dep3patch files by their location and content. (James
McCoy, closesvim/vim#9367)
647ab4cede
docs(reg_recorded): add links to relevant docs
docs(Recording): update docs to match implementation
docs(Q) update references of Q to be gQ
docs(autocmd) add description about state of reg_record{ing,ed} for RecordingLeave
docs(vim_diff) add Recording{Enter,Leave} to features
docs(index) removed duplicate gQ
docs(options) removed line about gQ erroring in visual mode
Update runtime/doc/vim_diff.txt
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
docs(vim_diff) removed double mention of Q
feat(eval): add reg_recorded()
This function is used the get the last recorded register.
style(Recording): rename handler to match suggestions
fix(RecordingLeave): send autocommand earlier
This makes the autocommand fire just before setting reg_recorded to
reg_recording, this way we clearly show that we are actually just before
actually quitting the recording mode.
The `prefix_source` function only evaluates the sources from the
diagnostics passed to it; however, because each namespace draws its own
virtual text, its diagnostics will never contain more than a single
source (by definition). This requires changing the semantics of what
"if_many" means from "multiple sources in a single 'batch' of
diagnostics" to "multiple sources of all diagnostics within a buffer".
Closes#16624
Fixes two issues with aligning the start position and end position to
codepoints when calculating the start and end range.
When aligning the start position:
* use aligned byte index to calculate character index rather than
the unadjusted byte
When aligning the end position:
* do not adjust the end byte if it falls on a UTF-8 codepoint
* align byte to the first byte of the next codepoint rather than the
last byte of the current codepoint
* compute character character end range on the aligned byte index
This commit also adds additional test coverage, including multibyte operations
that previously failed before this commit.
The on_exit handler provided to the client configuration is called after
the client's context is cleared (e.g. which buffers the client was
attached to). Calling the handler sooner allows these handlers to access
the client object and do their own cleanup with the full context.
Line number and column are required and much of the diagnostic API
assumes that these are both present. When one of the two is missing,
cryptic errors pop up in other parts of the diagnostic subsystem.
Instead, assert that diagnostics are well formed when they are entered
into the cache, which provides a clearer error.
When buffer is visible in two splits simultaneously, BufHidden event is
not triggered, causing the floating window to remain on screen after
switching to another buffer.
Remove BufHidden event from close_events defaults, and close the window
if we changed the buffer to something other than the buffer that spawned
the floating window or the floating window buffer itself.
Based on https://github.com/neovim/neovim/pull/14445
This extends `vim.treesitter.query.get_node_text` to return the text
that spans a node's range even if start_row ~= end_row.
Calling vim.lsp.buf.definition() sometimes gives a deprecation warning.
This will likely solve that.
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
The overwhelming majority of use cases for `open_float` are to view
diagnostics from the current buffer in a floating window. Thus, most use
cases will just `0` or `nil` as the first argument, which makes the
argument effectively useless and wasteful.
In the cause of optimizing for the primary use case, make the `bufnr`
parameter an optional parameter in the options table. This still allows
using an alternative buffer for those that wish to do so, but makes the
"primary" use case much easier.
The old signature is preserved for backward compatibility, though it can
likely be fully deprecated at some point.
nvim_buf_get_extmark uses "end_row" rather than "end_line" in its
'details' dict, which means callers must modify the key names if they
want to re-use the information. Change the parameter name in
nvim_buf_set_extmark to "end_row" and use "end_line" as an alias
to make this more consistent.
Problem: Not easy to switch between prompt buffer and other windows.
Solution: Accept CTRL-W commands in Insert mode. Start and stop Insert mode
as one would expect.
6d41c78e35
Cherry-pick channel.txt change from:
d2f3a8b878
b_prompt_insert was already ported.