Commit Graph

42 Commits

Author SHA1 Message Date
Prabir Shrestha
882376cc66 apply markdown for output (#1100) 2021-03-28 12:11:07 -07:00
hrsh7th
fea03524cb Does not fire lsp_float_closed if floating-window does not exists (#1082) 2021-03-02 19:59:14 -08:00
Prabir Shrestha
1cade410de refactor preview code (#1083) 2021-03-02 19:00:26 -08:00
Akinori Hattori
4e9a71c724 Fix preview without popup window (#1068) 2021-03-02 18:56:11 -08:00
jerojasro
3bca7e8c8a Fix/showsigpreview (#1042)
* ensure l:bufferlines is defined when using preview window

previously, when using the preview window to show signatures, the code
failed with an stacktrace like:

    "s:on_stdout client request on_notification() error",
    "Vim(return):E121: Undefined variable: l:bufferlines",
    "function <SNR>118_out_cb[2]..
    <SNR>107_on_stdout[79]..
    <SNR>92_request_on_notification[3]..
    <SNR>93_createNext[1]..
    <SNR>93_subscribeSourceCallback[2]..
    <lambda>738[1]..
    <SNR>94_handle_signature_help[48]..
    lsp#ui#vim#output#preview[39]..
    lsp#ui#vim#output#get_size_info, line 22"

This commit ensures that the required variable is properly defined in
all the situations (popup, nvim, preview window)

* removed superfluous return statement
2021-01-13 15:57:28 +09:00
Prabir Shrestha
d025869d04 check for nvim float support before using it (#986) 2020-12-29 14:35:25 -08:00
Thomas Faingnaert
ce034201cd Do not remove empty lines in popup (#940)
This reverts commit 7ebf07135e.
2020-11-24 18:32:32 +01:00
mattn
c2f216b9ab Fix linecount (#939)
* Fix linecount

* Use line('$', winid)
2020-11-23 15:19:51 +09:00
Subhaditya Nath
45babeb947 Improved neovim floating windows, and misc. other improvements (#921) 2020-11-15 01:37:01 +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
mattn
46330cd0cb Set <nomodeline> to all of doautocmd (#904) 2020-09-17 22:36:19 +09:00
Prabir Shrestha
0d3c165a64 fix Invalid window id when calling close preview (fixes #858) (#859) 2020-06-29 13:15:50 -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
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
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
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
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
hrsh7th
fef60795ec Improve signature help with lexima.vim (#638)
* Improve signature help with lexima.vim

* Fix buffer change problem

* Display signature help after cursor jumped

* Fix event

* Add _ prefix for inner functions
2020-01-04 09:17:03 -08:00
Prabir Shrestha
9becd620b7 escape \r in preview (#626) 2019-12-25 22:45:29 -08:00
Hirokazu Hata
7ebf07135e If the hover response has only empty string content, we don't display anything. (#553) 2019-12-08 14:08:57 -08:00
hrsh7th
5a207a7876 Avoid double tap feature in insert-mode (#558) 2019-11-15 04:16:18 -08:00
Damien Radtke
19e5b08361 Open Neovim floating windows with "minimal" style (#549) 2019-11-02 10:52:02 +01:00
Thomas Faingnaert
d7e644c2a7 Nicer syntax highlighting for hover (#441)
* Implement syntax highlighting for hover

* Fix signatureHelp
2019-09-08 11:26:22 -07:00
Thomas Faingnaert
1ab8e838ef Fix float sizing in Neovim (#468)
* Fix float sizing in Neovim

* Add g:lsp_preview_max_height
2019-08-17 18:20:16 +02:00
Thomas Faingnaert
ce1488039a Fix hover on same identifier not working in Vim (#463) 2019-08-08 08:43:31 +02:00
Thomas Faingnaert
67e27494f5 Cleanup hover fix on missing filetype (#446)
Also see #442 and #443.
2019-07-25 09:10:07 +02:00
Thomas Faingnaert
79d47fea15 Fix g:lsp_preview_max_width for Neovim (#440)
* Fix g:lsp_preview_max_width for Neovim

* Fix max_width also specifying minimum width
2019-07-24 09:40:02 +02:00
Thomas Faingnaert
c2b7c23fdc Fix hover breaking on missing filetype (#443) 2019-07-24 09:12:35 +02:00
Thomas Faingnaert
55e6cd1749 Simplify conditionals in output.vim (#439) 2019-07-22 18:29:28 -07:00
Thomas Faingnaert
813ea77b91 Add LspPeekDefinition (#412)
* Add LspPeekDefinition

* Add documentation

* Add lsp-peek-definition mapping to documentation

* Add link to Vim preview-window help

* Rewrite LspPeekDefinition using preview window

* Implement peek for Vim popup window

* Make LspPeekDefinition work in Neovim

* Support align in Neovim

* Fix linter errors

* Extract duplicate code to s:align_preview function

* Merge setlocal settings in one line

* Remove suppress_close

* Clean up cursor movement for preview window

* Move Neovim cursor code to separate function

* Allow customising peek alignment

* Move Vim alignment code to separate function

* Implement Vim alignment of popup window

* Cleanup

* Remove extraneous lines

* Move set_cursor logic

* Move scrolloff setting

* Make function calls a bit more consistent

* Vim popup window fixes

* Remove extraneous call

* Fix Vim alignment

* Remove hardcoded width

* Add abort to closure function

* Fix artifacts

* Fix wrong height if popup above cursor

* Add remaining Peek commands

Add LspPeekImplementation, LspPeekTypeDefinition and LspPeekDeclaration.

* Fix wrong positioning of Vim popup
2019-07-21 09:40:19 -07:00
Thomas Faingnaert
91751670ed Allow setting popup max width (#416)
* Allow setting max width of popup window in Vim

* Allow setting max width of popup window in Neovim

* Add documentation

* Uses spaces instead of tabs for indent in help

* Move Neovim logic to s:setcontent

* Rename setting to g:lsp_preview_max_width

* Replace 'popup' with 'preview'
2019-07-17 21:01:07 -07:00
Andrej Zieger
ba9e9b5a20 Fix float position with g:lsp_preview_keep_focus=0 (#419) 2019-06-26 16:11:42 -07:00
Thomas Faingnaert
d848083ca1 Fix newlines in popup window (#414) 2019-06-25 19:30:57 -07:00
Andrej Zieger
1790680598 preview information shown in hover at the cursor (#395)
* preview information shown in hover at the cursor

* lint

* Fix hover float positioning

* Integrate vim8.1 popup for hover/preview

* lint

* Fix hover float positioning above cursor line

* Closing and focusing floating preview (nvim)

* Renamed variable of preview window id

* autocmd events for open/close floats

* Closing of floating preview & lightlinefix (vim8.1)

* Added doubletap functionality to preview
2019-06-25 11:04:52 -07:00
Yasuhiro Matsumoto
aacf4b47c4 Do not update register 2019-02-08 12:15:15 +09:00
Prabir Shrestha
74ad1e1c0d fix lint issues and enable linting for autoload folder (#224) 2018-12-27 23:03:49 -08:00
mattn
43770c3416 Format (#209)
* Save/restore cursor position
* Cosmetic change
* selection should be inclusive
Because exclusive doesn't select fisrt character with 1GvG0
* Remove last extra \n
* Be graceful
* Use winsaveview/winrestoreview
2018-12-14 13:00:32 -08:00
Hayato Kawai
08fdbf51d0 Add support for keeping focus to the current window (#109)
This commit allows to stay in the current window with `:LspHover`.
This behavior enables if `g:lsp_preview_keep_focus` is `1`. (default is `0`)
2018-02-20 12:51:03 -08:00
Prabir Shrestha
d3af2b8e1a return empty string so the output#preview will not add 0 in cmdline (#83) 2018-01-01 14:36:25 -08:00
Łukasz Jan Niemier
203d682e30 Create preview window instead of using quickfix list (#78)
* Create preview window instead of using quickfix list

This removes from us burden of providing formatting for content as this
is now simple as setting proper filetype.

* Create custom filetype for preview window

This will allow users to provide their own mappings and features in
hover window easily.

* Add proper statusline for LSP Hover

* Guard and undo_ftplugin

* Support all LSP hover syntaxes
2018-01-01 13:29:50 -08:00