Commit Graph

21737 Commits

Author SHA1 Message Date
Gregory Anders
2a62bec37c feat(fs): add vim.fs.dir()
This function is modeled after the path.dir() function from Penlight and
the luafilesystem module.
2022-05-31 13:04:41 -06:00
Gregory Anders
b740709431 feat(fs): add vim.fs.basename() 2022-05-31 13:04:41 -06:00
Gregory Anders
c5526a27c3 feat(fs): add vim.fs.dirname() 2022-05-31 13:04:41 -06:00
Gregory Anders
67cbaf58c4 feat(fs): add vim.fs.parents()
vim.fs.parents() is a Lua iterator that returns the next parent
directory of the given file or directory on each iteration.
2022-05-31 13:04:40 -06:00
Javier Lopez
e6652821bd
refactor(checkhealth)!: rename to vim.health, move logic to Lua #18720
- Complete function:
  There was lots of unnecessary C code for the complete function, therefore
  moving it to Lua and use all the plumbing we have in place to retrieve the
  results.
- Moving the module:
  It's important we keep nvim lua modules name spaced, avoids conflict with
  plugins, luarocks, etc.
2022-05-31 11:10:18 -07:00
bfredl
7380ebfc17
Merge pull request #18194 from famiu/feat/usercmd_preview
feat: user command "preview" (like inccommand)
2022-05-31 17:44:13 +02:00
Famiu Haque
46536f53e8 feat: add preview functionality to user commands
Adds a Lua-only `preview` flag to user commands which allows the command to be incrementally previewed like `:substitute` when 'inccommand' is set.
2022-05-31 20:55:05 +06:00
Gregory Anders
5d840fa7e6
Merge pull request #18219 from kessejones/filetype-lua
feat(filetype): add more filetype patterns to Lua
2022-05-31 07:58:51 -06:00
zeertzjq
0c95028688
vim-patch:8.2.5046: vim_regsub() can overwrite the destination (#18812)
Problem:    vim_regsub() can overwrite the destination.
Solution:   Pass the destination length, give an error when it doesn't fit.
4aaf3e7f4d
2022-05-31 19:55:04 +08:00
Chris Kipp
1a20aed3fb
fix(lsp): include cancellable in progress message table (#18809)
Currently the `title`, `message` and `percentage` is stored for a
progress, but there is also an optional `cancellable` that comes in with
both the `WorkDoneProgressBegin` and also `WorkDoneProgressReport`. This
change also stores that value so that a plugin can access it when they
do a lookup in `client.messages`.
2022-05-31 13:19:45 +02:00
Christian Clason
bfc85eab12
build(deps): bump Luv to HEAD - 02d703b42 (#18808) 2022-05-31 10:58:30 +02:00
dundargoc
b7d70de345
docs(dev-style): remove rules covered by uncrustify #18767
Uncrustify is the source of truth where possible.
See also https://github.com/neovim/neovim/pull/18563
2022-05-30 17:48:25 -07:00
Christian Clason
b66e9e0baa feat(filetype): convert more patterns to filetype.lua 2022-05-30 20:32:35 -03:00
Christian Clason
d092e377c4 test(oldtest): disable legacy detect for filetype.lua 2022-05-30 20:32:35 -03:00
zeertzjq
d404d68c92
docs: clarify that nvim_strwidth counts control characters as one cell (#18802) 2022-05-31 07:06:34 +08:00
bfredl
b5dd562e08 fix(docs): correct obsolete note about 'writedelay' in dev docs 2022-05-31 00:20:10 +02:00
Justin M. Keyes
f6e19e7334
fix(logging): skip recursion, fix crash #18764
Problem:
1. The main log routine does not protect itself against recursion.
   log_lock() doesn't guard against recursion, it would deadlock...
2. 22b52dd462 (#11501) regressed 6f27f5ef91 (#10172), because
   set_init_1..process_spawn tries to log (see backtrace below), but the
   mutex isn't initialized yet. Even if the mutex were valid, we don't
   want early logging to fallback to stderr because that can break
   embedders when stdio is used for RPC.

    frame 1: 0x00000001001d54f4 nvim`open_log_file at log.c:205:7
    frame 2: 0x00000001001d5390 nvim`logmsg(log_level=1, context="UI: ", func_name=0x0000000000000000, line_num=-1, eol=true, fmt="win_viewport") at log.c:150:20
    frame : 0x000000010039aea2 nvim`ui_call_win_viewport(grid=2, win=1000, topline=0, botline=1, curline=0, curcol=0, line_count=1) at ui_events_call.generated.h:321:3
    frame 4: 0x00000001003dfefc nvim`ui_ext_win_viewport(wp=0x0000000101816400) at window.c:939:5
    frame 5: 0x00000001003ec5b4 nvim`win_ui_flush at window.c:7303:7
    frame 6: 0x00000001003a04c0 nvim`ui_flush at ui.c:508:3
    frame 7: 0x00000001002966ba nvim`do_os_system(argv=0x0000600000c0c000, input=0x0000000000000000, len=0, output=0x0000000000000000, nread=0x00007ff7bfefe830, silent=false, forward_output=false) at shell.c:894:3
    frame 8: 0x0000000100295f68 nvim`os_call_shell(cmd="unset nonomatch; vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >/var/folders/gk/3tttv_md06987tlwpyp62jrw0000gn/T/nvimwwvwfD/0 ~foo", opts=kShellOptExpand | kShellOptSilent | kShellOptHideMess, extra_args=0x0000000000000000) at shell.c:663:18
    frame 9: 0x0000000100295845 nvim`call_shell(cmd="unset nonomatch; vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >/var/folders/gk/3tttv_md06987tlwpyp62jrw0000gn/T/nvimwwvwfD/0 ~foo", opts=kShellOptExpand | kShellOptSilent | kShellOptHideMess, extra_shell_arg=0x0000000000000000) at shell.c:712:14
    frame 10: 0x0000000100294c6f nvim`os_expand_wildcards(num_pat=1, pat=0x00007ff7bfefeb20, num_file=0x00007ff7bfefee58, file=0x00007ff7bfefee60, flags=43) at shell.c:328:7
    ...
    frame 23: 0x000000010028ccef nvim`expand_env_esc(srcp=",~foo", dst="~foo", dstlen=4094, esc=false, one=false, prefix=0x0000000000000000) at env.c:673:17
    frame 24: 0x000000010026fdd5 nvim`option_expand(opt_idx=29, val=",~foo") at option.c:1950:3
    frame 25: 0x000000010026f129 nvim`set_init_1(clean_arg=false) at option.c:558:19
    frame 26: 0x00000001001ea25e nvim`early_init(paramp=0x00007ff7bfeff5f0) at main.c:198:3
    frame 27: 0x00000001001ea6bf nvim`main(argc=1, argv=0x00007ff7bfeff848) at main.c:255:3

Solution:
1. Check for recursion, show "internal error" message.
    - FUTURE: when "remote TUI" is merged, can we remove log_lock()?
2. Skip logging if log_init wasn't called yet.
2022-05-30 13:07:33 -07:00
bfredl
8427da9299
Merge pull request #18798 from bfredl/doublehash
refactor(api): use hashy hash for looking up api method and event names
2022-05-30 20:09:51 +02:00
kylo252
e86901eb68
docs(clang-format): one space in directives indent (#18800)
PPIndentWidth
The number of columns to use for indentation of preprocessor statements.
When set to -1 (default) IndentWidth is used also for preprocessor statements.
2022-05-30 23:49:11 +08:00
bfredl
1f63052b68 refactor(api): use hashy hash for looking up api method and event names
This avoids generating khash tables at runtime, and is consistent with
how evalfuncs lookup work.
2022-05-30 14:11:01 +02:00
James McCoy
e9803e1de6
Merge pull request #18789 from dundargoc/ci/api-docs/run-in-drafts
ci(api-docs): run in drafts as well
2022-05-29 09:51:18 -04:00
bfredl
ebad151a2a
Merge pull request #18792 from famiu/feat/nvim_create_user_command/smods
feat(api): pass structured modifiers to commands
2022-05-29 15:23:51 +02:00
zeertzjq
d4bb15af52
test: add tests for inccommand with c_CTRL-R_= and c_CTRL-\_e (#18796) 2022-05-29 20:52:53 +08:00
zeertzjq
015656abd7
fix(winbar): set w_winrow_off when initializing firstwin size (#18793) 2022-05-29 16:26:55 +08:00
zeertzjq
6d30efddb7
test(job_spec): remove Xtest_jobstart_env log file 2022-05-29 15:40:59 +08:00
Famiu Haque
9988d2f214 feat(nvim_create_user_command): pass structured modifiers to commands
Adds an `smods` key to `nvim_create_user_command` Lua command callbacks,
which has command modifiers but in a structured format. This removes the
need to manually parse command modifiers. It also reduces friction in
using `nvim_cmd` inside a Lua command callback.
2022-05-29 10:52:30 +06:00
dundargoc
f31a10204c
ci(uncrustify): show diff on failure #18780
This will make it possible to see what needs to be fixed without having
uncrustify installed locally.
2022-05-28 17:00:25 -07:00
zeertzjq
772ae3e656
vim-patch:8.2.5037: cursor position may be invalid after "0;" range (#18782)
Problem:    Cursor position may be invalid after "0;" range.
Solution:   Check the cursor position when it was set by ";" in the range.
4d97a565ae
2022-05-29 07:00:18 +08:00
Dundar Goc
39613b6a2d ci(api-docs): run in drafts as well
A contributor should be able to be sure their PR passes the CI before
clicking "Ready for review".
2022-05-29 00:55:12 +02:00
James McCoy
840b7576e9
Merge pull request #18786 from jamessan/latest-ci
ci: use ubuntu-latest for vim-patches and coverity-scan
2022-05-28 14:43:47 -04:00
James McCoy
a3df012845
ci: use ubuntu-latest for vim-patches and coverity-scan
Since we're not running tests or other things that are more sensitive to
changes in the VM environment, use ubuntu-latest to avoid the busy work
of updating the VM image.
2022-05-28 14:22:42 -04:00
Javier Lopez
f914b4e7a8
test: fixeol cleanup created files #18785
The async nature of feed_command caused a race condition on the calls
to delete, leaving the files on the root of the repo. Just use os.remove
and no need to wipeout.
2022-05-28 10:34:18 -07:00
Justin M. Keyes
c43e2874c0 fix(vim-patch.sh)
In scripts/vim-patch.sh line 335:
      printf '
             ^-- SC2183 (warning): This format string has 4 variables, but is passed 3 arguments.

    In scripts/vim-patch.sh line 597:
      list_missing_vimpatches 1 "$@" | while read -r vim_commit; do
                                                     ^--------^ SC2030 (info): Modification of vim_commit is local (to subshell caused by pipeline)

    In scripts/vim-patch.sh line 626:
      done < <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "${vim_commit}" -- . ':!src/version.c')
                                                                                   ^-----------^ SC2031 (info): vim_commit was modified in a subshell. That change might be lost.

    For more information:
      https://www.shellcheck.net/wiki/SC2183 -- This format string has 4 variable...
      https://www.shellcheck.net/wiki/SC2030 -- Modification of vim_commit is loc...
      https://www.shellcheck.net/wiki/SC2031 -- vim_commit was modified in a subs...
2022-05-28 10:30:03 -07:00
Lewis Russell
eab4d03a32
fix(treesitter): offset directive associates range with capture (#18276)
Previously the `offset!` directive populated the metadata in such a way
that the new range could be attributed to a specific capture. #14046
made it so the directive simply stored just the new range in the
metadata and information about what capture the range is based from is
lost.

This change reverts that whilst also correcting the docs.
2022-05-28 19:22:18 +02:00
zeertzjq
081eb72a80
refactor(regexp_nfa.c): match where Vim calls fopen() (#18778) 2022-05-28 19:26:19 +08:00
bfredl
0dd3798dbb
Merge pull request #18776 from famiu/fix/winbar_noroom
fix(winbar): only allow adding winbar when there is space
2022-05-28 12:18:04 +02:00
Famiu Haque
9cf1ac0377 fix(winbar): only allow adding winbar when there is space 2022-05-28 15:29:56 +06:00
dundargoc
1b235fe6ca
docs(options): move all removed options to vim_diff.txt (#18770)
It's more consistent to gather all removed options in one spot rather
than spreading it out.
2022-05-28 16:42:56 +08:00
zeertzjq
77d9c672f8
fix(winbar): fix winbar disappear or glitch when moving a split (#18775) 2022-05-28 15:12:42 +08:00
Jun-ichi TAKIMOTO
285e738942
test(unit): use setup()/teardown() in buffer_spec.lua (#18739) 2022-05-28 10:14:12 +08:00
Famiu Haque
826462a8f0
fix(ui): require window-local value to show winbar on floating windows (#18773)
Previously, there was a bug where setting the local value of 'winbar' to
itself would cause winbar to appear on a floating window, which is
undesirable. This fix makes it so that it's explicitly required for the
window-local value of 'winbar' for a floating window to be set in order
for winbar to be shown on that window.
2022-05-28 06:57:20 +08:00
zeertzjq
e2940d3c79
vim-patch:8.2.5024: using freed memory with "]d" (#18762)
Problem:    Using freed memory with "]d".
Solution:   Copy the pattern before searching.
e2fa213cf5
2022-05-27 05:59:05 +08:00
bfredl
30915cc8b0
Merge pull request #18306 from lewis6991/fnfast
feat(lua): allow some viml functions to run in fast
2022-05-26 15:03:07 +02:00
zeertzjq
497046466e
Merge pull request #17742 from dundargoc/doxygen/normal
refactor(normal): convert function comments to doxygen format
2022-05-26 18:55:56 +08:00
Mathias Fußenegger
e8ada41b63
feat(lsp): turn rename filter into a predicate (#18745)
Same as https://github.com/neovim/neovim/pull/18458 but for rename
2022-05-26 12:28:50 +02:00
Dundar Göc
ec1bd06e10 refactor(normal): convert function comments to doxygen format 2022-05-26 10:16:41 +02:00
kylo252
7b952793d5
refactor: missing parenthesis may cause unexpected problems (#17443)
related vim-8.2.{4402,4639}
2022-05-26 10:49:25 +08:00
zeertzjq
f246a929e7
Merge pull request #18738 from zeertzjq/vim-8.2.5010
vim-patch:8.2.5010: the terminal debugger uses various global variables
2022-05-26 08:08:35 +08:00
dundargoc
068fb748e1
vim-patch:8.2.5015: Hoon and Moonscript files are not recognized (#18747)
Problem:    Hoon and Moonscript files are not recognized.
Solution:   Add filetype patterns. (Goc Dundar, closes vim/vim#10478)
bf82df0dd4
2022-05-25 18:07:58 -06:00
zeertzjq
ec48c6f236 vim-patch:8.2.5010: the terminal debugger uses various global variables
Problem:    The terminal debugger uses various global variables.
Solution:   Add a dictionary to hold the terminal debugger preferences.
c9a431c763

Omit popup menu.
2022-05-26 07:47:00 +08:00