Commit Graph

242 Commits

Author SHA1 Message Date
mattn
eba0839b79 Check win_findbuf return empty (#922)
Fixes #803
2020-10-30 00:23:46 +09:00
hrsh7th
b6651468b7 Fix textEdit check (#914) 2020-10-05 03:46:25 +09:00
Josh Stone
d2b6922250 Set Vim variables directly instead of win_execute (#911)
- `lsp#ui#vim#output#setcontent` can use `setbufvar`, as suggested in
  https://github.com/tpope/vim-sleuth/issues/68#issuecomment-699512260.
- The example customizing the popup highlighting can use `setwinvar`,
  just like the example in [Vim's popup documentation][1].

[1]: 373863ed48/runtime/doc/popup.txt (L49)
2020-09-26 10:16:21 -07:00
hrsh7th
9755ec0c99 Improve completion (#908) 2020-09-24 10:54:58 +09:00
mattn
46330cd0cb Set <nomodeline> to all of doautocmd (#904) 2020-09-17 22:36:19 +09:00
Prabir Shrestha
eb0e5fb885 use callbag for Highlight references (#891) 2020-08-30 11:11:51 -07:00
Martin Kourim
1a01ffddbe Make sure signature_help and completion get properly disabled (#875)
* Make sure signature_help and completion get properly disabled

* Rename teardown -> _disable

Co-authored-by: Prabir Shrestha <mail@prabir.me>
2020-08-26 12:45:10 -07:00
Tim Weber
69dc272277 Supply first argument to bufnr() (#893)
* Supply first argument to bufnr()

The first argument defaults to the empty string ('') in Vim >= 8.1.1924
and NeoVim >= 0.4.0, but needs to be specified in older versions. The
empty string and the string '%' are equivalent.

* Use bufnr('%') instead of bufnr('')
2020-08-24 14:40:27 -07:00
Tim Weber
864b5e5409 Only define au for CompleteChanged if supported (#892)
This prevents an exception to be thrown by this function, causing the
lsp_server_init event not to be fired.
2020-08-24 14:18:12 -07:00
mattn
e40e457744 Fix completion (#889)
* Fix completion

Some Language Server still return {"textEdit": null} or {"insertText": null}

* Add test
2020-08-24 01:07:40 +09:00
Thanabodee Charoenpiriyakij
47bf0112d9 Don't call buf_clear_namespace if can't get buffer number from bufnr (#887)
Language server can send textDocument/publishDiagnostics on starting the
server and it can make vim call error because the uri that language
server publish can be un-opened file. Fix by checking buffer is exist
before calling buf_clear_namespace.

Fixes #886
2020-08-18 09:05:07 -07:00
Luma
d9835b8a4a check nvim_win availability before attempting to close (#877) 2020-08-04 18:31:27 -07:00
Prabir Shrestha
b05c8da3ec remove dup float2nr 2020-07-18 17:10:45 +00:00
Ttayu
8673f8e109 Avoid window height is 0. (#864)
Co-authored-by: Prabir Shrestha <mail@prabir.me>
2020-07-18 10:08:13 -07:00
Davit Samvelyan
11b1350700 Text props for reference highlights (#679)
* text props for references, semantic high. bug.

Use text props for highlighting references, since they support
combining and look better with semantic highlighting.
Fix bug in semantic highlighting when invalid data for semantic
highlighting in the middle of file breaks semantic highlighting for the
half after erroneous line.

* Add SemanticHighlight prefix to log error message
2020-06-29 13:55:06 -07:00
Prabir Shrestha
0d3c165a64 fix Invalid window id when calling close preview (fixes #858) (#859) 2020-06-29 13:15:50 -07:00
pocari
1c58fd6020 fix API call error (#857) 2020-06-28 21:51:29 -07:00
Thomas Lee
14e553613d Fix documentation preview window (#856)
* Cast height to integer
* Cast width to integer
2020-06-28 21:13:02 -07:00
Ttayu
78ccf69584 Avoid window width is 0. (#852) 2020-06-27 10:31:09 -07:00
Prabir Shrestha
32fae1f0e9 use allowlist and blocklist instead (#847)
* use allowlist and blocklist instead
* add lsp#get_allowed_servers()
2020-06-26 16:13:09 -07:00
Prabir Shrestha
9389c28ae2 migrate diagnostics float cursor to use callbag (#846)
* use callbag for diagnostics float cursor
* fix feature flag test
2020-06-26 11:15:31 -07:00
Prabir Shrestha
c245bfd7a4 use callbag (#845)
* add callbag.vim

* add diagnostics

* add comments

* implement cancel

* optimize cancelled=1

* handle more cancel cases

* use callbag for echo.vim

* rename to _enable() _disable() and also check for changedtick

* move to internal

* group lsp#request

* ignore terminal for echo

* dont bother to subscribe if diagnostics echo not enabled

* remove deprecation comment

* update callbag.vim to v0.1.0

* fix lint issues
2020-06-25 07:42:28 -07:00
randomgeek78
ac908d61e8 fix stuck floating window issue in neovim (#844)
Issue: https://github.com/prabirshrestha/vim-lsp/issues/819

Co-authored-by: Random Geek <randomgeek78@gmail.com>
2020-06-22 20:04:17 -07:00
Thomas Faingnaert
a3673dde78 [WIP] Popup documentation (#507)
* Show documentation in Vim popup

* Use timer

* Reuse logic from output.vim

* Change default text

* Rename functions

* Refactor

* Use v:event

* Add comment

* Remove log

* Refactor

* Implement documentation in Neovim

* Cleanup Neovim popup

* Let Neovim float take all available space

* Extract get_size_info

* Reuse sizing logic from output.vim

* Fix Neovim positioning being reset

* Update autoload/lsp/ui/vim/documentation.vim

Co-Authored-By: Christian Clason <christian.clason@uni-due.de>

* Make vint happy

* Retrigger Travis CI

* add g:lsp_documentation_float flag

* fix lint issues

Co-authored-by: Christian Clason <christian.clason@uni-due.de>
Co-authored-by: Prabir Shrestha <mail@prabir.me>
2020-06-20 12:21:25 -07:00
mityu
07d0f481cd Add checks for cmdwin (#812)
Calling lsp#ui#vim#output#preview() or lsp#ui#vim#output#focuspreview() in cmdwin gives E11 errors.
2020-06-09 22:51:15 -07:00
Daisuke Suzuki
18f2e922f7 Add support for code lens (#831) 2020-06-09 22:45:20 -07:00
John Schug
2ca2fe3854 Add support for the tagfunc option (#815)
* Add support for tagfunc option

* Consolidate various synchronous wait implementations

* Refactor to use lsp#utils#position#lsp_to_vim

Also marks get_symbol_text_from_kind as internal and fixes compatibility
with older vims.
2020-05-25 14:41:21 -07:00
Cody Buell
a943fe558d Add ability to set unique hi for virtual text (#811)
Have virtual text default to vim-lsp defaults for each severity sign,
follow any set or link for a user defined Lsp*Text highlight group, but
allow for unique hi for Lsp*Virtual.

Updated documentation to reflect changes.  Fixed typo in README.md.
2020-05-08 21:37:30 -07:00
Eivy
c029ce1330 Jumping to diagnostics with command args '-nowrap' (#770)
* Add func 'lsp#utils#parse_command_options'

* Add wrap option to jumping to diagnostic

* Update doc

* Fix lint error

* Remove debug code
2020-05-02 18:41:55 -07:00
Agrin
adfdbe1483 Fix error on diagnostics from files not in buffer (#793) 2020-04-19 10:07:19 -07:00
Mitin Arseny
5dd94c66f7 lsp_diagnostics_updated autocommand (#783)
* feat: lsp_diagnostics_updated autocommand

* docs: remove lightline.vim

* docs: generalize not only for status line
2020-04-10 20:38:28 -07:00
mattn
f79bf39922 Count errors if severity is 1 or not have severity (#758)
* Count errors if severity is 1 or not have severity

Fixes #757

* Add test
2020-03-17 19:24:41 +09:00
hrsh7th
2de8f4d479 Compute overflow information in completion (#739)
* Fix completion for overflowinfo

* Use complete start position to compute offset

* Fix test
2020-03-05 23:22:53 +09:00
Hyeon Kim
9fa593aed4 Fix preview feature for vim without patch-8.1.1517 (#728)
Even if `g:lsp_preview_float` is true, vim-lsp should call `:pclose` if
`s:use_preview` is true.
2020-03-03 23:38:26 +09:00
mattn
85a03f2b01 Merge codeAction(s) (#736)
* Merge codeAction(s)

* Print server name

* Fix indentation

* Use empty()
2020-03-03 14:29:42 +09:00
hrsh7th
46308234a2 Implement register command (#735)
* Implemente register command

* Add server_name to command context

* Expose lsp_to_vim, vim_to_lsp API's as public
2020-03-03 13:09:41 +09:00
mattn
5537feca35 Call command after edit (#734)
codeAction may contains edit and command both

Co-authored-by: hrsh7th <hrsh7th@gmail.com>
2020-03-01 00:42:48 +09:00
mattn
55e88054ce executeCommand do not handle response (#732) 2020-02-28 15:44:34 +09:00
hrsh7th
6f3d2d4e79 Update diagnostics when document open (#727) 2020-02-25 11:08:49 +09:00
hrsh7th
651bccfab8 Fix cursor pos on appling additionalTextEdit (#726) 2020-02-21 23:35:35 +09:00
itchyny
b399cde35f Stop toggling lightline on setting contents of popup (#677)
Co-authored-by: mattn <mattn.jp@gmail.com>
2020-02-19 18:52:33 +09:00
mattn
aca92ddad4 Remove suffix (#723)
* Remove suffix

* Get default value in placeholder

* Fix make_valid_word

* Fix test
2020-02-19 15:21:47 +09:00
mattn
d9e471e142 Remove typed_pattern (#704)
* Remove typed_pattern

* Rename asyncomplete_refresh_pattern to vim_lsp_refresh_pattern

* Fix textEdit to clear inserted text

* Fix when startcol can not be found

* Find first item for refresh_pattenr

* Fix

* Update doc

* Trim empty spaces right

* Use space
2020-02-15 01:00:19 +09:00
mattn
a79931dcc5 Ignore error of prop_add/prop_remove (#721)
Some language server send diagnostics which send wrong locations.

Co-authored-by: hrsh7th <hrsh7th@gmail.com>
2020-02-14 20:45:23 +09:00
hrsh7th
20d1cf3968 Expand snippets after some textEdit related modifications (#682)
* Expand snippets after some textEdit related modifications

* Remove `vim-lsp-snippets` specific codes

Co-authored-by: mattn <mattn.jp@gmail.com>
2020-02-10 12:53:21 +09:00
Fujiwara Takuya
52539a54ae Show diagnostics in a floating window (#700)
* fix comment

* fix indent

* support diagnostics in a floating window

* doc: add g:lsp_diagnostics_float_{cursor,delay}

* fix vint errors except unused variables

* suppress vint unused variable errors

* lint: use robust operator
2020-02-10 01:44:05 +09:00
taiyu
f33d624290 clear_all_highlights: check if buffer is loaded (#709)
when buffer is not loaded, len(getbufline(...)) returns 0, calling
prop_remove(..., lnum=1, lnum-end=0) which fails with invalid range
error
2020-02-08 15:37:10 -08:00
Timur Celik
2a346106de Don't allow hover window to close preview window (#705)
If g:lsp_preview_float is enabled there is no reason to close the
preview window on LspHover and LspSignatureHelp. Moreover the preview
window may be in use by other plugins or by the user.

Co-authored-by: mattn <mattn.jp@gmail.com>
2020-02-08 23:16:33 +09:00
itchyny
2526438c44 Register CursorMoved event only when required (#699) 2020-02-08 22:17:57 +09:00
mattn
701c734c91 Check text_edits is null (#697)
* Check text_edits is null

Some Language Server return null

* Add test for textEdit is null

* Check additionalTextEdits is null
2020-02-01 14:17:01 +09:00