Commit Graph

4385 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
zeertzjq
eb623a1c45 docs: add missing termdebug docs from Vim runtime updates
388a5d4f20
4466ad6baa
6aa57295cf

Rename terminal.txt to nvim_terminal_emulator.txt in vim-patch.sh.
2022-05-26 07:47:00 +08:00
Gregory Anders
8c4e62351f
refactor(lsp): remove redundant client cleanup (#18744)
The client state is cleaned up both in client.stop() as well as in the
client.on_exit() handler. Technically, the client has not actually
stopped until the on_exit handler is called, so we should just do this
cleanup there and remove it from client.stop().
2022-05-25 11:45:45 -06:00
Mathias Fußenegger
fa3492c5f7
feat(lsp)!: turn format filter into predicate (#18458)
This makes the common use case easier.
If one really needs access to all clients, they can create a filter
function which manually calls `get_active_clients`.
2022-05-25 19:38:01 +02:00
Elton Leander Pinto
c6d6b8c7eb
fix(lsp): respect global syntax setting in open float preview (#15225) 2022-05-25 18:47:49 +02:00
bfredl
24352cba01
Merge pull request #18528 from lewis6991/setwinopt
feat(api): add `win` and `buf` to `nvim_set_option_value`
2022-05-25 17:05:28 +02:00
Daniel Steinberg
e5490b38b7
docs(api): floating wins omitted under :mksession (#18721) 2022-05-24 11:32:01 -06:00
notomo
5eaf9ef811
fix(filetype): correct vim.fn.did_filetype() handling (#18725) 2022-05-23 18:55:03 -06:00
dundargoc
a20892c4bc
vim-patch:partial 2d8ed0203aed (#18675)
* vim-patch:partial 2d8ed0203aed

Update runtime files.
2d8ed0203a

Skip:

runtime/doc/map.txt
runtime/doc/syntax.txt
runtime/doc/usr_51.txt
runtime/doc/usr_52.txt
runtime/syntax/help.vim
runtime/syntax/vim.vim

Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2022-05-23 23:49:38 +02:00
Famiu Haque
4c6626f03d
feat: click support for 'statusline', 'winbar' #18650
The mouseclick item "%@" is now supported by 'statusline' and 'winbar'.
Previously it was only supported by 'tabline'.
2022-05-23 06:11:24 -07:00
Gregory Anders
9e1ee9fb1d
refactor!: delete insertmode (#18547)
Neovim already removed `evim` (or any similar flags). The 'insertmode'
option is a weird remnant, so get rid of it.

The 'insertmode' option is replaced with a script that closely emulates
the option. This script is documented at :help 'insertmode'
2022-05-22 21:20:18 -06:00
Gregory Anders
378615b8ee
fix(lsp): do not detach LSP servers on Windows #18703
Detaching the process seems to have unintended side effects on Windows,
so only do it by default on non-Windows platforms.

Ref: https://github.com/neovim/nvim-lspconfig/issues/1907
Closes https://github.com/neovim/nvim-lspconfig/pull/1913
2022-05-22 12:21:44 -07:00
Jonas Strittmatter
52623ce935
refactor(runtime): convert the remaining dist#ft functions to lua (#18623) 2022-05-22 12:16:04 -06:00
dundargoc
8c2fd65bb1
build(clint): remove redundant checks #18698
Uncrustify is the source of truth where possible.
Remove any redundant checks from clint.py.
See also https://github.com/neovim/neovim/pull/18563
2022-05-22 10:59:56 -07:00
bfredl
7f6d2984a8
Merge pull request #18608 from ckipp01/extmarkDocs
docs(extmark): remove message about passing in id=0
2022-05-22 19:07:51 +02:00
dundargoc
2cab6bea09
docs: remove "Vi default" #18672
It's not relevant and clutters the documentation.
2022-05-22 04:38:59 -07:00
zeertzjq
5193b17839
vim-patch:8.2.4993: smart/C/lisp indenting is optional (#18684)
Problem:    smart/C/lisp indenting is optional, which makes the code more
            complex, while it only reduces the executable size a bit.
Solution:   Graduate FEAT_CINDENT, FEAT_SMARTINDENT and FEAT_LISP.
8e145b8246
2022-05-22 07:52:11 +08:00
dundargoc
976f32aa7a
refactor: add warnings for deprecated functions (#18662) 2022-05-21 09:51:03 +02:00
Fredrik Ekre
a4862cbb5f
fix(lsp): only send diagnostics from current buffer in code_action() (#18639)
Fix vim.lsp.buf.(range_)code_action() to only send diagnostics belonging
to the current buffer and not to other files in the workspace.
2022-05-20 13:11:23 +02:00
Christian Clason
d200ba654a
Merge pull request #18502 from drybalka/fix-languagetree-contains-description
treesitter: small improvements of languagetree.lua
2022-05-19 09:17:10 +02:00
Gregory Anders
6a2883c171
Merge pull request #18630 from dundargoc/refactor/remove-remap 2022-05-18 17:37:15 -06:00
Dundar Goc
97fc68850f refactor!: remove 'terse' option
Having two methods of setting the same option is redundant and can be
potentially confusing. Recommend adding 's' to 'shortmess' instead.
2022-05-19 00:15:40 +02:00
Dundar Goc
11957f51cc refactor!: remove 'remap' option
An option that should always be kept on except for when working with old
Vi scripts is of little use to us.
2022-05-19 00:15:36 +02:00
ckipp01
86db222469 docs(extmark): remove message about passing in id=0
The docs for `nvim_buf_set_extmark` mention that you can create a new
extmark when passing in `id=0`, however if you do this you'll get an
error since the code checks that id is positive.

```
id is not a positive integer
```

This change re-words the sentence to make it clearer.
2022-05-18 21:49:31 +02:00
Lewis Russell
3eea66d65a
feat(lsp): option to reuse_win for jump actions (#18577) 2022-05-18 21:03:24 +02:00
Denys
fec944142b
refactor: simple logic in tree_contains() 2022-05-18 19:28:49 +02:00
Denys
f66a60805d
docs: correct description of LanguageTree:contains() 2022-05-18 19:28:41 +02:00
Gregory Anders
ed93186ee2 feat(lsp): add filter to vim.lsp.get_active_clients()
Allow get_active_clients() to filter on client name, id, or buffer. This
(soft) deprecates lsp.buf_get_clients().
2022-05-18 11:21:00 -06:00
Gregory Anders
2ffafc7aa9 feat(lsp): add LspAttach and LspDetach autocommands
The current approach of using `on_attach` callbacks for configuring
buffers for LSP is suboptimal:

1. It does not use the standard Nvim interface for driving and hooking
   into events (i.e. autocommands)
2. There is no way for "third parties" (e.g. plugins) to hook into the
   event. This means that *all* buffer configuration must go into the
   user-supplied on_attach callback. This also makes it impossible for
   these configurations to be modular, since it all must happen in the
   same place.
3. There is currently no way to do something when a client detaches from
   a buffer (there is no `on_detach` callback).

The solution is to use the traditional method of event handling in Nvim:
autocommands. When a LSP client is attached to a buffer, fire a
`LspAttach`. Likewise, when a client detaches from a buffer fire a
`LspDetach` event.

This enables plugins to easily add LSP-specific configuration to buffers
as well as enabling users to make their own configurations more modular
(e.g. by creating multiple LspAttach autocommands that each do
something unique).
2022-05-18 11:21:00 -06:00
Gregory Anders
8a9ab88945
feat(api): enable nvim_exec_autocmds to pass arbitrary data (#18613)
Add a "data" key to nvim_exec_autocmds that passes arbitrary data (API
objects) to autocommand callbacks.
2022-05-18 09:51:26 -06:00
bfredl
d7dd600716
Merge pull request #18562 from famiu/feat/ui/winbar
feat(ui): add `'winbar'`
2022-05-18 13:08:07 +02:00
Famiu Haque
e1bdb2a258 feat(ui): add 'winbar'
Adds support for a bar at the top of each window, enabled through the
`'winbar'` option.

Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2022-05-18 09:27:08 +06:00
Noval Maulana
38cbca3eea
fix(health): handle non-existent log file #18610
Problem:
    vim.lsp: require("vim.lsp.health").check()
    ========================================================================
      - ERROR: Failed to run healthcheck for "vim.lsp" plugin. Exception:
        function health#check, line 20
        Vim(eval):E5108: Error executing lua ...m/HEAD-6613f58/share/nvim/runtime/lua/vim/lsp/health.lua:20: attempt to index a nil value
        stack traceback:
        ...m/HEAD-6613f58/share/nvim/runtime/lua/vim/lsp/health.lua:20: in function 'check'
        [string "luaeval()"]:1: in main chunk

Solution:
Check for nil.

fix #18602
2022-05-17 11:11:14 -07:00
Jonas Strittmatter
7ffa9073a3
refactor(runtime): convert more dist#ft functions to lua (#18430) 2022-05-17 19:48:45 +02:00
bfredl
8a39032fdd
Merge pull request #18554 from kevinhwang91/perf-timerstart
perf(_editor): no need to stop inside vim.defer_fn
2022-05-17 18:59:48 +02:00
Lewis Russell
6219331c4d feat(api): add win and buf to nvim_set_option_value
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2022-05-17 14:48:10 +01:00
zeertzjq
bbfc4567df
fix(health): correct shada file path #18603 2022-05-17 05:43:35 -07:00
Famiu Haque
54b5222fbb
docs(api): update v:errmsg behavior #18593 2022-05-17 05:27:33 -07:00
Lewis Russell
5c41165c8e feat(lua): allow some viml functions to run in fast
This change adds the necessary plumbing to annotate functions in funcs.c
as being allowed in run in luv fast events.
2022-05-17 10:29:33 +01:00
Gregory Anders
07ade91f21
docs: vim.regex is case sensitive by default (#18595) 2022-05-16 13:30:00 -06:00