Commit Graph

1454 Commits

Author SHA1 Message Date
Justin M. Keyes
e51139f5c1 refactor(vim.gsplit): remove "keepsep"
string.gmatch() is superior, use that instead.
2023-03-22 17:46:01 +01:00
Justin M. Keyes
8a70adbde0 fix(vim.version): prerelease compare
Problem:
semver specifies that digit sequences in a prerelease string should be
compared as numbers, not lexically: https://semver.org/#spec-item-11
> Precedence for two pre-release versions with the same major, minor,
> and patch version MUST be determined by comparing each dot separated
> identifier from left to right until a difference is found as follows:
> 1. Identifiers consisting of only digits are compared numerically.
> 2. Identifiers with letters or hyphens are compared lexically in ASCII sort order.
> 3. Numeric identifiers always have lower precedence than non-numeric identifiers.
> 4. A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal.
Example:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

Solution:
cmp_prerel() treats all digit sequences in a prerelease string as
numbers. This doesn't _exactly_ match the spec, which specifies that
only dot-delimited digit sequences should be treated as numbers...
2023-03-22 17:46:01 +01:00
Justin M. Keyes
9c49c10470 feat(vim.gsplit): gain features of vim.split
Problem:
- vim.split has more features than vim.gsplit.
- Cannot inspect the "separator" segments of vim.split or vim.gsplit.

Solution:
- Move common implementation from vim.split into vim.gsplit.
  - TODO: deprecate vim.split in favor of vim.totable(vim.gsplit())?
- Introduce `keepsep` parameter.

