Skip to content

Commit

Permalink
PATCH (#4)
Browse files Browse the repository at this point in the history
* version bump

* docs: news neovim#28773

* perf(treesitter): use child_containing_descendant() in has-ancestor? (neovim#28512)

Problem: `has-ancestor?` is O(n²) for the depth of the tree since it iterates over each of the node's ancestors (bottom-up), and each ancestor takes O(n) time.
This happens because tree-sitter's nodes don't store their parent nodes, and the tree is searched (top-down) each time a new parent is requested.

Solution: Make use of new `ts_node_child_containing_descendant()` in tree-sitter v0.22.6 (which is now the minimum required version) to rewrite the `has-ancestor?` predicate in C to become O(n).

For a sample file, decreases the time taken by `has-ancestor?` from 360ms to 6ms.

* feat: remove deprecated features

Remove following functions:
- vim.lsp.util.extract_completion_items
- vim.lsp.util.get_progress_messages
- vim.lsp.util.parse_snippet()
- vim.lsp.util.text_document_completion_list_to_complete_items
- LanguageTree:for_each_child
- health#report_error
- health#report_info
- health#report_ok
- health#report_start
- health#report_warn
- vim.health.report_error
- vim.health.report_info
- vim.health.report_ok
- vim.health.report_start
- vim.health.report_warn

* fix(version): fix vim.version().prerelease

fixes neovim#28782 (when backported)

* fix: extend the life of vim.tbl_flatten to 0.13

`vim.iter(t):flatten():totable()` doesn't handle nil so isn't a good
enough replacement.

* docs(gen_help_html.lua): handle modeline and note nodes

Problem:

'modeline' and 'note' are unhandled in the online HTML documentation.

Some (not all) modelines are parsed by the vimdoc parser as a node of
type 'modeline'.

Solution:

- Ignore 'modeline' in HTML rendering.
- Render 'note' text in boldface.

* fix(health): broken ruby detect neovim#28804

* fix(path): avoid chdir() when resolving path (neovim#28799)

Use uv_fs_realpath() instead.

It seems that uv_fs_realpath() has some problems on non-Linux platforms:
- macOS and other BSDs: this function will fail with UV_ELOOP if more
  than 32 symlinks are found while resolving the given path.  This limit
  is hardcoded and cannot be sidestepped.
- Windows: while this function works in the common case, there are a
  number of corner cases where it doesn't:
  - Paths in ramdisk volumes created by tools which sidestep the Volume
    Manager (such as ImDisk) cannot be resolved.
  - Inconsistent casing when using drive letters.
  - Resolved path bypasses subst'd drives.

Ref: https://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_realpath

I don't know if the old implementation that uses uv_chdir() and uv_cwd()
also suffers from the same problems.
- For the ELOOP case, chdir() seems to have the same limitations.
- On Windows, Vim doesn't use anything like chdir() either. It uses
  _wfullpath(), while libuv uses GetFinalPathNameByHandleW().

* feat(api): broadcast events to ALL channels neovim#28487

Problem:
`vim.rpcnotify(0)` and `rpcnotify(0)` are documented as follows:

    If {channel} is 0, the event is broadcast to all channels.

But that's not actually true. Channels must call `nvim_subscribe` to
receive "broadcast" events, so it's actually "multicast".

- Assuming there is a use-case for "broadcast", the current model adds
  an extra step for broadcasting: all channels need to "subscribe".
- The presence of `nvim_subscribe` is a source of confusion for users,
  because its name implies something more generally useful than what it
  does.

Presumably the use-case of `nvim_subscribe` is to avoid "noise" on RPC
channels not expected a broadcast notification, and potentially an error
if the channel client reports an unknown event.

Solution:
- Deprecate `nvim_subscribe`/`nvim_unsubscribe`.
  - If applications want to multicast, they can keep their own multicast
    list. Or they can use `nvim_list_chans()` and `nvim_get_chan_info()`
    to enumerate and filter the clients they want to target.
- Always send "broadcast" events to ALL channels. Don't require channels
  to "subscribe" to receive broadcasts. This matches the documented
  behavior of `rpcnotify()`.

* vim-patch:9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'

Problem:  Unable to leave long line with 'smoothscroll' and 'scrolloff'.
          Corrupted screen near the end of a long line with 'scrolloff'.
          (Ernie Rael, after 9.1.0280)
Solution: Only correct cursor in case scroll_cursor_bot() was not itself
          called to make the cursor visible. Avoid adjusting for
          'scrolloff' beyond the text line height (Luuk van Baal)

vim/vim@b32055e

vim-patch:9.1.0416: some screen dump tests can be improved

Problem:  some screen dump tests can be improved (after 9.1.0414)
Solution: Make sure screen state changes properly and is captured in the
          screen dumps (Luuk van Baal)

vim/vim@2e64273

* fix(vim.iter): enable optimizations for arrays (lists with holes) (neovim#28781)

The optimizations that vim.iter uses for array-like tables don't require
that the source table has no holes. The only thing that needs to change
is the determination if a table is "list-like": rather than requiring
consecutive, integer keys, we can simply test for (positive) integer
keys only, and remove any holes in the original array when we make a
copy for the iterator.

* ci: change label `backport` to `target:release`

`backport` is too similar `ci:backport release-x.y` and causes
confusion.

* fix(move): half-page scrolling with resized grid at eob (neovim#28821)

* vim-patch:9.1.0418: Cannot move to previous/next rare word (neovim#28822)

Problem:  Cannot move to previous/next rare word
          (Colin Kennedy)
Solution: Add the ]r and [r motions (Christ van Willegen)

fixes: vim/vim#14773
closes: vim/vim#14780

vim/vim@8e4c4c7

Co-authored-by: Christ van Willegen - van Noort <[email protected]>

* vim-patch:cf78d0df51f2

runtime(sshdconfig): add basic ftplugin file for sshdconfig (vim/vim#14790)

vim/vim@cf78d0d

Co-authored-by: Yinzuo Jiang <[email protected]>

* vim-patch:94043780196c (neovim#28831)

runtime(matchparen): fix :NoMatchParen not working (vim/vim#14797)

fixes: neovim#28828

vim/vim@9404378

* refactor(path.c): add nonnull attributes (neovim#28829)

This possibly fixes the coverity warning.

* refactor!: remove `nvim` and `provider` module for checkhealth

The namespacing for healthchecks for neovim modules is inconsistent and
confusing. The completion for `:checkhealth` with `--clean` gives

```
nvim
provider.clipboard
provider.node
provider.perl
provider.python
provider.ruby
vim.lsp
vim.treesitter
```

There are now three top-level module names for nvim: `nvim`, `provider`
and `vim` with no signs of stopping. The `nvim` name is especially
confusing as it does not contain all neovim checkhealths, which makes it
almost a decoy healthcheck.

The confusion only worsens if you add plugins to the mix:

```
lazy
mason
nvim
nvim-treesitter
provider.clipboard
provider.node
provider.perl
provider.python
provider.ruby
telescope
vim.lsp
vim.treesitter
```

Another problem with the current approach is that it's not easy to run
nvim-only healthchecks since they don't share the same namespace. The
current approach would be to run `:che nvim vim.* provider.*` and would
also require the user to know these are the neovim modules.

Instead, use this alternative structure:

```
vim.health
vim.lsp
vim.provider.clipboard
vim.provider.node
vim.provider.perl
vim.provider.python
vim.provider.ruby
vim.treesitter
```

and

```
lazy
mason
nvim-treesitter
telescope
vim.health
vim.lsp
vim.provider.clipboard
vim.provider.node
vim.provider.perl
vim.provider.python
vim.provider.ruby
vim.treesitter
```

Now, the entries are properly sorted and running nvim-only healthchecks
requires running only `:che vim.*`.

* fix(diagnostic): show backtrace for deprecation warnings

Problem: On nvim 11.0-dev, deprecation warnings due to an use of
hard-deprecated APIs such as:
- `vim.diagnostic.disable()`
- `vim.diagnostic.is_disabled()`
etc. are not accompanied by backtrace information. It makes difficult
for users to figure out which lines or which plugins are still using
deprecated APIs.

Solution: use `backtrace = true` in vim.deprecate() call.

* vim-patch:df859a36d390

runtime(sql): set commentstring for sql files in ftplugin

closes: vim/vim#14800

vim/vim@df859a3

Co-authored-by: Riley Bruins <[email protected]>

* vim-patch:36e974fdf3f5

runtime(graphql): basic ftplugin file for graphql

closes: vim/vim#14801

vim/vim@36e974f

Co-authored-by: Riley Bruins <[email protected]>

* vim-patch:4d7892bfb1db

runtime(dart): add basic dart ftplugin file

fixes vim/vim#14793
closes vim/vim#14802

vim/vim@4d7892b

Co-authored-by: Riley Bruins <[email protected]>

* vim-patch:9.1.0421: filetype: hyprlang files are not recognized

Problem:  filetype: hyprlang files are not recognized
Solution: recognize 'hypr{land,paper,idle,lock}.conf' files
          as 'hyprlang' filetype, add hyprlang ftplugin
          (Riley Bruins)

closes: vim/vim#14803

vim/vim@5f1b115

Co-authored-by: Riley Bruins <[email protected]>

* Update CMakeLists.txt

* Create health.lua

---------

Co-authored-by: Justin M. Keyes <[email protected]>
Co-authored-by: vanaigr <[email protected]>
Co-authored-by: dundargoc <[email protected]>
Co-authored-by: bfredl <[email protected]>
Co-authored-by: Lewis Russell <[email protected]>
Co-authored-by: Jongwook Choi <[email protected]>
Co-authored-by: MoonFruit <[email protected]>
Co-authored-by: zeertzjq <[email protected]>
Co-authored-by: Luuk van Baal <[email protected]>
Co-authored-by: Gregory Anders <[email protected]>
Co-authored-by: Christ van Willegen - van Noort <[email protected]>
Co-authored-by: Christian Clason <[email protected]>
Co-authored-by: Yinzuo Jiang <[email protected]>
Co-authored-by: Riley Bruins <[email protected]>
  • Loading branch information
15 people committed May 20, 2024
1 parent 671073e commit ac0fabe
Show file tree
Hide file tree
Showing 51 changed files with 1,136 additions and 980 deletions.
40 changes: 0 additions & 40 deletions runtime/autoload/health.vim

This file was deleted.

18 changes: 0 additions & 18 deletions runtime/doc/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1461,24 +1461,6 @@ nvim_strwidth({text}) *nvim_strwidth()*
Return: ~
Number of cells

nvim_subscribe({event}) *nvim_subscribe()*
Subscribes to event broadcasts.

Attributes: ~
|RPC| only

Parameters: ~
{event} Event type string

nvim_unsubscribe({event}) *nvim_unsubscribe()*
Unsubscribes to event broadcasts.

Attributes: ~
|RPC| only

Parameters: ~
{event} Event type string

nvim__complete_set({index}, {opts}) *nvim__complete_set()*
EXPERIMENTAL: this API may change in the future.

Expand Down
114 changes: 63 additions & 51 deletions runtime/doc/deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,82 @@ They should not be used in new scripts, and old scripts should be updated.
==============================================================================
Deprecated features

DEPRECATED IN 0.10 *deprecated-0.10*
------------------------------------------------------------------------------
DEPRECATED IN 0.11 *deprecated-0.11*

API
- nvim_subscribe() Plugins must maintain their own "multicast" channels list.
- nvim_unsubscribe() Plugins must maintain their own "multicast" channels list.

• Configuring |diagnostic-signs| using |:sign-define| or |sign_define()|. Use
the "signs" key of |vim.diagnostic.config()| instead.

• Checkhealth functions:
- *health#report_error* *vim.health.report_error()* Use |vim.health.error()| instead.
- *health#report_info* *vim.health.report_info()* Use |vim.health.info()| instead.
- *health#report_ok* *vim.health.report_ok()* Use |vim.health.ok()| instead.
- *health#report_start* *vim.health.report_start()* Use |vim.health.start()| instead.
- *health#report_warn* *vim.health.report_warn()* Use |vim.health.warn()| instead.

|API| functions:
- *nvim_buf_get_option()* Use |nvim_get_option_value()| instead.
- *nvim_buf_set_option()* Use |nvim_set_option_value()| instead.
- *nvim_call_atomic()* Use |nvim_exec_lua()| instead.
- *nvim_get_option()* Use |nvim_get_option_value()| instead.
- *nvim_set_option()* Use |nvim_set_option_value()| instead.
- *nvim_win_get_option()* Use |nvim_get_option_value()| instead.
- *nvim_win_set_option()* Use |nvim_set_option_value()| instead.
------------------------------------------------------------------------------
DEPRECATED IN 0.10 *deprecated-0.10*

API
*nvim_buf_get_option()* Use |nvim_get_option_value()| instead.
*nvim_buf_set_option()* Use |nvim_set_option_value()| instead.
*nvim_call_atomic()* Use |nvim_exec_lua()| instead.
*nvim_get_option()* Use |nvim_get_option_value()| instead.
*nvim_set_option()* Use |nvim_set_option_value()| instead.
*nvim_win_get_option()* Use |nvim_get_option_value()| instead.
*nvim_win_set_option()* Use |nvim_set_option_value()| instead.

CHECKHEALTH
*health#report_error* *vim.health.report_error()* Use |vim.health.error()| instead.
*health#report_info* *vim.health.report_info()* Use |vim.health.info()| instead.
*health#report_ok* *vim.health.report_ok()* Use |vim.health.ok()| instead.
*health#report_start* *vim.health.report_start()* Use |vim.health.start()| instead.
*health#report_warn* *vim.health.report_warn()* Use |vim.health.warn()| instead.

DIAGNOSTICS
• Configuring |diagnostic-signs| using |:sign-define| or |sign_define()|. Use
the "signs" key of |vim.diagnostic.config()| instead.
• vim.diagnostic functions:
- *vim.diagnostic.disable()* Use |vim.diagnostic.enable()|
- *vim.diagnostic.is_disabled()* Use |vim.diagnostic.is_enabled()|
- Legacy signature: `vim.diagnostic.enable(buf:number, namespace:number)`

• vim.lsp functions:
- *vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| instead.
- *vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()| instead.
- *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()| instead.
- *vim.lsp.util.trim_empty_lines()* Use |vim.split()| with `trimempty` instead.
- *vim.lsp.util.try_trim_markdown_code_blocks()*
- *vim.lsp.util.set_lines()*
- *vim.lsp.util.extract_completion_items()*
- *vim.lsp.util.parse_snippet()*
- *vim.lsp.util.text_document_completion_list_to_complete_items()*
- *vim.lsp.util.lookup_section()* Use |vim.tbl_get()| instead: >
*vim.diagnostic.disable()* Use |vim.diagnostic.enable()|
*vim.diagnostic.is_disabled()* Use |vim.diagnostic.is_enabled()|
Legacy signature: `vim.diagnostic.enable(buf:number, namespace:number)`

LSP
*vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| instead.
*vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()| instead.
*vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()| instead.
*vim.lsp.util.trim_empty_lines()* Use |vim.split()| with `trimempty` instead.
*vim.lsp.util.try_trim_markdown_code_blocks()*
*vim.lsp.util.set_lines()*
*vim.lsp.util.extract_completion_items()*
*vim.lsp.util.parse_snippet()*
*vim.lsp.util.text_document_completion_list_to_complete_items()*
*vim.lsp.util.lookup_section()* Use |vim.tbl_get()| instead: >
local keys = vim.split(section, '.', { plain = true })
local vim.tbl_get(table, unpack(keys))
LUA
*vim.loop* Use |vim.uv| instead.
*vim.tbl_add_reverse_lookup()*
*vim.tbl_flatten()* Use |Iter:flatten()| instead.
*vim.tbl_islist()* Use |vim.islist()| instead.

• vim.treesitter functions:
- *LanguageTree:for_each_child()* Use |LanguageTree:children()| (non-recursive) instead.

OPTIONS
• The "term_background" UI option |ui-ext-options| is deprecated and no longer
populated. Background color detection is now performed in Lua by the Nvim
core, not the TUI.

• Lua stdlib:
- *vim.tbl_add_reverse_lookup()*
- *vim.tbl_flatten()* Use |Iter:flatten()| instead.
- *vim.tbl_islist()* Use |vim.islist()| instead.

DEPRECATED IN 0.9 *deprecated-0.9*
TREESITTER
*LanguageTree:for_each_child()* Use |LanguageTree:children()| (non-recursive) instead.

• vim.treesitter functions
- *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()| instead.
- *vim.treesitter.get_node_at_pos()* Use |vim.treesitter.get_node()| instead.
- *vim.treesitter.get_node_at_cursor()* Use |vim.treesitter.get_node()|
and |TSNode:type()| instead.

|API| functions:
- *nvim_get_hl_by_name()* Use |nvim_get_hl()| instead.
- *nvim_get_hl_by_id()* Use |nvim_get_hl()| instead.
------------------------------------------------------------------------------
DEPRECATED IN 0.9 *deprecated-0.9*

API
- *nvim_get_hl_by_name()* Use |nvim_get_hl()| instead.
- *nvim_get_hl_by_id()* Use |nvim_get_hl()| instead.

TREESITTER
- *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()| instead.
- *vim.treesitter.get_node_at_pos()* Use |vim.treesitter.get_node()| instead.
- *vim.treesitter.get_node_at_cursor()* Use |vim.treesitter.get_node()|
and |TSNode:type()| instead.
• The following top level Treesitter functions have been moved:
- *vim.treesitter.inspect_language()* -> |vim.treesitter.language.inspect()|
- *vim.treesitter.get_query_files()* -> |vim.treesitter.query.get_files()|
Expand All @@ -94,10 +104,12 @@ DEPRECATED IN 0.9 *deprecated-0.9*
- *vim.treesitter.query.get_range()* -> |vim.treesitter.get_range()|
- *vim.treesitter.query.get_node_text()* -> |vim.treesitter.get_node_text()|

• Lua stdlib:
LUA
- *nvim_exec()* Use |nvim_exec2()| instead.
- *vim.pretty_print()* Use |vim.print()| instead.


------------------------------------------------------------------------------
DEPRECATED IN 0.8 OR EARLIER

API
Expand Down
9 changes: 5 additions & 4 deletions runtime/doc/lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3830,6 +3830,7 @@ chained to create iterator "pipelines": the output of each pipeline stage is
input to the next stage. The first stage depends on the type passed to
`vim.iter()`:
• List tables (arrays, |lua-list|) yield only the value of each element.
• Holes (nil values) are allowed.
• Use |Iter:enumerate()| to also pass the index to the next stage.
• Or initialize with ipairs(): `vim.iter(ipairs(…))`.
• Non-list tables (|lua-dict|) yield both the key and value of each element.
Expand Down Expand Up @@ -4287,9 +4288,9 @@ Iter:totable() *Iter:totable()*
Collect the iterator into a table.

The resulting table depends on the initial source in the iterator
pipeline. List-like tables and function iterators will be collected into a
list-like table. If multiple values are returned from the final stage in
the iterator pipeline, each value will be included in a table.
pipeline. Array-like tables and function iterators will be collected into
an array-like table. If multiple values are returned from the final stage
in the iterator pipeline, each value will be included in a table.

Examples: >lua
vim.iter(string.gmatch('100 20 50', '%d+')):map(tonumber):totable()
Expand All @@ -4302,7 +4303,7 @@ Iter:totable() *Iter:totable()*
-- { { 'a', 1 }, { 'c', 3 } }
<

The generated table is a list-like table with consecutive, numeric
The generated table is an array-like table with consecutive, numeric
indices. To create a map-like table with arbitrary keys, use
|Iter:fold()|.

Expand Down

0 comments on commit ac0fabe

Please sign in to comment.