Commit Graph

2730 Commits

Author SHA1 Message Date
Mathias Fußenegger
ef0398fe88
LSP: Expose diagnostics grouped by bufnr (#11932)
Expose `vim.lsp.buf.diagnostics_by_buf`

This makes it easier to customize the diagnostics behavior. For example
to defer the update they can override the
`textDocument/publishDiagnostics` callback to only call
`buf_diagnostics_save_positions` and then defer the other actions to a
autocmd event.
2020-04-25 15:46:58 +02:00
erw7
6854680579
terminal: Fix mouse coordinates issue (#12158)
Offsets of window were not taken into account when sending mouse
coordinates to the terminal. Therefore, when nu or rnu is set, the mouse
coordinates sent to the terminal were not correct. Change it to send the
correct coordinates by subtract window offset from col.
2020-04-21 15:44:39 +02:00
Matthieu Coudron
9678fe4cfb
Merge pull request #11989 from Weypare/textEdit
LSP/completion: add textEdit support
2020-04-20 21:31:19 +02:00
Andrey Avramenko
49045b173e test: add docs for get_completion_word test 2020-04-20 20:20:14 +03:00
Andrey Avramenko
a0d2bfeeb5 test: add get_completion_word test for text_doc...
...ument_completion_list_to_complete_items
2020-04-20 18:35:54 +03:00
Tristan Konolige
bf0f745861
lua: allow deepcopy of functions (#12136) 2020-04-19 01:04:37 +02:00
Björn Linse
1fe0b329fe api/ui: win_viewport event for visible range and cursor position in window 2020-04-01 19:43:55 +02:00
Hirokazu Hata
4139678f97
vim.uri: fix uri_to_fname (#12059)
fix: #12056
If the colon of the drive letter of windows is URI encoded,
it doesn't match the expected pattern, so decode it first.
2020-03-30 14:30:24 +02:00
Matthieu Coudron
e700a88bb6
Merge pull request #11746 from Billy4195/add_wildmenu_key
[RFC] Wildmenu support C-E and C-Y as popupmenu
2020-03-28 14:25:54 +01:00
Björn Linse
4dabbc19d4 popupmenu: don't use 'rightleft' option in cmdline mode
Cmdline is always drawn from the left to right, so using rightleft
popupmenu is not useful here
2020-03-23 19:14:33 +01:00
erw7
9333f86ab7 TUI: do not use "nvim_get_option" in tui thread
Since "nvim_get_option" is executed on the tui thread as a C function
instead of msgpack-rpc, it accesses global variables that may change on the
main thread.
2020-03-21 18:06:59 +09:00
Will Eccles
87d892afa0
vim-patch:8.1.0864 Make 'scrolloff' and 'sidescrolloff' options window local (#11854)
Problem: cannot have a local value for 'scrolloff' and 'sidescrolloff'

Author: Bram Moolenar

375e339007
2020-03-17 20:05:34 +01:00
Matthieu Coudron
d22fd58629
Merge pull request #11716 from teto/folds_auto_backup
[RFC] foldcolumn autowidth
2020-03-02 13:56:27 +01:00
Hirokazu Hata
e35ff7371f
lua: add vim.tbl_len() #11889 2020-03-01 23:38:43 -08:00
Jan Edmund Lazo
eba8a9ca1d
vim-patch:8.1.1510: a plugin cannot easily expand a command like done internally
Problem:    A plugin cannot easily expand a command like done internally.
Solution:   Add the expandcmd() function. (Yegappan Lakshmanan, closes vim/vim#4514)
80dad48c50
2020-03-01 03:57:58 -05:00
Justin M. Keyes
1b0a770340 Merge #11805 'vim-patch:8.1.0619' 2020-02-29 17:37:15 -08:00
Hirokazu Hata
16262472cd
lsp: add 'textDocument/documentSymbol’ callback
Spec: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
2020-03-01 09:10:02 +09:00
Jan Edmund Lazo
3c12ee333a
vim-patch:8.1.0619: :echomsg and :echoerr do not handle List and Dict
Problem:    :echomsg and :echoerr do not handle List and Dict like :echo does.
            (Daniel Hahler)
Solution:   Be more tolerant about the expression result type.
461a7fcfce

Add lua functional tests for :echo,:echon,:echomsg,:echoerr
because nvim did not port "test_" functions from Vim
that modify internal state.

Testing :echoerr via try/catch is sufficient.
2020-02-29 17:40:00 -05:00
Matthieu Coudron
1a2be57da3 foldcolumn: allow auto:X
Similar to signcolumn, allow foldcolumn to adapt itself to the number of
folds.

Regression:
vim supports a maximum fdc of 12, this limits it to 9.
2020-02-29 20:27:22 +01:00
Björn Linse
9c00fea585 lua: add regex support, and @match support in treesitter queries 2020-02-26 19:39:02 +01:00
Björn Linse
a380526c0f test: always use "set more" with :digraph test
otherwise we risk the same issue as with ex_cmds/digraphs_spec.lua
2020-02-19 13:08:12 +01:00
Hirokazu Hata
e2ed8053bf
lua: move test helper function, map and filter, to vim.shared module 2020-02-18 17:43:10 +09:00
Justin M. Keyes
b353a5c05f
test: always dump logs on failure #11886
Whenever `eq()`, `ok()`, etc. fails, include log tail in the failure
message. This helps to correlate log messages with a particular test
failure.
2020-02-16 23:30:24 -08:00
Justin M. Keyes
6e13b9d261 test/LSP: assert contents of log file 2020-02-16 22:09:28 -08:00
Justin M. Keyes
a446fbc8fa lsp/rpc.lua: fix env application function
Env vars must be merged with the current env.
2020-02-16 22:09:28 -08:00
Justin M. Keyes
4cf48dc329 test/LSP: dump logs on error
This will help debug CI flakey failures.

TODO: helpers.assert_log()  -- Explicitly check contents of the logfile.
2020-02-16 19:04:40 -08:00
Justin M. Keyes
1eb0f5371a LSP: fix validate_client_config
- `cmd_env` is a table not a function.
- tests: Set $NVIM_LOG_FILE for fake LSP server.
2020-02-16 17:53:33 -08:00
Justin M. Keyes
c15bd6cd27 test/LSP: use less-generic exit code
- os.exit(1) is too generic, since code 1 may be caused by Nvim exiting
  for some other reason.  Change it to os.exit(101).
- style: de-architect json_encode/json_decode calls.

Failure seen in travis macOS job:
https://travis-ci.org/neovim/neovim/jobs/647849133

    [  FAILED  ] test/functional/plugin/lsp_spec.lua@ 266 SP basic_init test should not send didOpen if the buffer closes before init
    test/functional/plugin/lsp_spec.lua:297: exit code
    Expected objects to be the same.
    Passed in:
    (number) 1
    Expected:
    (number) 0
    stack traceback:
      test/functional/plugin/lsp_spec.lua:297: in function 'on_exit'
      test/functional/plugin/lsp_spec.lua💯 in function 'test_rpc_server'
      test/functional/plugin/lsp_spec.lua:272: in function <test/functional/plugin/lsp_spec.lua:266>
2020-02-16 17:52:48 -08:00
Justin M. Keyes
b04165859d test: style 2020-02-16 17:24:21 -08:00
Björn Linse
dc0e534a91
Merge pull request #11864 from h-michael/deepcopy
lua: vim.deepcopy() and vim.tbl_extend() should preserve vim.empty_dict()
2020-02-15 18:10:48 +01:00
Matthieu Coudron
bb331a9b31
mouse.c: can click on multibyte foldopen/foldclose (#11863)
would previously only work with ascii fillchars.

Added a test.
2020-02-14 16:42:00 +01:00
Hirokazu Hata
cdb729b746
lua: add vim.tbl_extend and vim.deepcopy test 2020-02-14 22:36:21 +09:00
Hirokazu Hata
417fc6ccf7
lua: vim.deepcopy uses empty_dict() instead of {} for empty_dict()
fix: https://github.com/neovim/nvim-lsp/issues/94
2020-02-13 11:55:43 +09:00
Hirokazu Hata
032ede0203
test: add json_encode test for vim.empty_dict() 2020-02-12 21:08:12 +09:00
erw7
3557757a3c vim-patch:8.1.0092: prompt buffer test fails
Problem:    Prompt buffer test fails.
Solution:   Set 'nomodified' before closing the window. (Ozaki Kiichi,
            closes vim/vim#3051
71ef1ba5e9
2020-02-12 16:03:54 +09:00
erw7
783aecd501 vim-patch:8.1.0036: not restoring Insert mode if leaving prompt buffer with mouse
Problem:    Not restoring Insert mode if leaving a prompt buffer by using a
            mouse click.
Solution:   Set b_prompt_insert appropriately. Also correct cursor position
            when moving cursor to last line.
891e1fd894
2020-02-12 15:16:32 +09:00
erw7
3ca0343fb9 vim-patch:8.1.0032: BS in prompt buffer starts new line
Problem:    BS in prompt buffer starts new line.
Solution:   Do not allows BS over the prompt.  Make term_sendkeys() handle
            special keys. Add a test.
6b810d92a9
2020-02-12 15:16:32 +09:00
erw7
4813ad48cd vim-patch:8.1.0027: difficult to make a plugin that feeds a line to a job
Problem:    Difficult to make a plugin that feeds a line to a job.
Solution:   Add the nitial code for the "prompt" buftype.
f273245f64
2020-02-12 15:16:32 +09:00
Björn Linse
70c212e480 vim-patch:8.2.0235: draw error when an empty group is removed from 'statusline'
Problem:    Draw error when an empty group is removed from 'statusline'.
Solution:   Do not use highlighting from a removed group.
dbe5d361fe
2020-02-09 09:42:26 +01:00
Björn Linse
ef2e6522c5 tests: bail out on libdir just like $VIMRUNTIME, it cannot be calculated 2020-02-07 09:32:25 +01:00
Björn Linse
00c57c98df treesitter: add standard &rtp/parser/ search path for parsers 2020-02-07 09:22:55 +01:00
Björn Linse
c5b812c9ea env: try find library dir (like /usr[/local]/lib/nvim) and add it to &rtp 2020-02-07 09:22:55 +01:00
Björn Linse
7ce9a5c7da api: add nvim_get_runtime_file for finding runtime files 2020-02-07 09:22:55 +01:00
Björn Linse
459a362cc1 extmarks: fix crash due to invalid column values in inccommand preview
This used to use -1 and MAXCOL values. Make sure in range values are
used.
2020-02-02 10:50:48 +01:00
Hye Sung Jung
14a8b3b98c
doc: fix typos [ci skip] #11787 2020-01-30 22:56:34 -08:00
Axel Forsman
2538e61513
Fix shift change callbacks reading bad cursor (#11782)
Sloppy code inherited from Vim caused user scripts to be able
to observe the cursor line in an invalid intermediary state,
due to Neovim change callbacks being unbuffered unlike Vim listeners.

Manifested in Vimscript executed from the callback possibly erroring
when `:call`:ing any function,
due to the implicit range `curwin->w_cursor.lnum,curwin->w_cursor.lnum`
failing validation.

Fixed by deferring the call to `changed_lines()` until after
`curwin->w_cursor.lnum` gets its correct value.
2020-01-30 07:34:34 +01:00
Björn Linse
bfe84adb5a options: winhighlight: fix incorrect string equality test 2020-01-28 19:10:41 +01:00
Justin M. Keyes
1c3ca4f18f mksession: always unix slashes "/" for filepaths 2020-01-26 17:30:47 -08:00
Justin M. Keyes
1e103b3c12 mksession: simplify generated commands
Doing ":file …" immediately after is enough to fixup the :terminal
buffer name.

ref #5250
2020-01-26 17:13:00 -08:00
Alexandre Dubray
cf67f19ac2 mksession: restore same :term buf in split windows
Problem: When session-restore creates a terminal buffer with command
         like `:edit term://.//16450:/bin/bash`, the buffer gets
         a different name (depends on PID). Thus the later call to
         `bufexists('term://.//16450:/bin/bash)` will return false.
Solution: Force the buffer name with :file. This as least ensures
         the same buffer will show in multiple windows correctly, as
         expected when saving the session.  But it still has problems:
           1. the PID in the buffer name is bogus
           2. redundant :terminal buffers still hang around

fix #5250
2020-01-26 17:13:00 -08:00