Related: 84f66909e4
2023-03-22 17:46:01 +01:00
Amaan Qureshi
48ce2ef912
vim-patch:9.0.{1419,1421,1422,1423}: some files are not recognized (#22749)
vim-patch:9.0.1419: Lean files are not recognized

Problem:    Lean files are not recognized.
Solution:   Add a pattern for Lean files. (Amaan Qureshi, closes vim/vim#12177)

4a5c39fc52

vim-patch:9.0.1421: Nu files are not recognized

Problem:    Nu files are not recognized.
Solution:   Add a pattern for Nu files. (Amaan Qureshi, closes vim/vim#12172)

8aa2a37f89

vim-patch:9.0.1422: Sage files are not recognized

Problem:    Sage files are not recognized.
Solution:   Add a pattern for Sage files. (Amaan Qureshi, closes vim/vim#12176)

d0639d717b

vim-patch:9.0.1423: WebAssembly Interface Type files are not recognized

Problem:    WebAssembly Interface Type files are not recognized.
Solution:   Add a pattern for WIT files. (Amaan Qureshi, closes vim/vim#12173)

890c772036
2023-03-22 16:19:56 +08:00
Christian Clason
0c9ed19af3 vim-patch:9.0.1417: ESDL files are not recognized
Problem:    ESDL files are not recognized.
Solution:   Add a pattern for ESDL files. (Amaan Qureshi, closes vim/vim#12174)

a1fa8b3ac2

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-03-20 21:08:31 +01:00
Christian Clason
d11986171b vim-patch:9.0.1415: Crystal files are not recognized
Problem:    Crystal files are not recognized.
Solution:   Add a pattern for Crystal files. (Amaan Qureshi, closes vim/vim#12175)

7c4516fe93

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-03-20 21:07:46 +01:00
Justin M. Keyes
a40eb7cc99 feat(vim.version): more coercion with strict=false
Problem:
"tmux 3.2a" (output from "tmux -V") is not parsed easily.

Solution:
With `strict=false`, discard everything before the first digit.

- rename Semver => Version
- rename vim.version.version() => vim.version._version()
- rename matches() => has()
- remove `opts` from cmp()
2023-03-20 13:40:38 +01:00
Justin M. Keyes
a715e6f87e refactor(vim.version): use lazy.nvim semver module
Now the Nvim version string "v0.9.0-dev-1233+g210120dde81e" parses
correctly.
2023-03-20 13:40:38 +01:00
Justin M. Keyes
990c481551 refactor(vim.version): use lazy.nvim semver module
Use semver code from https://github.com/folke/lazy.nvim
License: Apache License 2.0

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2023-03-20 13:36:55 +01:00
Lewis Russell
e5641df6d3 feat: add vim.filetype.get_option() 2023-03-20 10:06:32 +00:00
Amaan Qureshi
66ba81a6f7
vim-patch:9.0.1412: Pony files are not recognized (#22721)
Problem:    Pony files are not recognized.
Solution:   Add a pattern for Pony files. (Amaan Qureshi, closes vim/vim#12155)

6e377eca8d
2023-03-18 17:34:31 +08:00
Christian Clason
86c164d2a1
Merge pull request #22699 from clason/vim-9.0.1406
vim-patch:9.0.{1406,1407,1408,1409}: some files are not recognized
2023-03-17 13:40:15 +01:00
Yochem van Rosmalen
2720d2c793
fix(treesitter): InspectTree does not respect 'splitright' #22692
Problem:
vim.treesitter.inspect_tree() and :InspectTree does not respect 'splitright'.

Solution:
- Change the default `command` from `topleft 60vnew` to `60vnew`.
- Change :InspectTree to respect command mods (`:vertical`, count, etc.).

Closes #22656
2023-03-17 04:41:57 -07:00
August Masquelier
6162269fa3
fix(lsp): avoid switching buffers on lsp attach (#22689) 2023-03-17 12:26:13 +01:00
Christian Clason
571b50be16 vim-patch:9.0.1409: racket files are recognized as scheme
Problem:    Racket files are recognized as scheme.
Solution:   Recognize rackets files separately. (Gabriel Kakizaki,
            closes vim/vim#12164, closes vim/vim#12162)

d11ac403db

Co-authored-by: Gabriel Kakizaki <gkakizaki@gmail.com>
2023-03-17 10:06:56 +01:00
Christian Clason
f83d8ea279 vim-patch:9.0.1408: QMLdir files are not recognized
Problem:    QMLdir files are not recognized.
Solution:   Add a pattern for QMLdir files. (Amaan Qureshi, closes vim/vim#12161)

1505bef5c4

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-03-17 10:06:56 +01:00
Christian Clason
d7746b6ef1 vim-patch:9.0.1407: TableGen files are not recognized
Problem:    TableGen files are not recognized.
Solution:   Add a pattern for TableGen files. (Amaan Qureshi, closes vim/vim#12156)

b8ef029ee4

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-03-17 09:41:54 +01:00
Christian Clason
43d33c5d1a vim-patch:9.0.1406: ILE RPG files are not recognized
Problem:    ILE RPG files are not recognized.
Solution:   Add patterns for ILE RPG files. (Andreas Louv, issue vim/vim#12152)

e202ec8a0c

Co-authored-by: Andreas Louv <andreas@louv.dk>
2023-03-17 09:41:12 +01:00
Justin M. Keyes
210120dde8
fix(lua): vim.deprecate() shows ":help deprecated" #22677
Problem:
vim.deprecate() shows ":help deprecated" for third-party plugins. ":help
deprecated" only describes deprecations in Nvim, and is unrelated to any
3rd party deprecations.

Solution:
If `plugin` is specified, don't show  ":help deprecated".

fix #22235
2023-03-15 05:56:13 -07:00
Ivan
4f7879dff0
fix(lsp): kill buffers after renaming a directory #22618
Problem:

When LSP client renames a directory, opened buffers in the edfitor are not
renamed or closed. Then `:wall` shows errors.

https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L776
works correctly if you try to rename a single file, but doesn't delete old
buffers with `old_fname` is a dir.

Solution:
Update the logic in runtime/lua/vim/lsp/util.lua:rename()

Fixes #22617
2023-03-14 05:08:37 -07:00
hrsh7th
8dde7c907c
fix(lsp): vim.lsp.util.apply_text_edits cursor validation #22636
Problem
Using wrong variable when checking the cursor position is valid or not in
vim.lsp.util.apply_text_edits.

Solution
Use the correct variable.
2023-03-14 04:59:43 -07:00
Dan Strokirk
f01f18cdf4
fix(lsp): remove_workspace_folders fails if client has no workspace_folders #22633
When a client has no workspace_folders, (e.g., copilot), `pairs`
code would crash.
2023-03-13 06:01:34 -07:00
Christian Clason
4e99cc1217
Merge pull request #22627 from nullchilly/highlight-cleanup
refactor!: remove deprecated functions
2023-03-13 13:59:38 +01:00
Lewis Russell
35799a6629
fix(treesitter): foldexpr (#22652)
The ranges passed to foldinfo.remove_range were in the wrong order.
2023-03-13 10:44:43 +00:00
Justin M. Keyes
673d2b52fa refactor!: rename vim.pretty_print => vim.print
Problem:
The function name `vim.pretty_print`:
1. is verbose, which partially defeats its purpose as sugar
2. does not draw from existing precedent or any sort of convention
   (except external projects like penlight or python?), which reduces
   discoverability, and degrades signaling about best practices.

Solution:
- Rename to `vim.print`.
- Change the behavior so that
  1. strings are printed without quotes
  2. each arg is printed on its own line
  3. tables are indented with 2 instead of 4 spaces
- Example:
  :lua ='a', 'b', 42, {a=3}
  a
  b
  42
  {
    a = 3
  }

Comparison of alternatives:
- `vim.print`:
  - pro: consistent with Lua's `print()`
  - pro: aligns with potential `nvim_print` API function which will
    replace nvim_echo, nvim_notify, etc.
  - con: behaves differently than Lua's `print()`, slightly misleading?
- `vim.echo`:
  - pro: `:echo` has similar "pretty print" behavior.
  - con: inconsistent with Lua idioms.
- `vim.p`:
  - pro: very short, fits with `vim.o`, etc.
  - con: not as discoverable as "echo"
  - con: less opportunity for `local p = vim.p` because of potential shadowing.
2023-03-13 01:25:09 +01:00
Mathias Fußenegger
d15abd1be4
fix(lsp): use line start/end for visual line selection (#22632)
Fixes https://github.com/neovim/neovim/issues/22629
2023-03-12 09:45:28 +01:00
Lewis Russell
b55b8ddf81
Merge pull request #22613 from lewis6991/feat/tsqueryutil 2023-03-11 17:13:20 +00:00
Lewis Russell
58bbc2ea0b refactor(treesitter): add Range type aliase for Range4|Range6 2023-03-11 16:38:18 +00:00
Jaehwang Jung
0ce626b783
docs(lsp): more precise type annotations (#22621) 2023-03-11 14:50:53 +01:00
Mathias Fußenegger
23dc2a59b6
fix(lsp): send didClose on buffer rename (#22623)
Subset of https://github.com/neovim/neovim/pull/22407 that was reverted
in https://github.com/neovim/neovim/pull/22604

If a buffer is renamed sending `didClose` for the old buffer helps
ensure the language server doesn't keep a stale document in memory.
2023-03-11 14:50:14 +01:00
Raphael
865d8d4720
refactor(lsp): remove _resolve_capabilities_compat (#22628) 2023-03-11 14:49:53 +01:00
nullchilly
36ca082a11 refactor(health)!: remove deprecated health.lua 2023-03-11 17:59:26 +07:00
nullchilly
71eebd28d1 refactor(treesitter)!: remove deprecated show_tree func 2023-03-11 17:59:26 +07:00
nullchilly
c2f7f8d61c refactor(highlight)!: remove deprecated functions
vim.highlight.create/link
2023-03-11 17:59:06 +07:00
Mathias Fußenegger
236c20795e
revert: "fix(lsp): use buffer scheme for files not stored on disk" (#22604)
Although using `buffer://` for unsaved file buffers fixes issues with
language servers like eclipse.jdt.ls or ansible-language-server, it
breaks completion and signature help for clangd.

A regression is worse than a fix for something else, so this reverts
commit 896d672736.

The spec change is also still in dicussion, see
https://github.com/microsoft/language-server-protocol/pull/1679#discussion_r1130704886
2023-03-11 07:35:23 +01:00
Lewis Russell
9d70fe062c feat(treesitter)!: consolidate query util functions
- And address more type errors.
- Removed the `concat` option from `get_node_text` since it was applied
  inconsistently and made typing awkward.
2023-03-10 16:35:06 +00:00
Lewis Russell
762a06c6bc
feat!(treesitter): do not return changes from LanguageTree:parse()
Never return the changes an only notify them using the `on_changedtree`
callback.

It is not guaranteed for a plugin that it'll be the first one to call
`tree:parse()` and thus get the changes.

Closes #19915
2023-03-10 16:16:49 +00:00
Lewis Russell
845efb8e12
Merge pull request #22594 from lewis6991/perf/treefold 2023-03-10 13:35:07 +00:00
Null Chilly
75537768ef
perf(lsp): better binary search mid calculation in semantic token (#22607)
This commit replaces the usage of math.floor((lo + hi) / 2) with the faster and equivalent bit.rshift(lo + hi, 1) for calculating the midpoint in binary search.
2023-03-10 14:10:38 +01:00
Lewis Russell
46b73bf22c perf(treesitter): more efficient foldexpr 2023-03-10 11:51:33 +00:00
Lewis Russell
c5b9643bf1 fix(treesitter): better lang handling of get_parser() 2023-03-10 10:43:35 +00:00
Lewis Russell
adfa9de8eb fix(treesitter): do not error on empty filetype
Ignore instead
2023-03-10 10:41:19 +00:00
Jaehwang Jung
0ecb4d725e
docs(lsp): type annotation for lsp.client (#22509)
* Also fix newly found type mismatch.
* Note that it generates new warnings about using @private client
  methods. A proper fix would be to revamp the lsp client documentation
  altogether.
2023-03-09 21:17:08 +00:00
Amaan Qureshi
68aa2857dd
vim-patch:9.0.1393: Cairo files are not recognized (#22578)
Problem:    Cairo files are not recognized.
Solution:   Add a pattern for Cairo files. (Amaan Qureshi, closes vim/vim#12118)

ff226d49fe
2023-03-09 18:13:44 +01:00
Lewis Russell
ae263aff95
refactor(treesitter): use byte ranges from treesitter (#22589) 2023-03-09 16:09:39 +00:00
Michal Liszcz
9ef7297ef1
feat(lsp): overwrite omnifunc/tagfunc set by ftplugin #22267
Problem:
Some built-in ftplugins set omnifunc/tagfunc/formatexpr which causes
lsp.lua:set_defaults() to skip setup of defaults for those filetypes.
For example the C++ ftplugin has:
    omnifunc=ccomplete#Complete
          Last set from /usr/share/nvim/runtime/ftplugin/c.vim line 30
so the changes done in #95c65a6b221fe6e1cf91e8322e7d7571dc511a71
will always be skipped for C++ files.

Solution:
Overwrite omnifunc/tagfunc/formatexpr options that were set by stock
ftplugin.

Fixes #21001
2023-03-09 06:12:56 -08:00
Lewis Russell
be0461e3c2
fix(treesitter): is_in_node_range (#22582)
TS ranges are end column exclusive, so fix is_in_node_range
to account for that.
2023-03-08 23:45:43 +00:00
Amaan Qureshi
ae70e946ee
vim-patch:9.0.1395: Odin files are not recognized (#22580)
Problem:    Odin files are not recognized.
Solution:   Add a pattern for Odin files. (Amaan Qureshi, closes vim/vim#12122)

638388b8ef
2023-03-09 00:19:18 +01:00
Amaan Qureshi
6dd9770baf
vim-patch:9.0.1394: Unx Tal files are not recognized (#22579)
Problem:    Unx Tal files are not recognized.
Solution:   Add a pattern for Unx Tal files. (Amaan Qureshi, closes vim/vim#12117)

cde1f8714e
2023-03-09 00:19:10 +01:00
Lewis Russell
b9f19d3e28
Revert "refactor(treesitter): delegate region calculation to treesitter" (#22575)
Revert "refactor(treesitter): delegate region calculation to treesitter (#22553)"

This reverts commit 276b647fdb.
2023-03-08 17:59:45 +00:00