Commit Graph

3875 Commits

Author SHA1 Message Date
Michael Lingelbach
6db2155032 feat(lsp): add buf_detach_client
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.
2021-12-21 09:17:04 -08:00
Rishikesh Vaishnav
9625832372
fix(lsp): fix nil-index behavior for UTF-8 in _str_*index_enc methods (#16731)
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).
2021-12-20 08:54:05 -08:00
Michael Lingelbach
d6b939a13f
fix(lsp): avoid attaching to unloaded buffers (#16723)
Closes https://github.com/neovim/neovim/issues/16562 https://github.com/neovim/neovim/issues/16249 https://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
2021-12-19 12:49:56 -08:00
Christian Clason
ff1b0f632a
vim-patch:8.2.3843: dep3patch files are not recognized (#16700)
Problem:    Dep3patch files are not recognized.
Solution:   Recognize dep3patch files by their location and content. (James
            McCoy, closes vim/vim#9367)
647ab4cede
2021-12-18 17:22:09 +01:00
matveyt
734fba0d88
feat(runtime): new checkhealth filetype (#16660) 2021-12-18 09:14:42 -07:00
Gregory Anders
36758ba9a7
autocmd: RecordingEnter, RecordingLeave (#16684) 2021-12-18 08:55:43 -07:00
Thomas Vigouroux
684c782546 docs(autocmd): update docs to match implementation
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
2021-12-18 08:54:07 -07:00
Thomas Vigouroux
8a4e26c6fe feat(autocmd): add Recording autocmds
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.
2021-12-18 10:54:26 +01:00
Gregory Anders
818ae74eaf
fix(diagnostic): respect "if_many" source option for virtual text (#16653)
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".
2021-12-17 19:38:33 -07:00
Rishikesh Vaishnav
36c401db24
fix(lsp): correctly align start and end range to codepoints during incremental sync (#16670)
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.
2021-12-17 18:05:00 -08:00
Gregory Anders
6a92a53c02
fix(lsp): call config on_exit handler before context is cleared (#16638)
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.
2021-12-17 12:06:44 -08:00
Christian Clason
b1757e1c29
vim-patch:0e6adf8a29d5 (#16682)
Update runtime files
0e6adf8a29
2021-12-16 21:46:13 +01:00
Gregory Anders
80210c189f
refactor(diagnostic): remove hack (#16685)
No longer required since #16548.
2021-12-16 12:13:30 -07:00
Gregory Anders
b515160cef
fix(diagnostic): assert that diagnostics have line number and column (#16683)
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.
2021-12-16 11:20:18 -07:00
Hitarth Thummar
4218b7079e
docs(options): mention how to disable inccommand preview (#16534)
Co-authored-by: Hitarth Thumma
2021-12-15 22:41:24 +01:00
github-actions[bot]
4393360796
docs: regenerate (#16468)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-12-15 08:19:54 -07:00
Christian Clason
cf65071e2e
vim-patch:8.2.3814: .csx files and .sln files are not recognized (#16662)
Problem:    .csx files and .sln files are not recognized.
Solution:   Add filetype patterns. (Doug Kearns)
cfabad9bcf
2021-12-15 16:10:03 +01:00
ii14
576408ddde
fix(ui): close floating window on BufLeave event (#16557)
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.
2021-12-15 07:53:09 -07:00
Christian Clason
cc4c8e7af6
vim-patch:8.2.3805: i3config files are not recognized (#16645)
Problem:    i3config files are not recognized.
Solution:   Add patterns to match i3config files. (Quentin Hibon,
            closes vim/vim#7969)
8176be1598
2021-12-14 14:01:37 +01:00
Lewis Russell
6e6c36ca5b feat(treesitter): multiline match predicates 2021-12-12 12:16:42 +00:00
Mathias Fußenegger
1f3c0593eb
feat(ts): add support for multiline nodes in get_node_text (#14999)
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.
2021-12-12 12:05:39 +01:00
Mathias Fußenegger
3aff3d6349
fix(docs): add bufnr and user_data to diagnostic-structure (#16619) 2021-12-11 16:59:16 +01:00
zeertzjq
53c95ccd1b
docs(vim_diff.txt): document SearchWrapped (#16612) 2021-12-10 15:04:11 -07:00
dundargoc
2a9aadd09b
refactor: replace deprecated lua functions with their new versions (#16603)
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>
2021-12-10 13:20:30 -07:00
Koichi Shiraishi
63528f4686
runtime: support once on s:GetAutocmdPrefix (#16457)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2021-12-10 12:28:55 -07:00
Alejandro Exojo
8ad6015409
feat: add autocommand event when search wraps around (#8487) 2021-12-10 12:28:25 -07:00
Rishikesh Vaishnav
22d7dd2aec
fix(lsp): create lsp requests with position offsets considering client encoding (#16382)
Co-authored-by: black-desk <clx814727823@gmail.com>
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2021-12-10 15:17:50 +01:00
James McCoy
ac2d140a33
Merge pull request #16541 from jamessan/vim-8.2.3664
vim-patch:8.2.3664,8.2.3743,8.2.3747,8.2.3748,8.2.3757
2021-12-09 21:29:15 -05:00
Christian Clason
8e64b21fed
vim-patch:8.2.3769: zig files are not recognized (#16598)
Problem:    Zig files are not recognized.
Solution:   Add *.zig. (Gregory Anders, closes vim/vim#9313)
4c8c634365
2021-12-09 22:03:25 +01:00
James McCoy
2fe60905f6
Merge pull request #16582 from dundargoc/docs/remove-redundant-help-files
docs: remove redundant help files
2021-12-09 09:23:18 -05:00
Gregory Anders
6063e07a0f
fix(diagnostic): set effective buffer number in autocmd (again) (#16589)
Follow up to #16474.
2021-12-08 21:13:47 -07:00
James McCoy
e9051d965e
vim-patch:partial 6304be625ce4
Update runtime files.
6304be625c

Remaining changes left out of 03d250eb45
2021-12-08 21:47:59 -05:00
James McCoy
e8f9262125
vim-patch:8.2.3664: cannot adjust sign highlighting for 'cursorline'
Problem:    Cannot adjust sign highlighting for 'cursorline'.
Solution:   Add CursorLineSign and CursorLineFold highlight groups.
            (Gregory Anders, closes vim/vim#9201)
e413ea04b7
2021-12-08 21:47:58 -05:00
Gregory Anders
be84529190
refactor(diagnostic): remove bufnr parameter from open_float (#16579)
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.
2021-12-08 18:44:31 -07:00
Dundar Göc
fb0399aacc docs: remove redundant help files 2021-12-08 19:48:51 +01:00
Gregory Anders
c096561041
docs(lsp): fix resolve_capabilities docstring (#16577) 2021-12-08 11:01:07 -07:00
dundargoc
e5f691baef
docs: update missing help sections from main help page (#16573)
Also replace non-existent help section remote.txt to remote_plugins.txt
2021-12-08 09:56:11 -07:00
dundargoc
c4d70dae80
refactor(diagnostic): add warning to deprecated functions (#16536) 2021-12-08 08:47:19 -07:00
Gregory Anders
cf32053d60
fix(api): allow nvim_buf_set_extmark to accept end_row key (#16548)
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.
2021-12-08 08:44:48 -07:00
Jan Edmund Lazo
5abd7c2c14
Merge pull request #16421 from seandewar/vim-8.1.0035
vim-patch:8.1.{35,42,64},8.2.{1781,1783,1976,2014,3671}
2021-12-07 21:17:12 -05:00
Gregory Anders
a2db756206
refactor(lsp): remove usage of deprecated function (#16539) 2021-12-07 10:25:21 -07:00
Anshuman Medhi
f99f3d9052
feat(lsp): use vim.ui.select for selecting lsp client (#16531) 2021-12-07 18:09:43 +01:00
Sean Dewar
28134f4e78
vim-patch:8.1.0035: not easy to switch between prompt buffer and other windows
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.
2021-12-07 11:34:24 +00:00
Jan Edmund Lazo
afaad8b54e
Merge pull request #16194 from seandewar/vim-8.1.1925
vim-patch:7.4.1777,8.1.{1925,1995,2011,2012,2013,2166},8.2.{0532,0871,1168,1241,3576}
2021-12-07 01:14:21 -05:00
Jan Edmund Lazo
18d81a6724
Merge pull request #16107 from zeertzjq/vim-8.1.1542
vim-patch:8.1.1542,8.2.3549: an OptionSet autocommand does not get enough info
2021-12-06 22:35:05 -05:00
Christian Clason
0a3826646f
vim-patch:4700398e384f (#16538)
Update runtime files
4700398e38

partial skip:
doc/sign.txt
doc/various.txt
doc/motion.txt
2021-12-06 13:55:38 +01:00
Gregory Anders
4306b395de
refactor: format diagnostic.lua (#16540) 2021-12-05 19:42:31 -07:00
Matthew Toohey
62f0157853
fix(diagnostic): escape special chars in file names (#16527)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2021-12-05 19:39:00 -07:00
dundargoc
24f9463dd0
refactor: remove unused runtime lua functions (#16535) 2021-12-05 19:11:20 +01:00
Anshuman Medhi
9b65a7e064
docs(lsp): re-add client.requests documentation (#16530)
Closes #16528

Added in this PR: d1c470957b (diff-6b5f3071d65558aab177912061ac6a2f5312660655a449276c83697686f28e72R627)

Removed by regeneration in this PR: 2d340a3746 (diff-6b5f3071d65558aab177912061ac6a2f5312660655a449276c83697686f28e72L631)
2021-12-05 14:04:53 +01:00