165 Commits

Author SHA1 Message Date
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
tsufeki
f02bf20330 Expose diagnostics count for current buffer. (#376)
* Expose diagnostics count for current buffer.

* Add lsp#get_buffer_first_error_line()
2019-06-25 11:19:26 -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
mattn
e0f832443b Merge pull request #387 from dhakimian/fix-ref-jump
Fix cursor positioning when jumping to next/prev reference
2019-06-18 02:55:30 +09:00
Ruslan Kiyanchuk
8891d93dc3 Fix check for signs support in Neovim (#402)
Fixes #322
2019-06-11 13:46:53 -07:00
Daniel Hakimian
19090fecae Update the jumplist when jumping between references
The previous jump method (using G) set a jump, but cursor() doesn't, so
we manually update the jumplist before moving the cursor so as to not
take away previously existing functionality (the ability to use <C-O> to
undo a jump)
2019-05-22 10:30:06 -07:00
Daniel Hakimian
0d1af5afc2 Use cursor() instead of exec 2019-05-22 09:00:38 -07:00
Daniel Hakimian
f75914d991 Fix cursor positioning when jumping to next/prev reference
On tab-indented lines, (or any line where column number and virtual
column number are different) `|` puts the cursor on the nth virtual
column, not the nth character of the line. This caused the
Lsp{Next,Previous}Reference commands to place the cursor on the wrong
column on tab-indented lines.
2019-05-21 09:15:20 -07:00
tsufeki
c1be742774 Add diagnostics highlighting via +textprop. (#375)
* Add diagnostics highlighting via +textprop.

* Use textprop 'combine' option, added in 8.1.1276

* Add textprop docs.

* Enable textprop highlights by default.
2019-05-17 03:02:38 -07:00
Martino Pilia
fe5057641c Highlight references to the symbol under cursor (#363)
* Highlight references to the symbol under cursor

Use the `textDocument/documentHighlight` method to retrieve references
to the symbol under the cursor, and highlight them with matchaddpos().
Add the commands `LscPreviusReference` and `LscNextReference` to
navigate between references within the buffer.

Adaption from the implementation of "Highlight references" in vim-lsc:
https://github.com/natebosch/vim-lsc/blob/5b587b0c/autoload/lsc/cursor.vim

* Fixups

+ Lapsus: `while` statement where it should be `if`.
+ Fix alignment in docs.

* Update LICENSE-THIRD-PARTY
2019-04-21 13:39:26 -07:00
Jason Cheatham
6608aad006 Clear message when leaving diagnostic line (#351) 2019-04-05 10:31:26 -07:00
Jason Cheatham
b20f79c8e0 Add support for nvim highlights (#352) 2019-03-23 10:01:17 -07:00
grainrigi
3e28b8fb1e Use correct highlight group name (fix #340) (#343) 2019-03-16 11:14:21 -07:00
Prabir Shrestha
e3f69339ef Merge pull request #336 from hauleth/support-nvim-virtual_text
Support NeoVim virtual text
2019-03-07 12:25:48 -08:00
Łukasz Niemier
51d7746515 nvim_buf_set_virtual_text line number is 0 indexed 2019-03-07 20:46:53 +01:00
Łukasz Niemier
cedacac6fc Support NeoVim virtual text
Currently it uses similar interface to one provided by the signs
feature.

Close #214
2019-03-07 20:05:28 +01:00
Prabir Shrestha
eadfab3d68 Merge pull request #313 from nickspoons/next-error-column
Navigate directly to error column
2019-03-07 09:23:36 -08:00
mattn
3ee778a0c6 Check buffer loaded (#334)
* Check buffer loaded

* Cosmetic change
2019-03-06 18:16:13 -08:00
nickspoon
2c7c747933 Fix lint (vint) error 2019-03-04 09:18:35 +13:00
nickspoon
2986ccbe74 Refactor error_next/previous out of signs.vim
Moving the error navigation code out of signs.vim to diagnostics.vim
means that errors can be navigated when signs are disabled.

This commit re-introduces error-column navigation, after the signs
refactoring.
2019-03-03 22:43:32 +13:00
nickspoon
e16822d617 Remove column-handling
The signs API doesn't currently have support for storing "arbitrary"
data in the sign {dict}, so we can't store the column that way.
2019-02-24 00:03:09 +13:00
nickspoon
09afaa0f48 Add explicit variable declarations and whitespace 2019-02-24 00:02:16 +13:00
nickspoon
8e4a372ff7 Wrap :LspNextError and :LspPreviousError
Make :LspErrorNext wrap to the first error when the cursor is positioned
after the last error, and the inverse for :LspErrorPrevious.
2019-02-24 00:02:13 +13:00
nickspoon
ada958031a Navigate directly to error column
This commit adds the error column to the array of errors (previously an
array of line numbers, now an array of [line,column] pairs). This allows
navigation directly to the error position, but also nvaigating to
multiple errors in a single line.
2019-02-24 00:01:28 +13:00
Prabir Shrestha
1dfc456428 handle if sign is not supported 2019-02-21 23:11:49 -08:00
Prabir Shrestha
a99a4e53d8 use signs_getplaced api for lsp#ui#vim#signs#next_error and lsp#ui#vim#signs#previous_error 2019-02-20 01:49:42 -08:00
Prabir Shrestha
0b99bf26ab use sign_define api 2019-02-20 01:12:55 -08:00
Prabir Shrestha
3c3274a30a check for s:supports_signs 2019-02-20 01:12:55 -08:00
Prabir Shrestha
98f7abac7d cleanup 2019-02-20 01:12:55 -08:00
Yasuhiro Matsumoto
675be7d9b7 Use spaces instead of tab 2019-02-09 02:28:47 +09:00
Yasuhiro Matsumoto
aacf4b47c4 Do not update register 2019-02-08 12:15:15 +09:00
Yasuhiro Matsumoto
90cd24fe62 normalize URI for diagnostic on Windows 2019-02-05 10:51:44 +09:00
Matteo Landi
ac22efb91e Add flag to disable diagnostics (#197)
* Add switch, g:lsp_diagnostics_enabled, to disable support for diagnostics

* Reduce PR changeset
2019-01-01 20:43:46 -08: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
Prabir Shrestha
82375012d0 Truncate diagnostics cursor message when message is too long (#191)
* truncate diagnostics message

* fix echo with truncation
2018-10-13 11:15:13 -07:00
Augusto Melo
40825e380c [RFC|RDY] code actions (#162)
* WIP code actions

It was addded the code actions funcionality
https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction

Processing the result is not quite right, because it is always applying
the c (change) command, and it does not insert the new line (\n)
character

* WIP code actions

It was addded the code actions funcionality
https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction

Processing the result is not quite right, because it is always applying
the c (change) command, and it does not insert the new line (\n)
character

* Improved apply_text_edit

Now the function apply_text_edit insert texts as well, instead of only
replacing it.

Fixed some typos and broken links

* Added documentation and fixed code_action

Now lsp#ui#vim#code_action uses the diagnostic range instead of the
get_position

* Fixed code action

The code action had a problem when it needed to delete/replace some
text, and when the code was folded it did not work since to execute do
not seem to unfold the code

* Changed copy to deepcopy

Since we modifying nested objects we need to use deepcopy

* Fixed preprocessing and added sort to textedits

To perform an unfold it is necessary to check first if the line has
fold level, if the line has foldlevel = 0 and you try to unfold it will
cause and error.

Since LSP specification does not guarantee that text edits are ordered,
we needed to sort it so it will work on any valid LSP

* Fixed text edits sort

Removed stable_sort since it is not necessary

Now it sorts the text edits in a reverse order and merge text edits
that are inserts on the same place

* Fixed codeAction deleting lines

* Passing capability on initialization

* Added buffer validation before setting the sign

This validation is necessary since the documentation states that the
file {fname} must be already be loaded in a buffer.

* Changed msgpack_type to v:true

Msgpack_type does not work on vim
2018-10-11 20:13:59 -07:00
Christian Kjær
45f9d7528e Add not_supported in scope for get_hover_under_cursor (#190)
Currently calling hover on a filetype without support throws an error, stating
that 'Unknown function: <SNR>274_not_supported'. This adds the `not_supported` 
function into the scripts' scope.
2018-10-11 20:09:32 -07:00
smhc
2e593701ad Fix erasing ALE (and other) diagnostic errors (#184)
ALE (and other plugins) echo diagnostic error messages. vim-lsp erases these by echoing a blank line unnecessarily.
2018-09-27 18:59:05 -07:00
Prabir Shrestha
ba1cf3ba47 rename next_err to next_error() and prev_err() to previous_error() 2018-07-26 12:08:04 -07:00
Cosson2017
f19213d30b add jump to next/pre error (#129)
* add jump to next/pre error

* upd

* optimization

* fix named
2018-07-26 12:02:34 -07:00
Maxim Kot
c547986d3b Naive implementation of location preview instead of just path (#123)
* Naive implementation of location preview instead of just path

* Make cache usage actual

* Fix wrong cached line index computation. Fix copy paste.
2018-03-29 22:01:08 -07:00
Prabir Shrestha
29c986c729 move hover to separate file (#77) 2018-03-18 22:17:37 -07:00
Prabir Shrestha
2cc06e6bf5 bring back custom sign and fix sign when icon is not defined (#122)
* Revert "Revert "Custom signs (#115)" (#119)"

This reverts commit ce1ad6f01a.

* handle cases where sign icon is not set for gui vim
2018-03-18 12:13:44 -07:00
Prabir Shrestha
72916bce5f use echo instead of echom (fixes #74) 2018-03-17 20:08:25 -07:00
Prabir Shrestha
ce1ad6f01a Revert "Custom signs (#115)" (#119)
This reverts commit 8210694b25.
2018-03-17 19:47:09 -07:00
Pavel Davydov
8210694b25 Custom signs (#115)
* add variables to define custom signs

* set signs via exec

* use dict for custom signs

* support all sign params

* update readme with a note about custom signs

* add lsp highlighting groups, remove options to set texthl and linehl via dict.
2018-03-17 10:32:53 -07:00
Tristan Konolige
a070ef4ac8 Print error message when server fails to initialize (#113)
* Print error message when server fails to initialize
* move error_msg to utils.vim
* rename error_msg to lsp#utils#error
2018-03-14 23:08:24 -07: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