Commit Graph

3286 Commits

Author SHA1 Message Date
Stephan Seitz
c194acbfc4
feat(treesitter): add query_linter from nvim-treesitter/playground (#22784)
Co-authored-by: clason <clason@users.noreply.github.com>
Co-authored-by: lewis6991 <lewis6991@users.noreply.github.com>
2023-04-29 18:22:26 +02:00
zeertzjq
4bcf8c15b3 vim-patch:8.2.0578: heredoc for interfaces does not support "trim"
Problem:    Heredoc for interfaces does not support "trim".
Solution:   Update the script heredoc support to be same as the :let command.
            (Yegappan Lakshmanan, closes vim/vim#5916)

6c2b7b8055
2023-04-29 09:20:52 +08:00
zeertzjq
715587f8e4
vim-patch:8.2.3509: undo file is not synced (#23371)
Problem:    Undo file is not synced. (Sami Farin)
Solution:   Sync the undo file if 'fsync' is set. (Christian Brabandt,
            closes vim/vim#8879, closes vim/vim#8920)

340dd0fbe4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-28 21:07:00 +08:00
Lewis Russell
eb4676c67f
fix: disallow removing extmarks in on_lines callbacks (#23219)
fix(extmarks): disallow removing extmarks in on_lines callbacks

decor_redraw_start (which runs before decor_providers_invoke_lines) gets
references for the extmarks on a specific line. If these extmarks are
deleted in on_lines callbacks then this results in a heap-use-after-free
error.

Fixes #22801
2023-04-27 17:30:22 +01:00
Christian Clason
4b3fdf321c
docs(lsp): remove obsolete lsp-extension example (#23346)
This example is made obsolete by the addition of `vim.lsp.start()` and
`vim.fs` (whose use is already documented in `:h lsp-quickstart`).
2023-04-27 13:05:26 +02:00
bfredl
45bcf83869 refactor(build): include lpeg as a library 2023-04-27 11:40:00 +02:00
zeertzjq
191e8b4062
vim-patch:9.0.1485: no functions for converting from/to UTF-16 index (#23318)
Problem:    no functions for converting from/to UTF-16 index.
Solution:   Add UTF-16 flag to existing funtions and add strutf16len() and
            utf16idx(). (Yegappan Lakshmanan, closes vim/vim#12216)

67672ef097

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-26 09:50:37 +08:00
zeertzjq
8af97ecefa
vim-patch:8.2.3314: behavior of exists() in a :def function is unpredictable (#23317)
Problem:    Behavior of exists() in a :def function is unpredictable.
Solution:   Add exists_compiled().

267359902c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-26 08:37:22 +08:00
Gregory Anders
cacc2dc419
Merge pull request #23303 from gpanders/more-vim-iter
Create iter_spec and vim.iter module
2023-04-25 09:17:46 -06:00
ii14
7e70ca0b48
feat(lua): vim.keycode (#22960)
Using nvim_replace_termcodes is too verbose, add vim.keycode for
translating keycodes.

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2023-04-25 16:52:44 +02:00
Gregory Anders
1e73891d69 refactor(iter): move helper functions under vim.iter
vim.iter is now both a function and a module (similar to vim.version).
2023-04-25 08:23:16 -06:00
zeertzjq
bfa92d3861
vim-patch:8.2.5019: cannot get the first screen column of a character (#23312)
Problem:    Cannot get the first screen column of a character.
Solution:   Let virtcol() optionally return a list. (closes vim/vim#10482,
            closes vim/vim#7964)

0f7a3e1de6

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-04-25 22:22:26 +08:00
zeertzjq
43c49746d9
vim-patch:9.0.0335: checks for Dictionary argument often give a vague error (#23309)
Problem:    Checks for Dictionary argument often give a vague error message.
Solution:   Give a useful error message. (Yegappan Lakshmanan, closes vim/vim#11009)

04c4c5746e

Cherry-pick removal of E922 from docs from patch 9.0.1403.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-25 21:32:12 +08:00
Christian Clason
e3f36377c1
vim-patch:71badf9547e8 (#23285)
Update runtime files

71badf9547

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-23 15:22:55 +02:00
T727
d9f78b6336
docs(powershell): use tee.exe instead of Tee-Object
Problem: Tee-Object does not create a file if it does not receive input
for example when :grep does not find matches.
and so nvim tries to open a nonexistent errorfile causing an error.

Solution: use tee.exe instead of Tee-Object
2023-04-22 12:04:05 +02:00
Jon Huhn
e9b85acfbb
feat(lsp): enable workspace/didChangeWatchedFiles by default (#23190) 2023-04-22 09:37:38 +02:00
Gregory Anders
0ad5237162
Merge pull request #23198 from gpanders/iter-fix
fix(iter): allow table values in iterator pipelines
2023-04-19 08:23:42 -06:00
Gregory Anders
9489406879 fix(iter): remove special case totable for map-like tables
This was originally meant as a convenience but prevents possible
functionality. For example:

  -- Get the keys of the table with even values
  local t = { a = 1, b = 2, c = 3, d = 4 }
  vim.iter(t):map(function(k, v)
    if v % 2 == 0 then return k end
  end):totable()

The example above would not work, because the map() function returns
only a single value, and cannot be converted back into a table (there
are many such examples like this).

Instead, to convert an iterator into a map-like table, users can use
fold():

  vim.iter(t):fold({}, function(t, k, v)
    t[k] = v
    return t
  end)
2023-04-19 07:52:04 -06:00
zeertzjq
85c61d6716 vim-patch:9.0.1007: there is no way to get a list of swap file names
Problem:    There is no way to get a list of swap file names.
Solution:   Add the swapfilelist() function.  Use it in the test script to
            clean up.  Remove deleting individual swap files.

c216a7a21a

vim-patch:9.0.1005: a failed test may leave a swap file behind

Problem:    A failed test may leave a swap file behind.
Solution:   Delete the swap file to avoid another test to fail.  Use another
            file name.

d0f8d39d20

Cherry-pick test_window_cmd.vim changes from patch 8.2.1593.
Remove FUNC_ATTR_UNUSED from eval functions as fptr is always unused.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-19 11:29:35 +08:00
Gregory Anders
ab1edecfb7
feat(lua): add vim.iter (#23029)
vim.iter wraps a table or iterator function into an `Iter` object with
methods such as `filter`, `map`, and `fold` which can be chained to
produce iterator pipelines that do not create new tables at each step.
2023-04-17 12:54:19 -06:00
Isak Samsten
07b60efd80
feat(diagnostic): specify diagnostic virtual text prefix as a function
- vim.diagnostic.config() now accepts a function for the virtual_text.prefix
  option, which allows for rendering e.g., diagnostic severities differently.
2023-04-17 12:53:34 +01:00
zeertzjq
79a6933768 vim-patch:partial:6f4754b9f725
Update runtime files

6f4754b9f7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-17 15:46:24 +08:00
zeertzjq
f39b33ee49 vim-patch:9.0.0411: only created files can be cleaned up with one call
Problem:    Only created files can be cleaned up with one call.
Solution:   Add flags to mkdir() to delete with a deferred function.
            Expand the writefile() name to a full path to handle changing
            directory.

6f14da15ac

vim-patch:8.2.3742: dec mouse test fails without gnome terminfo entry

Problem:    Dec mouse test fails without gnome terminfo entry.
Solution:   Check if there is a gnome entry. Also fix 'acd' test on
            MS-Windows. (Dominique Pellé, closes vim/vim#9282)

f589fd3e10

Cherry-pick test_autochdir.vim changes from patch 9.0.0313.
Cherry-pick test_autocmd.vim changes from patch 9.0.0323.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
335bef0c21 vim-patch:9.0.0390: cannot use a partial with :defer
Problem:    Cannot use a partial with :defer.
Solution:   Add the partial arguments before the other arguments.  Disallow
            using a dictionary.

86d87256c4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
0167649ce4 vim-patch:9.0.0379: cleaning up after writefile() is a hassle
Problem:    Cleaning up after writefile() is a hassle.
Solution:   Add the 'D' flag to defer deleting the written file.  Very useful
            in tests.

806a273f3c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:41 +08:00
zeertzjq
b75634e55e vim-patch:9.0.0370: cleaning up afterwards can make a function messy
Problem:    Cleaning up afterwards can make a function messy.
Solution:   Add the :defer command.

1d84f7608f

Omit EX_EXPR_ARG: Vim9 script only.
Make :def throw E319 to avoid confusing behavior.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 15:04:40 +08:00
zeertzjq
68ca16c376 vim-patch:8.2.3783: confusing error for using a variable as a function
Problem:    Confusing error for using a variable as a function.
Solution:   If a function is not found but there is a variable, give a more
            useful error. (issue vim/vim#9310)

2ef9156b42

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 10:15:15 +08:00
zeertzjq
f4d3e279e8 vim-patch:8.2.2977: crash when using a null function reference
Problem:    Crash when using a null function reference. (Naohiro Ono)
Solution:   Check for an invalid function name. (closes vim/vim#8367)

22db0d549f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-16 10:15:15 +08:00
dundargoc
c08b030761
refactor: deprecate checkhealth functions
The following functions are deprecated and will be removed in
Nvim v0.11:

- health#report_start()
- health#report_info()
- health#report_ok()
- health#report_warn()
- health#report_error()
- vim.health.report_start()
- vim.health.report_info()
- vim.health.report_ok()
- vim.health.report_warn()
- vim.health.report_error()

Users should instead use these:

- vim.health.start()
- vim.health.info()
- vim.health.ok()
- vim.health.warn()
- vim.health.error()
2023-04-15 23:40:48 +02:00
zeertzjq
e9b4f51051 vim-patch:9.0.0303: it is not easy to get information about a script
Problem:    It is not easy to get information about a script.
Solution:   Make getscriptinf() return the version.  When selecting a specific
            script return functions and variables. (Yegappan Lakshmanan,
            closes vim/vim#10991)

2f892d8663

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-15 21:06:17 +08:00
zeertzjq
bcc971de15 vim-patch:9.0.0269: getscriptinfo() does not include the version
Problem:    getscriptinfo() does not include the version.  Cannot select
            entries by script name.
Solution:   Add the "version" item and the "name" argument. (Yegappan
            Lakshmanan, closes vim/vim#10962)

520f6ef60a

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-15 21:06:16 +08:00
zeertzjq
57221e0d11 vim-patch:b59ae59a5870
Update runtime files

b59ae59a58

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 19:13:58 +08:00
zeertzjq
9f1d333072 vim-patch:3f32a5f1601a
Update runtime files and translations

3f32a5f160

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 19:05:58 +08:00
zeertzjq
f2a9097d76 vim-patch:partial:d899e5112079
Update runtime files

d899e51120

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-15 19:02:52 +08:00
zeertzjq
bacb5021d4 vim-patch:8.2.4883: string interpolation only works in heredoc
Problem:    String interpolation only works in heredoc.
Solution:   Support interpolated strings.  Use syntax for heredoc consistent
            with strings, similar to C#. (closes vim/vim#10327)

2eaef106e4

Cherry-pick Test_Debugger_breakadd_expr() from Vim.

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-04-15 17:59:32 +08:00
zeertzjq
3ad8c08acc vim-patch:8.2.4770: cannot easily mix expression and heredoc
Problem:    Cannot easily mix expression and heredoc.
Solution:   Support  in heredoc. (Yegappan Lakshmanan, closes vim/vim#10138)

efbfa867a1

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-04-15 17:40:31 +08:00
zeertzjq
e36806666f
vim-patch:8.2.2138: Vim9: "exit_cb" causes Vim to exit (#23087)
Problem:    Vim9: "exit_cb" causes Vim to exit.
Solution:   Require white space after a command in Vim9 script. (closes vim/vim#7467)
            Also fix that Vim9 style heredoc was not always recognized.

b5b9480ee9

Omit EX_NONWHITE_OK, E1143, E1144: Vim9 script only.
Cherry-pick test_vimscript.vim changes from patch 8.2.2141.
Cherry-pick E1145 tag from Vim runtime.

N/A patches for version.c:

vim-patch:8.2.2140: build failure with tiny features

Problem:    Build failure with tiny features.
Solution:   Add #ifdef.

2a3cd3af45

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 20:35:46 +08:00
zeertzjq
d6e2804ab4 vim-patch:8.2.1794: no falsy Coalescing operator
Problem:    No falsy Coalescing operator.
Solution:   Add the "??" operator.  Fix mistake with function argument count.

92f26c256e

Cherry-pick tv2bool() into eval/typval.c.
Cherry-pick *??* tag from Vim runtime.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-14 18:04:09 +08:00
NAKAI Tsuyoshi
7caf0eafd8
feat(lua)!: add stricter vim.tbl_islist() and rename old one to vim.tbl_isarray() (#16440)
feat(lua)!: add stricter vim.tbl_islist(), rename vim.tbl_isarray()

Problem: `vim.tbl_islist` allows gaps in tables with integer keys
("arrays").

Solution: Rename `vim.tbl_islist` to `vim.tbl_isarray`, add new
`vim.tbl.islist` that checks for consecutive integer keys that start
from 1.
2023-04-14 12:01:08 +02:00
Christian Clason
4d04feb662
feat(lua): vim.tbl_contains supports general tables and predicates (#23040)
* feat(lua): vim.tbl_contains supports general tables and predicates

Problem: `vim.tbl_contains` only works for list-like tables (integer
keys without gaps) and primitive values (in particular, not for nested
tables).

Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new
`vim.tbl_contains` that works for general tables and optionally allows
`value` to be a predicate function that is checked for every key.
2023-04-14 10:39:57 +02:00
bfredl
231e1988ed
Merge pull request #23054 from bfredl/nobehave
feat(ex_cmds)!: remove :behave
2023-04-13 12:39:05 +02:00
bfredl
e4a136f713 feat(ex_cmds)!: remove :behave
just use the individual options instead.

   set selection=exclusive
   set selectmode=mouse,key
   set mousemodel=popup
   set keymodel=startsel,stopsel
2023-04-13 12:15:30 +02:00
zeertzjq
1013aba462
docs: add vim.lsp.buf.formatting_sync() to deprecated.txt (#23045) 2023-04-12 22:52:06 +08:00
dundargoc
2b35de386e
refactor: remove :CheckHealth
Using :CheckHealth invokes an error, and many of the features from :checkhealth
doesn't even work such as calling only a specific check. Users should use
:checkhealth instead.
2023-04-12 00:01:34 +02:00
dundargoc
880f7d12fe
feat!: remove vimballs (#22402)
Vimball is an outdated feature that is rarely used these days. It is not
a maintenance burden on its own, but it is nonetheless dead weight and
something we'd need to tell users to ignore when they inevitably ask
what it is.

See: https://github.com/neovim/neovim/pull/21369#issuecomment-1347615173
2023-04-11 19:10:36 +02:00
NAKAI Tsuyoshi
9e86f473e0
feat(lua): vim.region accepts getpos() arg (#22635) 2023-04-11 16:28:46 +02:00
bfredl
436e0147f4
Merge pull request #22865 from MunifTanjim/issue-20370
fix(api): do not re-apply win_config.style when missing
2023-04-10 14:29:23 +02:00
Munif Tanjim
da979ae04b fix(api): do not re-apply win_config.style when missing 2023-04-10 16:26:42 +06:00
Evgeni Chasnovski
99c86bae15
docs: add hl-DiagnosticDeprecated and hl-DiagnosticUnnecessary 2023-04-08 20:19:39 +03:00
zeertzjq
747264320c
refactor(mappings)!: remove #n as a notation for a function key (#17318)
This notation is hardly used and makes the behavior of the from_part
argument of nvim_replace_termcodes confusing.
2023-04-08 20:29:23 +08:00