71 Commits

Author SHA1 Message Date
hrsh7th
73bc4f1ceb Support any completion-engine (#672)
Co-authored-by: Prabir Shrestha <mail@prabir.me>
2020-04-25 08:34:12 -07:00
hrsh7th
cbddb059b5 Add snippet indicator (#759) 2020-04-19 10:14:38 -07:00
C. Wu
174e4bf82e Replace builtin trim() by lsp#utils#_trim() (#782)
Builtin trim() does not exist in e.g. vim 8.0, which is the default version of Ubuntu 18.04 LTS.
2020-04-07 18:36:43 +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
mattn
3d4daa4d34 Show only first line while popup visible (#731) 2020-02-28 16:10:21 +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
9962ef9ac8 Show only first line while popup visible (#714) 2020-02-13 07:51:53 -08:00
mattn
08f702bfcd Remove \r in description in completion popup (#694) 2020-01-30 02:08:43 +09:00
mattn
2c9a2c6bdf Fix insert text (#688)
* Fix insert text

When insertTextFormat==2, it should prefer insertText. But it may include placeholder.
When insertTextFormat!=2, use insertText since it is plain-text.
When it have textEdit, the inserted text will be modified in later, so insert only word.
Otherwize, insert label since it should be what the server want to insert.

* Check with valid word pattern

* ":" should be invalid character

* Add lsp#utils#make_valid_word

* Add l: prefix

* Add test

* Add test

* \t should be ignored

Co-authored-by: hrsh7th <hrsh7th@gmail.com>
2020-01-28 14:41:30 +09:00
hrsh7th
b9e6816193 Use prefix filter when does not specified (#678) 2020-01-20 21:27:24 +09:00
hrsh7th
64d514d14f Fix completion for clangd (#665)
* Fix completion for clangd

* Fix for old vim
2020-01-11 20:10:33 -08:00
hrsh7th
c39127d85c Improve user_data format (#649) 2020-01-02 02:34:32 -08:00
hrsh7th
f769a450b2 Fix CompleteDone (#637)
* Move some codes to completion.vim that related to handling CompleteDone.

* Add abort

* Fix test

* Add l: prefix to self vars

* Disable unused vars

* Restore position

* Support snippet simple case and vim-lsp-snippets

* Support g:lsp_text_edit_enabled

* Fix for v:null results

* Fix multi-byte chars

* Add document

* Fix for vim-lsp-snippets for now

* Prepare to future improvements

* More clalify line comment

* User get_user_data instead of extract_user_data

* Always use [''] pattern for accessing dictionary property

* Fix misspelling

* More strict check for completionProvider.resolveProvider

* Fix obj.key to obj['key']

* Store completed_item id to the user_data

* Fix omni tests

* Apply for the review
- Rename expand_text_simply -> simple_expand_text
- to_col -> _lsp_to_vim
- Rename user_data key

* Add example tests

* Add timeout to completionItem/resolve in completion.vim

* Fix timeout feature

* Add timeout log

* Fix documents
2020-01-02 01:08:34 -08:00
Prabir Shrestha
3aba91cf71 remove lsp#utils#to_col in favor of lsp#utils#position#_lsp_to_vim (#645)
* refactor to use lsp#utils#position#_lsp_to_vim
* remove lsp#utils#to_col in favor of lsp#utils#position#_lsp_to_vim
* fix doc
2020-01-01 13:33:36 -08:00
hrsh7th
5d6de67839 Fix completion when enable g:lsp_async_completion (#615) 2019-12-24 23:02:17 -08:00
mattn
abc1d83dd5 Fix textEdit completion (#572) 2019-12-23 13:59:41 -08:00
Yasuhiro Matsumoto
afaba6a1f2 Revert accidentially commits pushed to master branch. 2019-12-23 01:05:56 +09:00
Yasuhiro Matsumoto
5200a71411 Fix last position 2019-12-22 20:02:12 +09:00
Yasuhiro Matsumoto
6d44e0c200 Merge branch 'master' into fix-snippet-complete 2019-12-22 19:50:35 +09:00
Yasuhiro Matsumoto
7949fb410f Fix 2019-12-22 19:50:27 +09:00
Gavinok
d87513ff2d Handle error if the user hits escape before complete() is done (#578)
* Handle error if the user hits escape before complete() is done

* replaced tabs with spaces

* implemented should skip to avoid completing when not in insert mode

* fixed tabbing

* simplifed checking for insert on completion

* removed unnecessary else block

* replaced tabs with spaces
2019-12-11 20:05:38 -08:00
Yasuhiro Matsumoto
98c19a7e3e Check InsertTextFormat:Snippet 2019-11-21 16:50:56 +09:00
Yasuhiro Matsumoto
e22c13cced Fix snippet completion 2019-11-21 16:34:59 +09:00
Thomas Faingnaert
0e811a2874 Filter completions (#391)
* Filter completed items based on typed word

* Remove logs

* Only calculate typed_word once

* Revert "Only calculate typed_word once"

This reverts commit 161c7f460e.

* Revert "Remove logs"

This reverts commit 861c70fc7c.

* Revert "Filter completed items based on typed word"

This reverts commit c450e839b4.

* Reimplement filtering completion items

* Remove s:remove_typed_part

* Fix for NeoVim

* Use 'ignorecase' to filter items

* Allow configuration of filter

* Add documentation

* Add example for typed_pattern

* Change surrounding of `/$` to indicate it is a tag

* Add g:lsp_ignorecase

* Use filterText for filtering

* Add 'contains' filter

* Fix tests

* Avoid using regex

* Fix bug in 'contains' filter

* Use completion trigger chars for typed text

* Move copy

* Update documentation

* Use textEdit starting position

* Change default typed_pattern

* Update documentation

* Fix documentation

* Add note about narrowing down completions

* Fix tests

* Make filtering note clearer

* Remove duplicate text
2019-11-14 20:08:15 -08:00
Christian Clason
db2b675397 Allow for MarkupContent in completion info (#500)
* allow for MarkdownContent in completion info

* add check for correct type in MarkupContent

* also pass Markdown, and hope for the best

* d'oh!

* advertise plaintext preference in documentation

* fix documentationFormat

Co-Authored-By: Thomas Faingnaert <thomas.faingnaert@hotmail.com>
2019-10-03 16:17:40 +02:00
Christian Clason
d5ab74c91e Fixup custom-kind (#529) 2019-10-03 14:58:57 +02:00
Christian Clason
550c7eb95a Allow custom server-specific symbol and completion item kind (#524)
* allow customization of symbol_kinds

* allow customization of completion_item_kinds

* make server name optional

* add docs

* slightly rearrange documentation

* Remove trailing whitespace
2019-10-03 14:29:50 +02:00
machakann
3121f0a916 Multibyte-character support (Fix #425) (#490)
* Multibyte character support for lsp#get_position()

* Multibyte character support for "textDocument/documentHighlight"

* Fix `lsp#utils#byteindex()` would fails if a file is not yet loaded

* Add tests

* Rename lsp#utils#byteindex() and lsp#utils#charindex()

lsp#utils#byteindex() -> lsp#utils#to_col()
lsp#utils#charindex() -> lsp#utils#to_char()

* Multibyte character support for textEdit

* Remove unused line

* Multibyte character support for  "textDocument/rangeFormatting"

* Multibyte character support for  "textDocument/publishDiagnostics"
2019-09-08 09:13:09 -07:00
Christian Clason
886dfda496 Announce support for Item and Symbol kinds (#485)
* announce support for Item and Symbol kinds

* generate list of kinds from dictionaries
2019-09-07 16:41:29 +02:00
machakann
73d98fc328 Rename lsp#utils#byteindex to lsp#utils#to_col 2019-08-20 19:42:21 +08:00
Unknown
9906e085f1 Convert character-index to byte-index for textprop and location-list 2019-08-12 22:14:34 +08:00
Colin Cheng
2b583fefa2 Use g:ignorecase to indicates whether or not ignorecase to matchs completion word (#392)
* Adds `g:lsp_omni_completion_ignorecase` option to indicates whether or not ignorecase to matchs completion word

In most cases, ignorecase is not necessary, so we may add an option to control whether to turn it on.
Defaults, `g:lsp_omni_completion_ignorecase` is `0`, meaning case sensitive, if `g:lsp_omni_completion_ignorecase`
is set to `1`, or set `ignorecase` options(eg. `:set ignorecase`), it will turn case insensitive on.

* Fix CI failed

* Remove `g:lsp_omni_completion_ignorecase` options, only use `g:ignorecase` to indicates whether or not ignorecase to matchs completion word

* Refactor: cache prefix word
2019-06-25 11:15:51 -07:00
Thomas Faingnaert
20f5b7541a UltiSnips integration (#306)
* Implement basic UltiSnips integration

* Fix already inserted text not being removed

* Fix incorrect whitespace when nesting snippets

* Fix tabstops not working in nested snippets

* Make functions abort on error

* Check if Vim has the user_data patch

* Add basic documentation

* Add explanation UltiSnips integration to README

* Use single quoted string in plugin/lsp.vim

* Allow plugins to override get_completion_item

* Remove UltiSnips specific code to set user_data

* Remove CompleteDone autocmd from omni.vim

* Revert "Add explanation UltiSnips integration to README"

This reverts commit ee12343cbf.

* Revert "Add basic documentation"

This reverts commit 979275bb4f.

* Allow changing supported capabilities

* Remove g:lsp_ultisnips_integration

* Mention snippets in READE and documentation

* Add documentation for new configuration options

* Pass server_info to get_capabilities

* Change configuration variables to be a List

This way, we don't need to start them with a capital letter.

* Add lsp_complete_done autocmd

* Add documentation of lsp_complete_done
2019-06-15 12:06:16 -07:00
tsufeki
feba6d6d53 Support additionalTextEdits in completion items (#372)
* Support additionalTextEdits in completion items.

* Make cursor move as expected when applying completion edits.

* Fix for neovim.
2019-05-15 05:50:10 -07:00
tsufeki
e346c77475 Fix newline in completion popup. (#369)
* Fix newline in completion popup.
* Add test.
2019-05-12 22:34:57 -07:00
mikoto2000
185aee6ac9 Allowing empty word complete item (#378)
* Modify to allowing empty word complete item.
* Fix test.
2019-05-07 19:42:59 -07:00
mikoto2000
357a074c85 Delete TODO about 'user definition cursor position mechanism' in 'omni.vim'. (#364)
'user definition cursor position mechanism' is possible by 'snippet' mechanism.
(after merging 'ultisnips-integration')
2019-04-15 12:15:36 -07:00
mikoto2000
ee1dd1638a Add check whether user_data is json type. (#358) 2019-03-30 09:38:41 -07:00
mikoto2000
5c3dcc952b Fix to allow "textEdit property provide and null value". (#356) 2019-03-27 09:56:48 -07:00
mikoto2000
0372e2380e Added user_data type check. 2019-03-23 18:53:08 +09:00
mikoto2000
728e60b9b4 Modified error information process, to use lsp#utils#error and lsp#log. 2019-03-22 08:07:09 +09:00
mikoto2000
e8f3541741 Added has('patch-8.0.1493') check. 2019-03-20 05:20:15 +09:00
mikoto2000
25a0d7b67c Modified user_data encode/decode process to json_encode/json_decode. 2019-03-20 02:55:53 +09:00
mikoto2000
43a9752f1b Move textEdit's user_data to user_data['vim-lsp/textEdit']. 2019-03-18 21:59:34 +09:00
mikoto2000
421202982d Added "type" key existence check. 2019-02-25 22:58:21 +09:00
mikoto2000
369cf3f3c8 Fixed 'expand path methods'. 2019-02-24 19:29:37 +09:00
mikoto2000
9696023e21 Fixed 'string comparison operator'. 2019-02-24 19:24:19 +09:00
mikoto2000
2a7ea6cd61 Fixed vint errors. 2019-02-23 22:28:44 +09:00
mikoto2000
315d73c0bd Added textEdit support on omni complete. 2019-02-23 18:13:08 +09:00