Commit Graph

3701 Commits

Author SHA1 Message Date
Matthieu Coudron
3552916cb9
fix(doc): remove reference to vim.lsp.callbacks (#14576)
too old now, can be confusing
2021-06-28 23:02:17 +02:00
John Gehrig
5aaa1a1c04
[RDY] Add buffer information to tabline_update (#12481)
* Add buffer information to tabline_update

Most terminal implementations of the tabline display buffer and tab
information. Many neovim-qt users disable GuiTabline because it lacks
functionality provided in the terminal implementation.

The tabline_update event should include buffer information too, so client GUIs
can display rich useful tabs.
2021-06-27 15:30:09 -04:00
Jan Edmund Lazo
20dc3f1989
vim-patch:8.1.0897: can modify a:000 when using a reference (#14902)
Problem:    Can modify a:000 when using a reference.
Solution:   Make check for locked variable stricter. (Ozaki Kiichi,
            closes vim/vim#3930)
05c00c038b
2021-06-26 10:19:09 -04:00
Ghjuvan Lacambre
ad9c2c069a
Fix <afile> getting prepended with a slash on WinClosed (#14515)
It is wrong to assume that you can't shorten a path if it's in `/`: you
can always shorten it by removing the forward slash.

Closes #14512
2021-06-26 10:18:36 -04:00
Akin Sowemimo
444f175335 fix(lsp): do not convert vim.NIL to nil in lists 2021-06-24 11:23:19 +01:00
Björn Linse
24e0c16fd6
Merge pull request #14868 from shadmansaleh/patch_verbose_for_lua
fix(runtime): Fix bugs regarding lua runtime files
2021-06-23 20:34:57 +02:00
Björn Linse
b601f2548c
Merge pull request #14719 from snezhniylis/marktree_delete_node_iter_fix
Fix deletable nodes in MarkTree sometimes getting skipped
2021-06-22 13:48:22 +02:00
Matthieu Coudron
9a39a11807 fixup! vim-patch:8.2.3020: unreachable code (#14866) 2021-06-22 10:35:36 +02:00
snezhniylis
43479f0ad6 extmark: fix deletable nodes in MarkTree sometimes getting skipped
As per #14236, performing extmark cleanup in a certain namespace does
not guarantee removing all the extmarks inside given namespace.
The issue resides within the tree node removal method and results in
a couple of rare edge cases.

To demonstrate what causes this bug, I'll give an example covering one
of the edge cases.

=== AN EXAMPLE ===

   (A)         (B)         (C)         (D)         (E)
---------   ---------   ---------   ---------   ---------
  <0, 1>      <0, 1>      <0, 1>      <0, 1>      <0, 1>
  <0, 2>      <0, 2>      <0, 2>      <0, 2>      <0, 2>
  <0, 3>      <0, 3>      <0, 3>      <0, 3>      <0, 3>
  <0, 4>      <0, 4>      <0, 4>      <0, 4>      <0, 4>
  <0, 5>      <0, 5>      <0, 5>      <0, 5>      <0, 5>
  <0, 6>      <0, 6>      <0, 6>      <0, 6>      <0, 6>
  <0, 7>      <0, 7>      <0, 7>      <0, 7>      <0, 7>
  <0, 8>      <0, 8>      <0, 8>      <0, 8>      <0, 8>
  <0, 9>      <0, 9> *           *    <0, 9>  *   <0, 9>
[0, 10] *   [0, 10]     <0, 9>        [0, 11]     [0, 11]
  [0, 11]     [0, 11]     [0, 11]     [0, 12]     [0, 12]  *
  [0, 12]     [0, 12]     [0, 12]     [0, 13]     [0, 13]
  [0, 13]     [0, 13]     [0, 13]     [0, 14]     [0, 14]
  [0, 14]     [0, 14]     [0, 14]     [0, 15]     [0, 15]
  [0, 15]     [0, 15]     [0, 15]     [0, 16]     [0, 16]
  [0, 16]     [0, 16]     [0, 16]     [0, 17]     [0, 17]
  [0, 17]     [0, 17]     [0, 17]     [0, 18]     [0, 18]
  [0, 18]     [0, 18]     [0, 18]     [0, 19]     [0, 19]
  [0, 19]     [0, 19]     [0, 19]   [0, 20]     [0, 20]
[0, 20]     [0, 20]     [0, 20]

DIAGRAM EXPLANATION

* Every column is a state of the marktree at a certain stage.

* To make it simple, I don't draw the whole tree. What you see are
   2 leftmost parent nodes ([0, 10], [0, 20]) and their children placed
   in order `MarkTreeIter` would iterate through. From top to bottom.

* Numbers on this diagram represent extmark coordinates. Relative
   positioning and actual mark IDs used by the marktree are avoided
   for simplicity.

* 2 types of brackets around coordinates represent 2 different
   extmark namespaces (`ns_id`s).

* '*' shows iterator position.

ACTUAL EXPLANATION

Let's assume, we have two sets of extmarks from 2 different plugins:
  * Plugin1: <0, 1-9>
  * Plugin2: [0, 10-20]

1. Plugin2 calls
    `vim.api.nvim_buf_clear_namespace(buf_handle, ns_id, 0, -1)`
    to clear all its extmarks which results in `extmark_clear` call.

2. The iteration process goes on ignoring extmarks with irrelevant
    `ns_id` from Plugin1, until it reaches [0, 10], entering state (A).

3. At the end of cleaning up process, `marktree_del_itr` gets called.
    This function is supposed to remove given node and, if necessary,
    restructure the tree. Also, move the iterator to the next node.
    The bug occurs in this function.

4. The iterator goes backwards to the node's last child, to put it
    in the place of its deleted parent later. (B)

5. The parent node is deleted and replaced with its child node. (C)

6. Since now this node has 8 children, which is less than
    `MT_BRANCH_FACTOR - 1`, it get's merged with the next node. (D)

7. Finally, since at (B) the iterator went backward, it goes forward
    twice, skipping [0, 11] node, causing this extmark to persist,
    causing the bug. (E)

ANALYSIS AND SOLUTION

The algorithm works perfectly when the parent node gets replaced by
its child, but no merging occurs. I.e. the exact same diagram,
but without the (D) stage. If not for (D), it would iterate to <0, 9>
and then to [0, 11]. So, iterating twice makes sense. The actual problem
is in (C) stage, because the iterator index isn't adjusted and still
pointing to no longer existent node. So my solution is to adjust
iterator index after removing the child node.

More info: https://github.com/neovim/neovim/pull/14719
2021-06-22 10:32:46 +02:00
shadmansaleh
b4ac878026 fix(source): Source giving E484 & parsing error at line 1 for lua files
It's happening because do_source is only expected to return FAIL when it
was unable to open file . But `nlua_exec_file` returns fail for parsing
and execution error too . Those errors are emitted through `nlua_error`.

So now return value of nlua_exec_file is ignored like do_cmdline. It now
only returns fail when it was unable to open file that check is done
before calling nlua_exec_file or do_cmdline. Errors in nlua_exec_file
are still directly emitted through nlua_error like before.
2021-06-21 13:07:05 +06:00
Michael Lingelbach
8162792283
Merge pull request #13165 from mfussenegger/codelens
feat(lsp): Add codelens support
2021-06-14 14:15:57 -07:00
Mathias Fussenegger
2bdd553c9e feat(lsp): Add codelens support 2021-06-14 21:45:14 +02:00
Christian Clason
5b6edc852f feat(float): add rounded borders preset
Add `borders = "rounded"` preset for `nvim_open_win`, equivalent to

  border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}

Also add undocumented "solid" preset to docs.
2021-06-14 11:10:57 +02:00
Björn Linse
9c7132cda4
Merge pull request #14788 from shadmansaleh/fix/lua_runtime1
fixup(runtime): Fix lua runtime files not listed in :scriptnames
2021-06-13 00:52:30 +02:00
shadmansaleh
1f280b582f fixup(runtime): Fix lua runtime files not listed
lua runtime files weren't listed in :scriptname & profiler.
This fixes that.

* Add tests

* Small doc tweeks
2021-06-13 00:27:52 +06:00
Jan Edmund Lazo
f376e67a53
vim-patch:8.2.0038: spell suggestions insufficiently tested
Problem:    Spell suggestions insufficiently tested.
Solution:   Add spell suggestion tests. (Dominique Pelle, closes vim/vim#5398)
e9a8d1f9ad

Requires latest en.utf-8.spl from
https://ftp.nluug.nl/pub/vim/runtime/spell/.

Include the following patch because patch v8.2.0946 was merged:

vim-patch:8.2.0948: spell test fails

Problem:    Spell test fails.
Solution:   Adjust expected text of the prompt.
d281b7c227
2021-06-12 13:06:49 -04:00
Jan Edmund Lazo
61117d89a3
vim-patch:8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Problem:    There is :spellwrong and :spellgood but not :spellrare.
Solution:   Add :spellrare. (Martin Tournoij, closes vim/vim#4291)
08cc374dab
2021-06-12 13:06:48 -04:00
Jan Edmund Lazo
d3bdde0bad
test: clear $GZIP, use nvim's system() (#14791) 2021-06-12 13:05:43 -04:00
Serg Tereshchenko
8d23941af8 fix(ui): Fix pum incorrect position in multigrid mode
Refs #12985
2021-06-12 14:34:02 +02:00
shadmansaleh
e1edc079dd refactor(source): Move lua file detection to do_source
So now :source can run lua files too :)

* feat: Add support for :[ranged]source for lua files
2021-06-11 01:01:03 +06:00
shadmansaleh
92b6b3764c refactor(tests): Simplify tests at functional/lua/runtime_spec 2021-06-11 01:01:03 +06:00
shadmansaleh
f000251e08 feat(runtime): Allow lua to be used in syntax 2021-06-11 01:01:03 +06:00
shadmansaleh
f256a18fef feat(runtime): Allow lua to be used in ftdetect 2021-06-11 01:01:02 +06:00
shadmansaleh
4dffe1ff2f feat(runtime): Allow lua to be used in indent 2021-06-11 01:01:02 +06:00
shadmansaleh
fd5e5d2715 feat(runtime): Allow lua to be used in ftplugin 2021-06-11 01:01:02 +06:00
shadmansaleh
68be8b99cf feat(runtime): Allow lua to be used in compiler 2021-06-11 01:01:02 +06:00
shadmansaleh
1e6c02510a feat(runtime): Allow lua to be used in colorschemes
* tests(runtime): move runtime/plugin tests to functional/lua/runtime_spec
2021-06-11 01:01:02 +06:00
shadmansaleh
687eb0b39f feat(startup): Source runtime/plugin/**/*.lua at startup
For opt plugins these files are sourced on `:packadd`

* `:runtime` Now can exexute lua files
2021-06-11 00:58:38 +06:00
Corey Williamson
8021c5a531 api: include border in nvim_win_get_config 2021-06-10 10:41:49 +02:00
notomo
1a9eb7a987 api: add nvim_win_call 2021-06-10 09:34:29 +02:00
jbyuki
a15c2cbab6 add tests in buffer_updates 2021-06-09 12:20:13 -07:00
Mathias Fussenegger
f03a4d616b feat(lsp): Split out a diagnostics_to_items function from set_loclist
Makes it easier to re-use the logic to populate the quickfix list
instead of the location list.
2021-06-07 18:24:32 +02:00
Jan Edmund Lazo
5571004b69
fixup! tests: fix system_spec when run with clipboard manager (#10956)
uv_process_options_t "args" member was set to a local array from stack.
when uv_process_options_t variable is outside the function.
https://pvs-studio.com/en/docs/warnings/v507/
2021-06-05 12:49:26 -04:00
Jan Edmund Lazo
59db83bc59
clang/API: reject null string in timer_start() 2021-06-02 21:05:13 -04:00
Sean Dewar
802f8429d5
api(nvim_open_win): add "noautocmd" option
This option, when set, stops nvim_open_win() from potentially firing
buffer-related autocmd events
(BufEnter, BufLeave and BufWinEnter in the case of nvim_open_win()).
2021-06-01 03:05:04 +01:00
TJ DeVries
43956dea55
lua: Add vim.opt and fix scopes of vim.o (#13479)
* lua: Add vim.opt

* fixup: cleaning

* fixup: comments

* ty clason

* fixup: comments

* this is the last commit. period.
2021-05-28 17:24:48 +02:00
James McCoy
0b905be47b
Merge pull request #14607 from glacambre/fix_get_all_options_info_crash
[RDY] Generate PARAM_COUNT macro
2021-05-26 10:30:20 -04:00
glacambre
0c8454f5bc Fix crash on :echo get_all_options_info()
Iterating over PARAM_COUNT is wrong as PARAM_COUNT also counts the last
element of the options array, which has a NULL fullname in order to
signal the end of the array.
2021-05-26 07:07:11 +02:00
Jan Edmund Lazo
59d550345d
vim-patch:8.2.2778: problem restoring 'packpath' in session
Problem:    Problem restoring 'packpath' in session.
Solution:   Let "skiprtp" also apply to 'packpath'.
d23b714d8b

Port Test_mksession_skiprtp() to lua functional test.
2021-05-22 17:32:24 -04:00
Jan Edmund Lazo
39fdb86832
vim-patch:8.2.0946: cannot use "q" to cancel a number prompt
Problem:    Cannot use "q" to cancel a number prompt.
Solution:   Recognize "q" instead of ignoring it.
eebd555733
2021-05-21 23:01:11 -04:00
Thomas Vigouroux
3bd9cce368
Merge pull request #14575 from vigoux/virtualedit-bytes
fix(bufupdate): send events when inserting with virtualedit
2021-05-20 20:05:25 +02:00
James McCoy
216bfa1d6b
Merge pull request #14579 from jamessan/windows-env-vars
Deduplicate env var names on Windows
2021-05-19 22:46:42 -04:00
Michael Lingelbach
045e47ec55
Merge pull request #14563 from mjlbach/fix_intelephense_langserver
lsp: handle case where CompletionItem.insertTextFormat is nil
2021-05-19 12:39:44 -07:00
Björn Linse
7fbf3bf18b lua: use proper conversion of vim.g values 2021-05-19 19:29:19 +02:00
Marco Hinz
9051064672
test(lsp_spec): improve correctness
References https://github.com/neovim/neovim/issues/14571
2021-05-19 16:35:02 +02:00
Marco Hinz
34922fba6b
Revert "lsp: make tagstack smarter motion-wise (#12262)"
This reverts commit 8885ea7f24.
2021-05-19 15:33:32 +02:00
Thomas Vigouroux
237175cf20
fix(bufupdate): send events when inserting with virtualedit
Problem first raised
https://github.com/nvim-treesitter/nvim-treesitter/issues/1304
2021-05-18 19:31:56 +02:00
James McCoy
d250905c69
test(job_spec): Test handling of case-insensitively matching env vars
Since Windows is case-insensitive, there should only be a single env var
in visible in the resulting job.  However, non-Windows should see both.
2021-05-18 06:53:03 -04:00
Michael Lingelbach
63df353545 lsp: handle case where CompletionItem.insertTextFormat is nil
* Update tests to use explicit insertTextFormat for snippets
2021-05-16 15:25:34 -07:00
Björn Linse
0cd1430316
Merge pull request #14468 from bfredl/zindex
[WIP] z-index!
2021-05-15 14:44:22 +02:00