Commit Graph

26916 Commits

Author SHA1 Message Date
Jongwook Choi
0e7e25af20
refactor(lsp): add type annotation for lsp.Client.server_capabilities (#24925)
The class `lsp.Client` has a public member `server_capabilities`,
which is assumed to be non-nil once initialized, as documented in
`:help vim.lsp.client`. Due to the possibility that it may be nil
before initialization, `lsp.Client` was not having a proper lua type
annotations on the field `server_capabilities`.

Instead of having a nil `server_capabilities` until initialized in
the RPC response callback, we can have an initial value of empty table.
This CHANGES the behavior of the `server_capabilities` field in a way
that it is no longer `nil` until initialization. Note that, as
already documented, `server_capabilities` should never be nil when
it is once initialized and thus ready to be used in user configs.
2023-08-31 10:14:20 +02:00
Chris AtLee
c235959fd9
fix(lsp): only disable inlay hints / diagnostics if no other clients are connected (#24535)
This fixes the issue where the LspNotify handlers for inlay_hint /
diagnostics would end up refreshing all attached clients.

The handler would call util._refresh, which called
vim.lsp.buf_request, which calls the method on all attached clients.

Now util._refresh takes an optional client_id parameter, which is used
to specify a specific client to update.

This commit also fixes util._refresh's handling of the `only_visible`
flag. Previously if `only_visible` was false, two requests would be made
to the server: one for the visible region, and one for the entire file.

Co-authored-by: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com>
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2023-08-31 10:00:24 +02:00
Maria José Solano
ee56daebb6
fix(shada): update deleted marks (#24936)
Fix #4295
Close #16067

Co-authored-by: chentau <tchen1998@gmail.com>
2023-08-31 10:15:49 +08:00
David Moberg
67fba9affa
fix(runtime/tutor): don't try to close fold when there is none (#24953)
Problem: When double clicking a line starting with a #, the code assumes
there is a fold there and tries to close it, resulting in an error if
there isn't a fold.
Solution: Check foldlevel before performing "zc".
2023-08-31 09:18:39 +08:00
zeertzjq
839d919098
vim-patch:9.0.1825: wrong cursor position with virt text and 'linebreak' (#24957)
Problem:  Wrong cursor position with virtual text before a whitespace
          character and 'linebreak'.
Solution: Always set "col_adj" to "size - 1" and apply 'linebreak' after
          adding the size of 'breakindent' and 'showbreak'.

closes: vim/vim#12956

6e55e85f92

N/A patches:
vim-patch:9.0.1826: keytrans() doesn't translate recorded key typed in a GUI
2023-08-31 08:35:08 +08:00
zeertzjq
5d49542b56
vim-patch:9.0.1820: Rexx files may not be recognised (#24956)
Problem:  Rexx files may not be recognised
Solution: Add shebang detection and improve disambiguation of *.cls
	  files

closes: vim/vim#12951

e06afb7860

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-08-31 08:20:00 +08:00
zeertzjq
7914881356
vim-patch:9.0.1797: Vimball/Visual Basic filetype detection conflict (#24947)
Problem:  Vimball/Visual Basic filetype detection conflict
Solution: runtime(vb): Improve Vimball and Visual Basic detection logic

Only run Vimball Archiver's BufEnter autocommand on Vimball archives.
Fixes vim/vim#2694.

closes: vim/vim#12899

f97f6bbf56

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-08-31 07:44:33 +08:00
zeertzjq
6463116818
vim-patch:9.0.1807: runtime: crystal scripts not recognised (#24949)
Problem:  runtime: crystal scripts not recognised
Solution: Filetype detect Crystal scripts by shebang line

closes: vim/vim#12935

9b73902dbe

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-08-31 04:38:28 +08:00
zeertzjq
497cf996eb
vim-patch:9.0.1803: runtime(filetype): Add norg language detection (#24948)
runtime(filetype): Add norg markup language detection

closes: vim/vim#12913

03e44a1d70

Co-authored-by: NTBBloodbath <bloodbathalchemist@protonmail.com>
2023-08-31 04:38:01 +08:00
Christian Clason
b2c3e9c72e vim-patch:9d8ef7cc4340
runtime: cleanup :Sman command via the undo_ftplugin mechanism (vim/vim#12967)

Regards to @dkearns as noticed in
2ac708b548

9d8ef7cc43

Co-authored-by: Enno <Konfekt@users.noreply.github.com>
2023-08-30 18:46:52 +02:00
Hongbo Liu
670c7609c8
fix(filetype): make sure buffer is valid before call nvim_buf_call (#24922) 2023-08-30 10:14:58 -05:00
bfredl
bec13cfcaf
Merge pull request #24944 from bfredl/memline0
fix(api): nvim_buf_get_offset in a new buffer with zero or one lines
2023-08-30 13:14:29 +02:00
bfredl
b051b131f5 fix(api): nvim_buf_get_offset in a new buffer with zero or one lines
fixes #24930
2023-08-30 12:01:35 +02:00
Lewis Russell
f85aa2e67f fix(treesitter.c): improve comments on fenv usage 2023-08-30 10:50:07 +01:00
Christian Clason
62869da11c build(deps): bump luajit to HEAD - 41fb94def 2023-08-30 10:03:19 +02:00
Christian Clason
3fcd6da5b0 vim-patch:2ac708b54866
runtime(sh): Update ftplugin (vim/vim#12950)

Remove :Help command via the undo_ftplugin mechanism.

2ac708b548

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-08-30 09:55:24 +02:00
Christian Clason
c4c5178b8e vim-patch:a5eb6785efcc
runtime(doc): mention special case of i_CTRL-R_-

closes: vim/vim#12947

a5eb6785ef

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-30 09:55:24 +02:00
Christian Clason
88bf4204ef vim-patch:3ac2d3da5fdf
runtime(heex): Add HEEX comments to match_words in ftplugin (vim/vim#12957)

3ac2d3da5f

Co-authored-by: Jason King <jk@handle.it>
2023-08-30 09:55:24 +02:00
Jongwook Choi
da7178cbbf fix(builtin): fix incorrect optional fields for fn.sign_define
The field `icon` is not a mandatory field.
2023-08-30 07:51:26 +01:00
bfredl
97cfee39ee
Merge pull request #24926 from bfredl/tsfree
fix(treesitter): fix another TSNode:tree() double free
2023-08-29 17:34:07 +02:00
bfredl
50a03c0e99 fix(treesitter): fix another TSNode:tree() double free
Unfortunately the gc=false objects can refer to a dangling tree if the
gc=true tree was freed first. This reuses the same tree object as the
node itself is keeping alive via the uservalue of the node userdata.
(wrapped in a table due to lua 5.1 restrictions)
2023-08-29 11:35:46 +02:00
Christian Clason
ae7ab90159 vim-patch:0382f05dbd65
runtime: Set b:undo_indent where missing (vim/vim#12944)

0382f05dbd

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-08-29 11:32:46 +02:00
Christian Clason
0e3ea0a262 vim-patch:f937ab32a1ac
runtime: Set b:undo_ftplugin where missing (vim/vim#12943)

f937ab32a1

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-08-29 11:32:46 +02:00
nwounkn
6e45567b49
fix(treesitter): fix TSNode:tree() double free (#24796)
Problem: `push_tree`, every time its called for the same TSTree with
`do_copy=false` argument, creates a new userdata for it. Each userdata,
when garbage collected, frees the same TSTree C object.

Solution: Add flag to userdata, which indicates, should C object,
which userdata points to, be freed, when userdata is garbage collected.
2023-08-29 10:48:23 +02:00
bfredl
97badc9ac4
Merge pull request #24912 from bfredl/topline2
fix(api): better topline adjustments in nvim_buf_set_lines
2023-08-29 10:03:04 +02:00
Jaehwang Jung
ffb340bf63 fix(treesitter): update folds only once on InsertLeave
Problem:
With treesitter fold, InsertLeave can be slow, because a single session
of insert mode may schedule multiple fold updates in on_bytes and
on_changedtree.

Solution:
Don't create duplicate autocmds.
2023-08-29 10:02:02 +02:00
Christian Clason
009c84322d build(deps): bump luajit to HEAD - 83954100d 2023-08-29 09:42:18 +02:00
bfredl
0a81ec14a4 fix(api): better topline adjustments in nvim_buf_set_lines
Some more reasonable defaults for topline:
  - if topline was replaced with another line, that now becomes topline
  - if line was inserted just before topline, display it. This is more
    similar to the previous API behavior.
2023-08-29 09:26:15 +02:00
zeertzjq
794981d9be
vim-patch:9.0.1813: linebreak incorrect drawn with breakindent (#24917)
Problem: 'linebreak' is incorrectly drawn after 'breakindent'.
Solution: Don't include 'breakindent' size when already after it.

closes: vim/vim#12937
closes: vim/vim#12940

1d3e0e8f31
2023-08-29 09:36:55 +08:00
Amaan Qureshi
7c4d317a66 build(deps): bump tree-sitter to HEAD 2023-08-29 02:43:01 +09:00
Gregory Anders
cffdf102d4
feat(terminal): allow :terminal to take modifiers (#15427)
The following modifiers are all now supported:

    :tab term
    :vertical term
    :horizontal term
    :botright term
    :topleft term

Fixes: https://github.com/neovim/neovim/issues/11385
2023-08-28 07:22:19 -05:00
bfredl
1ad13e07d2
Merge pull request #24913 from bfredl/lastline
fix(api): handle clearing out last line of non-current buffer
2023-08-28 13:05:18 +02:00
bfredl
132bbd1cbd fix(api): handle clearing out last line of non-current buffer
fixes #24911
2023-08-28 12:39:02 +02:00
Christian Clason
3a876bd41b vim-patch:535b9e12d02f
runtime(typescript): Fix highlighting symbols after number literal (vim/vim#12911)

fixes vim/vim#12831

535b9e12d0

Co-authored-by: Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>
2023-08-28 11:03:37 +09:00
zeertzjq
656be8a591
vim-patch:9.0.1810: camel-case spelling has issues with digits (#24909)
Problem:  camel-case spelling has issues with digits
Solution: Improve the camCase spell checking by taking digits
          and caps into account

Rewrite the conditions to check for word boundaries by taking into
account the presence of digits and all-caps sequences such as acronyms.

closes: vim/vim#12644
closes: vim/vim#12933

d08745040b

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-08-28 07:16:15 +08:00
zeertzjq
6b12eda220
vim-patch:9.0.1798: The 'syntax' option has no completion. (#24908)
Problem:  The 'syntax' option has no completion.
Solution: Add syntax option completion.

closes: vim/vim#12900

6dfdff3f27

N/A patches:
vim-patch:9.0.1795: Indentation issues

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-08-28 07:07:50 +08:00
zeertzjq
d7d3d757c1
Merge pull request #24853 from zeertzjq/inline-virt-eol
fix(ui): wrong cursor position with left gravity inline virt text at eol
2023-08-28 06:36:51 +08:00
zeertzjq
062db5c136 vim-patch:9.0.1802: Multiline regex with Visual selection fails with virtual text
Problem:  Multiline regex with Visual selection fails when Visual
          selection contains virtual text after last char.
Solution: Only include virtual text after last char when getting full
          line length.

closes: vim/vim#12908

e3daa06be1
2023-08-28 06:10:36 +08:00
zeertzjq
c70aa84b2a vim-patch:9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Problem:  Cursor position still wrong with 'showbreak' and virtual text
          after last character or 'listchars' "eol".
Solution: Remove unnecessary w_wcol adjustment in curs_columns(). Also
          fix first char of virtual text not shown at the start of a screen
          line.

closes: vim/vim#12478
closes: vim/vim#12532
closes: vim/vim#12904

6a3897232a
2023-08-28 06:02:01 +08:00
zeertzjq
128091a256 fix(ui): wrong cursor position with left gravity inline virt text at eol 2023-08-28 05:51:01 +08:00
Lewis Russell
abb8c2c453 fix(editorconfig): do not set 'endofline'
Problem:
  'endofline' can be used to detect if a file ends of <EOL>, however
  editorconfig can break this.

Solution:
  Set 'endofline' during BufWritePre

Fixes: #24869
2023-08-27 19:27:25 +01:00
zhaozg
63802a1dbf docs: update luvref.txt for version info
fixup: #24874
2023-08-27 23:40:09 +09:00
Lewis Russell
a79694a08e feat(issue_template): instruct not to include a package manager 2023-08-27 13:22:05 +01:00
Lewis Russell
d3d7d763f3 feat(builtin): improve types 2023-08-27 13:07:04 +01:00
zeertzjq
1f49c98036
vim-patch:9.0.1792: problem with gj/gk/gM and virtual text (#24898)
Problem:  Normal mode "gM", "gj", "gk" commands behave incorrectly with
          virtual text.
Solution: Use linetabsize() instead of linetabsize_str().

closes: vim/vim#12909

d809c0a903
2023-08-27 20:04:44 +08:00
bfredl
4c69279f97
Merge pull request #24889 from bfredl/topline
fix(api): fix issues with nvim_buf_set_lines refactor
2023-08-27 13:56:20 +02:00
bfredl
840749d6c9 fix(undo): fix crash caused by checking undolevels in wrong buffer
fixes #24894
2023-08-27 12:08:11 +02:00
bfredl
9b9030ff2c fix(api): fix inconsistent behavior of topline touched in recent refactor
The change in #24824 0081549 was not a regression, however it was an
incomplete change. Unfortunately some common plugins come to depend on
this exising self-inconsistent behavior. These plugins are going to need
to update for 0.10

nvim_buf_set_lines used to NOT adjust the topline correctly if a buffer
was displayed in just one window. However, if displayed in multiple
windows, it was correctly adjusted for any window not deemed the
current window for the buffer (which could be an arbitrary choice if the
buffer was not already current, as noted in the last rafactor)

This fixes so that all windows have their topline adjusted. The added
tests show this behavior, which should be the reasonable one.
2023-08-27 12:07:46 +02:00
Maria José Solano
b7d5b55f74
fix(types): add some return/parameter type annotations (#24867)
* fix(types): add some return/parameter type annotations

* fix(types): narrow stdpath parameter further
2023-08-27 09:41:32 +01:00
Maria José Solano
2bf3e82676 fix(treesitter): validate window before updating preview highlights 2023-08-27 09:40:26 +01:00