Commit Graph

4612 Commits

Author SHA1 Message Date
L3MON4D3
6f6286e4f9
fix(lsp): small bugs in snippet-parser #18998
This fixes the following bugs:
`${1:else_text}` -> format with if_text: "else_text"
`${1:-else_text}` -> format with if_text: "else_text"
`${1:}` in `format` (eg. empty else_text) -> error.
`${1:}` (eg. empty placeholder) -> error.

Thanks hrsh7th :)
2022-06-29 09:53:49 -07:00
Christian Clason
1eb9624666
vim-patch:9.0.0006: not all Visual Basic files are recognized (#19153)
Problem:    Not all Visual Basic files are recognized.
Solution:   Change detection of *.cls files. (Doug Kearns)
8b5901e2f9
2022-06-29 18:43:56 +02:00
Christian Clason
ba583f8206
vim-patch:9.0.0005: hare files are not recognized (#19151)
Problem:    Hare files are not recognized.
Solution:   Add a filetype pattern. (Hugo Osvaldo Barrera, closes vim/vim#10630)
040674129f
2022-06-29 16:21:04 +02:00
Famiu Haque
606ec8b708 feat(api): make nvim_parse_cmd and nvim_cmd support :filter
Also fixes a memory leak in `parse_cmdline`.

Closes #18954.
2022-06-28 17:31:04 +06:00
0x74696d6d79
ee6b21e843
fix(vim.ui.input): accept nil or empty "opts" #19109
Fix #18143
2022-06-28 02:53:15 -07:00
Christian Clason
274609a109
vim-patch:069a7d561bbe (#19130)
Update runtime files
069a7d561b
2022-06-27 23:35:26 +02:00
Christian Clason
f2fa11708c
fix(filetype): check for non-nil match in detect.rules (#19129) 2022-06-27 20:43:37 +02:00
Christian Clason
f3c8f3e5d4
vim-patch:partial:8a3b805c6c9c (#19104)
Update runtime files
8a3b805c6c

skip builtin.txt (needs 8.2.4838)
skip message.txt (whitespace changes)
2022-06-27 10:23:09 +02:00
Gregory Anders
6f3508f8ed
refactor(filetype): allow vim.filetype.match to accept buf and filename (#19114)
This is necessary in cases where filetype detection acts recursively.
For example, when matching files that end with .bak, the "root" of
the filename is matched again against the same buffer (e.g. a buffer
named "foo.c.bak" will be matched again with the filename "foo.c", using
the same underlying buffer).
2022-06-27 10:03:43 +02:00
Gregory Anders
f3ce06cfa1
refactor(filetype)!: allow vim.filetype.match to use different strategies (#18895)
This enables vim.filetype.match to match based on a buffer (most
accurate) or simply a filename or file contents, which are less accurate
but may still be useful for some scenarios.

When matching based on a buffer, the buffer's name and contents are both
used to do full filetype matching. When using a filename, if the file
exists the file is loaded into a buffer and full filetype detection is
performed. If the file does not exist then filetype matching is only
performed against the filename itself. Content-based matching does the
equivalent of scripts.vim, and matches solely based on file contents
without any information from the name of the file itself (e.g. for
shebangs).

BREAKING CHANGE: use `vim.filetype.match({buf = bufnr})` instead 
of `vim.filetype.match(name, bufnr)`
2022-06-26 18:41:20 +02:00
Christian Clason
42e8774317
vim-patch:e1dc76fbf333 (#19092)
Update runtime files
e1dc76fbf3
2022-06-25 21:56:51 +02:00
Enan Ajmain
0b9664f524 fix: make_filter_cmd for :! powershell #15913
Problem:
Nvim fails to create tempfile "…/nvim6UJx04/7" when 'shell' is set to
pwsh (PowerShell Core). This breaks filtered shell commands ":{range}!".
With shell set to cmd, it works.

Solution:
PowerShell doesn't use "<" for stdin redirection. Instead, use
"-RedirectStandardInput".

Closes #15913
2022-06-25 07:20:58 -07:00
Hazel Weakly
35e89bf903
fix(filetype.lua): always return a string in getlines function (#19080)
This re-introduces the fix that the filetype.lua refactor inadvertently reverted.
The fix ensures that in the case when end_lnum is omitted, a string is always returned.
2022-06-24 19:53:44 +02:00
Christian Clason
823d9e0af1
vim-patch:a57b553b4328 (#19076)
Update runtime files
a57b553b43
2022-06-24 14:45:07 +02:00
Christian Clason
c00a3f45d4
vim-patch:8cc5b559f700 (#19066)
Update runtime files
8cc5b559f7
2022-06-23 15:57:51 +02:00
Jonas Strittmatter
e3b51d5842
refactor(runtime): refactor filetype.lua (#18813)
Move some filetype detection functions to detect.lua,
sort patterns by detected filetype.
2022-06-21 11:29:52 -06:00
eyalk11
f479dd0bbe
docs(deprecated): alternatives for $NVIM_LISTEN_ADDRESS 2022-06-21 10:25:44 +02:00
Gregory Anders
6d52a29c3b
Merge pull request #18743 from gpanders/bowooptvalue
Add "buf" and "win" to nvim_get_option_value and use them in vim.bo and vim.wo
2022-06-20 17:28:37 -06:00
Christian Clason
7a309311a2
vim-patch:d799daa660b8 (#19031)
Update runtime files
d799daa660
2022-06-20 18:47:30 +02:00
Gregory Anders
87a68b6a3a refactor: use nvim_{get,set}_option_value for vim.{b,w}o
`nvim_get_option_value` and `nvim_set_option_value` better handle
unsetting local options. For instance, this is currently not possible:

    vim.bo.tagfunc = nil

This does not work because 'tagfunc' is marked as "local to buffer" and
does not have a fallback global option. However, using :setlocal *does*
work as expected

    :setlocal tagfunc=

`nvim_set_option_value` behaves more like :set and :setlocal (by
design), so using these as the underlying API functions beneath vim.bo
and vim.wo makes those two tables act more like :setlocal. Note that
vim.o *already* uses `nvim_set_option_value` under the hood, so that
vim.o behaves like :set.
2022-06-20 09:16:21 -06:00
Gregory Anders
58d028f64b feat(api): add "buf" and "win" to nvim_get_option_value
These mirror their counterparts in nvim_set_option_value.
2022-06-20 09:16:21 -06:00
Zaz Brown
99ef06d846
refactor(provider): use list comprehension #19027
- list(filter(lambda x: x != "", sys.path))
+ [p for p in sys.path if p != ""]
2022-06-20 06:17:00 -07:00
zeertzjq
966d55effe
vim-patch:8.2.5116: "limit" option of matchfuzzy() not always respected (#19005)
Problem:    "limit" option of matchfuzzy() not always respected.
Solution:   Remove "else". (Kazuyuki Miyagi, closes vim/vim#10586)
47f1a55849
2022-06-18 13:43:02 +08:00
Christian Clason
e651ae5864
vim-patch:d592deb33652 (#19002)
Update runtime files
d592deb336
2022-06-17 20:38:21 +02:00
zeertzjq
1fe94cb008
docs: improve 'insertmode' emulation #18962
The current emulation script enters Insert mode much too frequently.
Using only BufWinEnter seems to be a closer simulation.

Also add a few more mappings.
2022-06-16 17:16:33 -07:00
Justin M. Keyes
c57f6b28d7
Merge #8519 feat: name, test ids, sockets in stdpath(state) 2022-06-17 01:23:48 +02:00
kevinhwang91
8780076a78 fix(treesitter): new iter if folded 2022-06-16 17:38:10 +02:00
Christian Clason
35c9fe9895
vim-patch:8.2.5110: icon filetype not recognized from the first line (#18987)
Problem:    Icon filetype not recognized from the first line.
Solution:   Add a check for the first line. (Doug Kearns)
bf6614643f
2022-06-16 15:53:38 +02:00
notomo
0e8186bdd8
fix(lua): highlight.on_yank can close timer in twice #18976
Steps to reproduce:

1. setting `vim.highlight.on_yank`
   ```
   vim.api.nvim_create_autocmd({ "TextYankPost" }, {
     pattern = { "*" },
     callback = function()
       vim.highlight.on_yank({ timeout = 200 })
     end,
   })
   ```
2. repeat typing `yeye` ...
3. causes the following error.
   ```
   Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x01e96970 is already closing
   stack traceback:
           [C]: in function 'close'
           vim/_editor.lua: in function ''
           vim/_editor.lua: in function <vim/_editor.lua:0>
   ```

📝 Test result before fix:

    [----------] Global test environment setup.
    [----------] Running tests from test/functional/lua/highlight_spec.lua
    [ RUN      ] vim.highlight.on_yank does not show errors even if buffer is wiped before timeout: 15.07 ms OK
    [ RUN      ] vim.highlight.on_yank does not show errors even if executed between timeout and clearing highlight: 15.07 ms ERR
    test/helpers.lua:73: Expected objects to be the same.
    Passed in:
    (string) 'Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x02025260 is already closing
    stack traceback:
            [C]: in function 'close'
            vim/_editor.lua: in function ''
            vim/_editor.lua: in function <vim/_editor.lua:0>'
    Expected:
    (string) ''
2022-06-15 19:39:55 -07:00
Justin M. Keyes
1f2c2a35ad feat(server): instance "name", store pipes in stdpath(state)
Problem:
- Unix sockets are created in random /tmp dirs.
  - /tmp is messy, unclear when OSes actually clear it.
  - The generated paths are very ugly. This adds friction to reasoning
    about which paths belong to which Nvim instances.
- No way to provide a human-friendly way to identify Nvim instances in
  logs or server addresses.

Solution:
- Store unix sockets in stdpath('state')
- Allow --listen "name" and serverstart("name") to given a name (which
  is appended to a generated path).

TODO:
- is stdpath(state) the right place?
2022-06-15 19:29:51 -07:00
Christian Clason
504d7decbd
vim-patch:8c1b8cb2e0b5 (#18966)
Update runtime files
8c1b8cb2e0
2022-06-15 09:20:32 +02:00
dundargoc
6de7f32d52
docs: fix typos (#18866)
docs: fix typos and similarly insignificant changes

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
Co-authored-by: kanreki <32443233+kanreki@users.noreply.github.com>
2022-06-15 08:49:54 +08:00
Christian Clason
2f2022773f
vim-patch:6ba83ba9ee29 (#18948)
Update runtime files.
6ba83ba9ee
2022-06-14 08:52:04 +02:00
rhcher
7f8f8d6cb7
feat(lsp): sort codelens if multiple item per line (#18951) 2022-06-13 19:31:48 +02:00
Shougo
663cbe2620
feat: cmdheight=0 #16251
Fix https://github.com/neovim/neovim/issues/1004

Limitation: All outputs need hit-enter prompt.

Related:
https://github.com/neovim/neovim/pull/6732
https://github.com/neovim/neovim/pull/4382
2022-06-13 02:40:51 -07:00
bfredl
612944c586 refactor(api): update vimdoc 2022-06-12 19:45:39 +02:00
Christian Clason
6eaf10502c
vim-patch:partial:63f32603789d (#18916)
Update runtime files
63f3260378

skip translations
skip user manual rewrite
2022-06-10 08:40:32 +02:00
Gregory Anders
58323b1fe2
feat(filetype): remove side effects from vim.filetype.match (#18894)
Many filetypes from filetype.vim set buffer-local variables, meaning
vim.filetype.match cannot be used without side effects. Instead of
setting these buffer-local variables in the filetype detection functions
themselves, have vim.filetype.match return an optional function value
that, when called, sets these variables. This allows vim.filetype.match
to work without side effects.
2022-06-09 13:12:36 -06:00
zeertzjq
d6247a575c vim-patch:8.2.5066: lcs-leadmultispace
aca12fd89b
2022-06-09 21:26:23 +08:00
kylo252
3da3cfc864
feat(autocmds): retrieve lua callback (#18642)
add a new `callback` field to `nvim_get_autocmds`
2022-06-09 07:18:56 -06:00
mohsen
94181ad7dc
fix(diagnostic): check for negative column value (#18868) 2022-06-08 12:55:39 -06:00
Sean Dewar
3cd22a3485
fix(eval/f_getmatches): return empty list for invalid win argument (#18893)
Slight inaccuracy in v8.1.1084's port.
Like Vim, it should return [], not 0.
Ref #18890
2022-06-07 16:55:32 +01:00
Christian Clason
1324e7f79e
vim-patch:partial:016188fd8a30 (#18890)
Update runtime files.
016188fd8a

omit changes from doc/builtin.txt (needs 8.2.1536, 8.2.4981)
skip user manual rewrite for Vim9script
2022-06-07 14:41:53 +02:00
Jonas Strittmatter
41a49dd9c8
refactor(runtime): port remaining patterns from filetype.vim to filetype.lua (#18814) 2022-06-06 09:25:33 -06:00
Javier Lopez
cf2738109a
docs: documenting struct members inline #18783
Without the proper comments, doxygen doesn't understand the comment
belongs to the struct member:

https://www.doxygen.nl/manual/docblocks.html#memberdoc

[skip ci]
2022-06-06 05:30:48 -07:00
Mathias Fußenegger
e4df1c9b9e
fix(lsp): fix multi client handling in code action (#18869)
Fixes https://github.com/neovim/neovim/issues/18860
2022-06-05 16:43:32 +02:00
bfredl
e13dcdf162
Merge pull request #18864 from bfredl/optcut
perf(tests): don't invoke nvim_get_all_options_info until needed
2022-06-05 00:48:43 +02:00
bfredl
545dc82c1b perf(tests): don't invoke nvim_get_all_options_info until needed
This call alone is responible of 40 000 000 out of 80 000 000
individual alloc/free calls in the test suite.
2022-06-05 00:11:57 +02:00
bfredl
aad20de5ab fix(startup): nvim with --clean should not load user rplugins
runtime rplugins such like legacy script providers are not affected
by this change.
2022-06-04 18:37:54 +02:00
Christian Clason
df4ffce543
vim-patch:partial:cfa8f9a3f285 (#18858)
Update runtime files
cfa8f9a3f2

skip syntax/vim.vim (needs 8.2.4770)
skip doc/syntax.vim (needs several colorscheme patches)
skip further rewrite of manual
2022-06-04 10:53:42 +02:00
zeertzjq
9961a9702e
fix(lsp): set buflisted before switching to buffer (#18854) 2022-06-04 10:23:43 +02:00
Christian Clason
e6fa4cca24
vim-patch:8.2.5054: no good filetype for conf files similar to dosini (#18851)
Problem:    No good filetype for conf files similar to dosini.
Solution:   Add the confini filetype. (closes vim/vim#10510)
635f48010d
2022-06-04 09:49:01 +02:00
dundargoc
ff20d40321
docs: fix typos (#18269)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Dan Sully <dan+github@sully.org>
Co-authored-by: saher <msaher.shair@gmail.com>
Co-authored-by: Stephan Seitz <stephan.seitz@fau.de>
Co-authored-by: Benedikt Müller <d12bb@posteo.de>
Co-authored-by: Andrey Mishchenko <mishchea@gmail.com>
Co-authored-by: Famiu Haque <famiuhaque@protonmail.com>
Co-authored-by: Oliver Marriott <hello@omarriott.com>
2022-06-04 11:56:36 +08:00
Gregory Anders
86cc33a464
fix(filetype): fix typo in starsetf function (#18856) 2022-06-03 21:52:59 -06:00
Mathias Fußenegger
c6d747e6a5
feat(lsp): send didChangeConfiguration after init (#18847)
Most LSP servers require the notification to correctly load the
settings and for those who don't it doesn't cause any harm.

So far this is done in lspconfig, but with the addition of vim.lsp.start
it should be part of core.
2022-06-03 18:16:11 +02:00
Mathias Fußenegger
69774e3179
feat(lsp): add a start function (#18631)
A alternative/subset of https://github.com/neovim/neovim/pull/18506  that should be forward compatible with a potential project system.

Configuration of LSP clients (without lspconfig) now looks like this:

    vim.lsp.start({
       name = 'my-server-name',
       cmd = {'name-of-language-server-executable'},
       root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]),
    })
2022-06-03 14:59:19 +02:00
bfredl
9745941ef6
Merge pull request #18730 from bfredl/apiconvert
convert API types using mpack instead of msgpack
2022-06-02 23:01:21 +02:00
Christian Clason
26966688aa
fix(treesitter): correct region for string parser (#18794)
fixes injections for string parsers after eab4d03a32
2022-06-02 17:35:16 +02:00
bfredl
d5f047bee0 refactor(api): use a unpacker based on libmpack instead of msgpack-c
Currently this is more or less a straight off reimplementation,
but this allow further optimizations down the line, especially
for avoiding memory allocations of rpc objects.

Current score for "make functionaltest; make oldtest" on a -DEXITFREE build:

is 117 055 352 xfree(ptr != NULL) calls (that's NUMBERWANG!).
2022-06-02 16:05:24 +02:00
Wsevolod
d5651a4183
fix(lua): stop pending highlight.on_yank timer, if any (#18824)
When yanking another range while previous yank is still highlighted, the
pending timer could clear the highlight almost immediately (especially
when using larger `timeout`, i.e. 2000)
2022-06-02 09:49:57 +02:00
Fredrik Ekre
209824ce2c
fix(lsp): adjust offset encoding in lsp.buf.rename() (#18829)
Fix a bug in lsp.buf.rename() where the range returned by the server in
textDocument/prepareRename was interpreted as a byte range directly,
instead of taking the negotiated offset encoding into account. This
caused the placeholder value in vim.ui.input to be incorrect in some
cases, for example when non-ascii characters are used earlier on the
same line.
2022-06-01 18:56:18 +02:00
Javier Lopez
d837b6d50c
fix(checkhealth): skip vim.health #18816
Problem:
https://github.com/neovim/neovim/pull/18720#issuecomment-1142614996

The vim.health module is detected as a healthcheck, which produces spurious errors:

    vim: require("vim.health").check()
    ========================================================================
    - ERROR: Failed to run healthcheck for "vim" plugin. Exception:
      function health#check, line 20
      Vim(eval):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'check' (a nil value)
      stack traceback:
      [string "luaeval()"]:1: in main chunk

Solution:
Skip vim.health when discovering healthchecks.
2022-06-01 07:10:10 -07:00
zeertzjq
96c494dec3
refactor: correct comments and assertions about mapping rhs <Nop> (#18821)
Also avoid referring to mappings as "keymaps" in commands and docs.

						*map_empty_rhs* *map-empty-rhs*
You can create an empty {rhs} by typing nothing after a single CTRL-V (you
have to type CTRL-V two times).  Unfortunately, you cannot do this in a vimrc
file.
2022-06-01 21:37:01 +08:00
Gregory Anders
046b4ed461 feat(fs): add vim.fs.normalize() 2022-05-31 13:30:10 -06:00
Gregory Anders
f271d70661 feat(fs): add vim.fs.find()
This is a pure Lua implementation of the Vim findfile() and finddir()
functions without the special syntax.
2022-05-31 13:04:41 -06:00
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
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
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
zeertzjq
d404d68c92
docs: clarify that nvim_strwidth counts control characters as one cell (#18802) 2022-05-31 07:06:34 +08: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
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
Joshua Cao
14d653b421
feat(man.vim): list command flags in "gO" outline #17558 2022-05-16 04:49:44 -07:00
ii14
e501e4ed4b
feat(lua): add traceback to vim.deprecate #18575 2022-05-15 18:07:36 -07:00
Oliver Marriott
5e3b16836a
docs(api): nvim_set_hl attributes #18558 2022-05-15 14:06:06 -07:00
dundargoc
19da1071dc
ci(clint): remove clint.py line length check #18574
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-15 12:01:29 -07:00
dundargoc
0a66c4a72a
docs(nvim_set_keymap): specify that optional arguments defaults to false (#18177)
Closes: https://github.com/neovim/neovim/issues/16919
2022-05-15 16:44:48 +08:00
Christian Clason
bc45b5be1c
vim-patch:partial: 30ab04e16e1e (#18568)
Update runtime files, new color schemes
30ab04e16e

Skip: doc/* (in-progress rewrite of the user manual on creating vim(9)script plugins)
2022-05-15 10:25:02 +02:00
Dundar Goc
3bd7246f5a ci(clint): remove check for include order
Uncrustify and clang-format are already both excellent at ordering
includes; this isn't something we need to check for ourselves. Also
remove the section on include order in the dev-style documentation.
2022-05-14 15:09:02 +02:00
Roj
9e4286294f
build(nvim.desktop): central Kurdish translation #17065
Co-authored-by: Sarchia <74000088+Sarchia@users.noreply.github.com>
2022-05-13 11:58:22 -07:00
Arsham Shirvani
f6ba7d69be
fix(man.vim): q in "$MANPAGER mode" does not quit #18443
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
    nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")

Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.

Fixes #18281
Ref #17791

Helped-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2022-05-13 07:49:08 -07:00
Christian Clason
eb4b337d9e
vim-patch:partial:3f32a5f1601a (#18555)
Update runtime files and translations
3f32a5f160

skip eval.txt (requires 8.2.4883)
2022-05-13 15:20:58 +02:00
kevinhwang91
a33caf9b45 perf(_editor): no need to stop inside vim.defer_fn
uv_run:
1. remove timer handle from heap
2. will start again if repeat is not 0
2022-05-13 14:16:47 +08:00
zeertzjq
030417d80b
revert: "feat(mappings): do not simplify the rhs of a mapping" (#18553)
This reverts commit 7ac5359143.
This fix can cause more problems than it solves.
2022-05-13 11:31:17 +08:00
yamatsum
233c41cb8c
feat(defaults): search selection by * and # in visual mode (#18538) 2022-05-13 08:28:10 +08:00
Fredrik Ekre
a9d25e9472
fix(lsp): perform client side filtering of code actions (#18392)
Implement filtering of actions based on the kind when passing the 'only'
parameter to code_action(). Action kinds are hierachical with a '.' as
the separator, and the filter thus allows, for example, both 'quickfix'
and 'quickfix.foo' when requestiong only 'quickfix'.

Fix https://github.com/neovim/neovim/pull/18221#issuecomment-1110179121
2022-05-12 18:48:02 +02:00
Ivan
78a1e6bc00 feat(defaults): session data in $XDG_STATE_HOME #15583
See: 4f2884e16d

- Move session persistent data to $XDG_STATE_HOME Change 'directory',
  'backupdir', 'undodir', 'viewdir' and 'shadafile' default location to
  $XDG_STATE_HOME/nvim.
- Move logs to $XDG_STATE_HOME, too.
- Add stdpath('log') support.

Fixes: #14805
2022-05-12 07:13:45 -07:00
dundargoc
a1b663cce8
build(lua2dox): add parenthesis around parameter types in documentation (#18532)
This will check if the string after the variable in a @param is either
"number", "string", "table", "boolean" and "function" and if so add a
parenthesis around it. This will help separate the variable type with
the following text. Had all our functions been annotated with emmylua
then a more robust solution might have been preferable (such as always
assuming the third string is parameter type without making any checks).
I believe however this is a clear improvement over the current situation
and will suffice for now.
2022-05-12 08:02:46 -06:00
Famiu Haque
2bbd588e73
feat(lua): vim.cmd() with kwargs acts like nvim_cmd() #18523 2022-05-12 06:34:38 -07:00
Sean Dewar
c24b442e31
fix(runtime/genvimvim): omit s[ubstitute] from vimCommand #18480
It's special cased by the vimSubst syntax group, and isn't present in Vim's
vimCommand group.

For example, this fixes `call s:Foo()` highlighting `:` as Error in Nvim, as the
`s` is parsed as vimCommand rather than as vimUserFunc since
`contains=vimCommand` was added to vimUserFunc (and vimFunc) in a rt update.

Interestingly, `g:`, `l:`, etc. have the same issues due to :global, :list, etc.
Vim also has that problem, so it should ideally be fixed upstream.

We could also omit g[lobal] from vimCommand and rely on vimGlobal instead, but
it doesn't work in some cases, like when there's a `:` before the command. Also,
Vim matches only `g` in vimCommand for some reason, which doesn't produce any
highlight for `:global/foo/bar` (with Nvim you at least get some highlights on
the `global` bit despite the leading `:`).

Also, remove special handling of :py3 in syntax/vim.vim, as the generator seems
to have no problems finding it.
2022-05-11 17:08:25 -07:00
Andrey Mishchenko
60b1e314ed
docs: nvim_buf_[get|set]_[text|lines] (#18404)
- Use consistent formatting for args docs.
- Clarify inclusivity/exclusivity in `nvim_buf_[get|set]_text`.
2022-05-11 17:05:56 -07:00
Andrey Mishchenko
7900a8b713
docs(api): how to check if window is floating #18503 2022-05-11 16:49:19 -07:00
adrian5
a6f4cfdefa
docs(api): improve shared lua functions docs (#17933) 2022-05-11 10:23:46 -06:00
zeertzjq
e36e0f7b2f
vim-patch:8.2.4939: matchfuzzypos() with "matchseq" does not have all positions (#18525)
Problem:    matchfuzzypos() with "matchseq" does not have all positions.
Solution:   Also add a position for white space. (closes vim/vim#10404)
9af2bc0751
2022-05-11 21:51:31 +08:00
bfredl
96a125b207
Merge pull request #18366 from famiu/feat/api/nvim_cmd
feat(api): add `nvim_cmd`
2022-05-11 10:39:02 +02:00
Famiu Haque
dfcc584665 feat(api): add nvim_cmd
Adds the API function `nvim_cmd` which allows executing an Ex-command through a Dictionary which can have the same values as the return value of `nvim_parse_cmd()`. This makes it much easier to do things like passing arguments with a space to commands that otherwise may not allow it, or to make commands interpret certain characters literally when they otherwise would not.
2022-05-11 13:12:16 +06:00
Christian Clason
cb7ab98925
Merge pull request #18487 from clason/stylua
CI: format and lint runtime with Stylua
2022-05-11 08:54:24 +02:00
Christian Clason
e50b1fe60d
vim-patch:921bde888046 (#18511)
Update runtime files, translations
921bde8880

skip: translations
skip: builtin.txt (requires 8.2.4861)
2022-05-10 10:55:33 +02:00
Fredrik Ekre
c55867b46d
docs(lsp): fix description of only in vim.lsp.buf.code_action() (#18492) 2022-05-09 18:08:04 +02:00
Christian Clason
aefdc6783c chore: format runtime with stylua 2022-05-09 16:31:55 +02:00
Shougo
dbdd58e548
feat: cmdline funcs (#18284)
vim-patch:8.2.4903: cannot get the current cmdline completion type and position

Problem:    Cannot get the current cmdline completion type and position.
Solution:   Add getcmdcompltype() and getcmdscreenpos(). (Shougo Matsushita,
            closes vim/vim#10344)
79d599b877

vim-patch:8.2.4910: imperfect coding

Problem:    Imperfect coding.
Solution:   Make code nicer.
9ff7d717aa
2022-05-09 12:52:31 +08:00
Gregory Anders
6cfb1d4c28
fix(lsp): detach spawned LSP server processes (#18477)
LSP servers should be daemonized (detached) so that they run in a
separate process group from Neovim's. Among other things, this ensures
the process does not inherit Neovim's TTY (#18475).

Make this configurable so that clients can explicitly opt-out of
detaching from Nvim.
2022-05-08 13:00:30 -06:00
Sean Dewar
0d3f17a6c3
vim-patch:partial:d899e5112079 (#18474)
Update runtime files
d899e51120

- Skip vimhelp.vim stuff (syntax/help.vim, syntax.txt; v8.2.4891).
- Skip :let heredoc eval stuff (eval.txt; v8.2.4770).
- Skip uk.cp1251.po.
- Skip `*hl-CurSearch*` change (syntax.txt):
  - Vim's CurSearch works differently (Nvim's uses current cursor pos).
    Dunno know how applicable the redrawing comment is to Nvim...
  - Might be preferred to move it under `*hl-Search*` like Vim?
2022-05-08 10:15:36 +01:00
Christian Clason
0a00792332
vim-patch:8.2.4907: some users do not want a line comment always inserted (#18463)
Problem:    Some users do not want a line comment always inserted.
Solution:   Add the '/' flag to 'formatoptions' to not repeat the comment
            leader after a statement when using "o".
2bf875f881
2022-05-07 16:49:36 +02:00
Noval Maulana
d306210641
docs: change wrap_at type to number (#18456) 2022-05-07 10:35:08 +02:00
Famiu Haque
14f3383c0d fix(api): make nvim_parse_cmd work correctly with both range and count
It seems range and count can be used together in commands. This PR fixes
the behavior of `nvim_parse_cmd` for those cases by removing the mutual
exclusivity of "range" and "count". It also removes range line number
validation for `nvim_parse_cmd` as it's not its job to validate the
command.
2022-05-07 12:26:49 +06:00
Mathias Fußenegger
44a4af0ed0
fix(lsp): skip clients without rename capability (#18449)
Follow up to https://github.com/neovim/neovim/pull/18441
This way rename should "just work" in most cases without having to
manually filter the client
2022-05-06 18:57:08 +02:00
zeertzjq
7978660efb
vim-patch:8.2.4881: "P" in Visual mode still changes some registers (#18445)
Problem:    "P" in Visual mode still changes some registers.
Solution:   Make "P" in Visual mode not change any register. (Shougo
            Matsushita, closes vim/vim#10349)
509142ab7a
2022-05-06 19:26:28 +08:00
Mathias Fußenegger
55187de115
fix(lsp): fix rename capability checks and multi client support (#18441)
Adds filter and id options to filter the client to use for rename.
Similar to the recently added `format` function.

rename will use all matching clients one after another and can handle a
mix of prepareRename/rename support. Also ensures the right
`offset_encoding` is used for the `make_position_params` calls
2022-05-05 23:56:00 +02:00
bfredl
d14d308ce8
Merge pull request #18431 from famiu/feat/api/nvim_get_autocmds/group_name
feat(api): add `group_name` to `nvim_get_autocmds`
2022-05-05 20:17:11 +02:00
Famiu Haque
96289f2416 feat(api): add group_name to nvim_get_autocmds 2022-05-05 23:17:36 +06:00
William Boman
94eb72cc44
fix(lsp): make sure to always reset active codelens refreshes (#18331)
This fixes issues where subsequent calls to vim.lsp.codelens.refresh()
would have no effect due to the buffer not getting cleared from the
active_refresh table.

Examples of how such scenarios would occur are:
  - A textDocument/codeLens result yielded an error.
  - The 'textDocument/codeLens' handler was overriden in such a way that
    it no longer called vim.lsp.codelens.on_codelens().
2022-05-05 18:50:12 +02:00
Famiu Haque
7aedcd8feb refactor(api): make range in nvim_parse_cmd an array
Changes the `range` value in `nvim_parse_cmd` into an array to describe
range information more concisely. Also makes `range` and `count` be
mutually exclusive by making count `-1` when command takes a range
instead of a count. Additionally corrects the behavior of `count` for
built-in commands by making the default count `0`.
2022-05-05 20:35:14 +06:00
Dundar Goc
5576d30e89 refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
2022-05-04 15:25:54 +02:00
Famiu Haque
3ec93ca92c
feat(nvim_parse_cmd): add range, count, reg #18383
Adds range, count and reg to the return values of nvim_parse_cmd. Also makes
line1 and line2 be -1 if the command does not take a range. Also moves
nvim_parse_cmd to vimscript.c because it fits better there.
2022-05-04 05:04:01 -07:00
James McCoy
c051ea83dd
refactor(lua): replace hard-coded gsub with vim.pesc() (#18407) 2022-05-04 08:13:01 +02:00
Gregory Anders
815b65d777
fix(filetype): fixup scd filetype detection (#18403) 2022-05-03 23:03:42 +02:00
Jonas Strittmatter
8ef03188e6
refactor(runtime): convert dist#ft functions to lua (#18247)
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2022-05-03 12:29:04 -06:00
bfredl
4df11463b2
Merge pull request #15674 from yatli/ui_event_extmark
API/UI: ui_event_extmark
2022-05-03 16:59:24 +02:00
ii14
70e2c5d10d
feat(lsp): add logging level "OFF" (#18379) 2022-05-03 08:49:23 -06:00
Yatao Li
29a6cda3ff feat(api/ui): win_extmarks 2022-05-03 22:26:02 +08:00
dundargoc
73741e9486
feat(lua): vim.deprecate() #18320
This is primarily intended to act as documentation for the developer so
they know exactly when and what to remove. This will help prevent the
situation of deprecated code lingering for far too long as developers
don't have to worry if a function is safe to remove.
2022-05-03 06:42:41 -07:00
Justin M. Keyes
4fb48c5654
feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009
PROBLEM
------------------------------------------------------------------------
$NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the
current process should listen on this address") and a descriptor ("the
current process is a child of this address").

This contradiction means the presence of NVIM_LISTEN_ADDRESS is
ambiguous, so child Nvim always tries to listen on its _parent's_
socket. This is the cause of lots of  "Failed to start server" spam in
our test/CI logs:

    WARN  2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0
    WARN  2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0

SOLUTION
------------------------------------------------------------------------

1. Set $NVIM to the parent v:servername, *only* in child processes.
   - Now the correct way to detect a "parent" Nvim is to check for $NVIM.
2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes.
3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after
   server init.
4. Open a channel to parent automatically, expose it as v:parent.

Fixes #3118
Fixes #6764
Fixes #9336
Ref https://github.com/neovim/neovim/pull/8247#issuecomment-380275696
Ref #8696
2022-05-03 06:08:35 -07:00
Jose Alvarez
b5c15ba7e5
fix(lsp): add missing bufnr argument (#18382) 2022-05-03 08:54:49 -04:00
Christian Clason
46734cf7c1
vim-patch:8.2.4859: wget2 files are not recognized (#18385)
Problem:    wget2 files are not recognized.
Solution:   Add patterns to recognize wget2. (Doug Kearns)
3a974a8933
2022-05-03 10:23:11 +02:00
bfredl
ddf7bb24f9
Merge pull request #18357 from bfredl/ui_stdin
feat(ui): allow embedder to emulate "cat data | nvim -" behaviour
2022-05-02 23:24:37 +02:00
bfredl
ad63b94b03 refactor(ui): simplify stdin handling 2022-05-02 22:19:41 +02:00
James McCoy
a1542b091d
Merge pull request #18353 from jamessan/ft-match-fix 2022-05-02 11:01:51 -04:00
James McCoy
88595fbb21
fix(filetype.lua): escape expansion of ~ when used as a pattern 2022-05-02 08:38:35 -04:00
Christian Clason
e6d62d5a3d
vim-patch:8.2.4857: Yaml indent for multiline is wrong (#18365)
Problem:    Yaml indent for multiline is wrong.
Solution:   Adjust patterns. (closes vim/vim#10328, closes vim/vim#8740)
f4f579b46b
2022-05-02 13:57:33 +02:00
Christian Clason
d23ce6ef76
vim-patch:8.2.4855: robot files are not recognized (#18364)
Problem:    Robot files are not recognized.
Solution:   Add patterns for robot files. (Zoe Roux, closes vim/vim#10339)
2096a5f128
2022-05-02 13:54:07 +02:00
William Boman
069da468d5
fix(shared): avoid indexing unindexable values in vim.tbl_get() (#18337) 2022-05-01 21:08:05 +02:00
Christian Clason
65b4bf055f
docs: syntax is enabled by default (#17637)
`:syntax enable` is no longer necessary (and may even be harmful). Do not recommend it in `usr_05.txt` and `usr_06.txt`, and mention the new default in `syntax.txt`.
2022-05-01 13:31:49 +02:00
ii14
7502f1cae0
docs(api): more API attributes #18336 2022-04-30 16:16:16 -07:00
Famiu Haque
7e10b0dae6
docs: move "hl-VertSplit" to deprecated.txt #18328 2022-04-30 15:23:30 -07:00
ii14
039d60bd9c
fix(lsp): fix infinite loop in resolved_capabilities deprecation message (#18333)
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2022-04-30 23:22:47 +02:00
Mathias Fußenegger
0344736aa6
fix(lsp): handle textDocumentSync.save bool capability (#18332)
Follow up to https://github.com/neovim/neovim/pull/17814
2022-04-30 22:13:26 +02:00
bfredl
cc27540560
Merge pull request #18231 from famiu/feat/api/parse_cmdline
feat(api): `nvim_parse_cmd`
2022-04-30 18:41:17 +02:00
Christian Clason
872622bcdb
vim-patch:8.2.4849: Gleam filetype not detected (#18326)
Problem:    Gleam filetype not detected.
Solution:   Add a pattern for Gleam files. (Mathias Jean Johansen,
            closes vim/vim#10326)
917c32c4f7
2022-04-30 17:31:53 +02:00
Mathias Fußenegger
88411613e2
feat(lsp): add async option to vim.lsp.buf.format (#18322)
Deprecates the existing `vim.lsp.buf.formatting` function.
With this, `vim.lsp.buf.format` will replace all three:

- vim.lsp.buf.formatting
- vim.lsp.buf.formatting_sync
- vim.lsp.buf.formatting_seq_sync
2022-04-30 17:23:50 +02:00
Famiu Haque
8dbb11ebf6 feat(api): add nvim_parse_cmdline
Adds an API function to parse a command line string and get command information from it.
2022-04-30 21:04:51 +06:00
Michael Lingelbach
5b04e46d23
feat(lsp): add vim.lsp.buf.format (#18193) 2022-04-30 15:36:40 +02:00
kylo252
eecc6535eb
fix(handlers): more specific error messages (#16772)
Specify which message, or request, was last received in case of an error
instead of the same generic message
2022-04-30 13:55:26 +02:00
Michael Lingelbach
c618b314c6
chore(lsp): remove capabilities sanitization (#17814)
* feat(lsp)!: remove capabilities sanitization

Users must now access client.server_capabilities which matches the same
structure as the protocol.

https://microsoft.github.io/language-server-protocol/specification

client.resolved_capabilities is no longer used to gate capabilities, and
will be removed in a future release.

BREAKING CHANGE


Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2022-04-30 11:22:30 +02:00
Fredrik Ekre
df09e03cf7
feat(lsp): options to filter and auto-apply code actions (#18221)
Implement two new options to vim.lsp.buf.code_action():
 - filter (function): predicate taking an Action as input, and returning
   a boolean.
 - apply (boolean): when set to true, and there is just one remaining
   action (after filtering), the action is applied without user query.

These options can, for example, be used to filter out, and automatically
apply, the action indicated by the server to be preferred:

    vim.lsp.buf.code_action({
        filter = function(action)
            return action.isPreferred
        end,
        apply = true,
    })

Fix #17514.
2022-04-30 10:14:31 +02:00