Commit Graph

85 Commits

Author SHA1 Message Date
Colin Cheng
507565f281 fix eat of typing char after completion done (#1468)
When using typescript-language-server, in content `Math.ab|`, if you type
`<C-X><C-o>` for omni completion, it will be completed with `s`. Then, the
content will become `Math.abs|`. If you continue typing `(`, the `(` will
be removed. Also, if type `<CR>`, a new line will be added, resulting in
`Math.abs|s\nMath.ab`. This patch attempts to fix this issue.
2023-04-27 23:21:05 +09:00
Illia Bobyr
44608334f9 Allow workspace_config to be a function (#1400)
It is sometimes useful to generate `workspace_config` using a callback.
For example, if the produced config needs to include some information
from the actual workspace.
2023-04-03 17:16:42 -07:00
hrsh7th
771755300a Implemented word correction in cases where startcol was corrected by … (#1340)
* Implemented word correction in cases where startcol was corrected by TextEdit.range.start.character

* Don't touch abbr

* Don't use `..`

* relax get_server_info

* Improve for deno lsp item

* Fix start character

* minimal `insertReplaceTextEdit` suppoort.

* Change to filter logic similar to asyncomplete-lsp.vim

* Improve word creation

* relax lsp#utils#text_edit#get_range

* Add start_character for test case
2022-07-22 11:19:16 +09:00
hrsh7th
a91419ea0a Use textEdit.range.start.character as a complete col (#1236) 2021-11-30 14:47:12 +09:00
Linda_pp
9f7359303b Fix completion sort (#1225)
* fix sorting completion items is broken since Vim script's string is always falsy

* add test case to sort items in case insensitive
2021-09-23 09:56:45 +09:00
Shinya Ohyanagi
f88a233731 Add sortText for completion items ordering (#1223)
* Add sortText for completion items ordering

* Fix config sort by each language server

* Fix remove log

* Update autoload/lsp/omni.vim

Co-authored-by: Linda_pp <rhysd@users.noreply.github.com>

* Update doc/vim-lsp.txt

Co-authored-by: Linda_pp <rhysd@users.noreply.github.com>

* Fix use v:null instead v:none

Co-authored-by: Linda_pp <rhysd@users.noreply.github.com>
2021-09-23 09:09:39 +09:00
hrsh7th
2c4d33838b Update vital-vs (#1205)
* Update vital-vs

* Fix tests

* Add end_lnum/end_col if feature was detected

Co-authored-by: Linda_pp <rhysd@users.noreply.github.com>
2021-08-28 01:29:45 +09:00
hrsh7th
27e9c374d6 Fix completion item creation (#1214)
* Fix typos

* Fix test case
2021-08-28 00:20:01 +09:00
mattn
516fd7ce95 diagnostics list can be v:null (#1190)
* diagnostics list can be v:null

Ref #1186

* ditto

* Small refactoring

* Use lsp#utils#iteratable for the list which possibly be v:null
2021-06-09 01:51:59 +09:00
Linda_pp
72b9a300c7 Set type of location list items for diagnostics (#1143)
* set type of location list items for diagnostics

* use s:get_diagnostic_severity_text() once while making location list from diagnostics results

Co-authored-by: mattn <mattn.jp@gmail.com>
2021-06-07 20:47:17 +09:00
Linda_pp
337d834443 Include command argument labels in Code Lens item's text (fix #1118) (#1119)
* fix index out of range error when no item in quickpick list

* update embedded quickpick to cf41eecb983c41e5fc45e83291b551a85fe554d3

* generate subtitle of codelens item from command arguments' labels

* add tests for lsp#ui#vim#code_lens#_get_subtitle()
2021-03-28 11:58:41 -07:00
Linda_pp
800c878209 Support show message notification by handling window/showMessage response (#1120)
* support window/showMessage

* describe g:lsp_show_message_log_level in documentation

* add tests for window/showMessage support

Co-authored-by: mattn <mattn.jp@gmail.com>
2021-03-28 21:58:20 +09:00
Linda_pp
8a39ef5904 Add integration tests with gopls instead of rust-analyzer (#1108)
* Revert "remove flaky integration tests (#1098)"

This reverts commit 78c107085a.

* use gopls for integration tests instead of rust-analyzer

* specific Go and gopls versions via envvar on CI

* remove unused test helper for Rust test project

based on https://github.com/prabirshrestha/vim-lsp/pull/1108#discussion_r595689580

* include multibyte text in integration test case

based on https://github.com/prabirshrestha/vim-lsp/pull/1108#discussion_r595690354

* cache gopls binary on running CI workflows

* update doc to run integ tests
2021-03-20 10:54:17 -07:00
Prabir Shrestha
78c107085a remove flaky integration tests (#1098) 2021-03-14 13:23:20 -07:00
Linda_pp
f076e6a7c0 Use 'label' value when 'insertText' or 'filterText' is falsy (#1095)
* use label when filterText is falsy value

* use label when insertText is falsy value on completion done

* Revert "fix inserting "v:null" when newText in textEdit is null (#1093)"

This reverts commit 907f1c9667.

* Revert "add test case where newText is null for #1093 (#1094)"

This reverts commit e214f1cfee.
2021-03-14 01:59:08 +09:00
Linda_pp
e214f1cfee add test case where newText is null for #1093 (#1094) 2021-03-13 23:50:58 +09:00
Prabir Shrestha
90d61f1114 fix snippet (#1051)
* fix snippet
* add snippet test
2021-01-16 12:09:01 -08:00
Prabir Shrestha
6038748cb1 Improve completion perf (#1038)
* improve completion perf

* improve completion popup perf

* fix tests

* remove old s:get_vim_completion_item
2021-01-16 11:05:21 -08:00
Prabir Shrestha
098509278d refactor diagnostics count to using diagnostics state (#999) 2021-01-02 00:14:05 -08:00
micchy326
7770b7d5a3 Add public api get window/workDoneProgress (#979)
* impl lsp#get_progress() for statusline plugin.

* add workDoneProgress spec link

* refactor s:handle_work_done_progress()

* [workDoneProgress] prevent to subscribe multiple times

* [workDoneProgress] Fixed s:lsp_progress['percentage'] to always be float

* [workDoneProgress] support multiple progress registration.

* [workDoneProgress] Fixed s:lsp_progress['percentage'] to uinteger

* [workDoneProgress] fix for vint

* [workDoneProgress] rename variable

* [workDoneProgress] add test

* [workDoneProgress] write document

* [workDoneProgress] initialize s:progress_ui when enable/disable

* [workDoneProgress] refactor test code

* [workDoneProgress] add lsp_progress_updated

* [workDoneProgress] fix typo

* [workDoneProgress] refactor token handling

* [workDoneProgress] Fixed differences from
specifications(messages->message)

* [workDoneProgress] fix test
2020-12-31 10:51:20 -08:00
Prabir Shrestha
58e81e6fca try fix mac neovim ci (#992)
* try fix mac neovim ci
* remove document_definition integration tests
2020-12-30 14:35:47 -08:00
mattn
4f4fdf4aa1 Fix tests (#989)
* Sort results
* Sort by text
* Workaround for older version of Vim that does not include module in the list given from getloclist
* Sort items by text
* Fix test
2020-12-30 10:26:01 -08:00
Prabir Shrestha
6bb6069f94 Diagnostics for all buffers (#982)
* render diagnostics in loclist and fix args paser
* document --buffers flag for LspDocumentDiagnostics
* do not show diagnostics if it is disabled for buffer
* remove old code and fix plug mapping for lsp-document-diagnostics
* add unit tests for document diagnostics command
2020-12-27 22:44:18 -08:00
Prabir Shrestha
8f5bec6ce9 add buffer state of disabled diagnostics state (#981) 2020-12-27 18:29:22 -08:00
Prabir Shrestha
778ebd3ca2 add internal/diagnostics/state.vim (#978)
* add internal/diagnostics/state.vim

* add unit tests

* add s:enabled

* clean up diagnostics state during server exit

* remove echom

* add tests for lsp_server_exit

* reset when enable

* add notify function

* add link to diagnostics spec
2020-12-27 11:27:17 -08:00
bamchoh
5f23ecd388 Convert lowercase drive letters to uppercase (#953)
* Convert lowercase drive letters to uppercase

I faced a problem that error diagnostics message does not shown in golang source code. In a result of my investigation, this problem occurs when I change the current directory with lowercase driveletter like `cd c:\dev\go\test001`. When `cd C:\dev\go\test001` is no problem. To avoid this problem, we need to convert driver letter to uppercase in lsp#utils#path_to_uri function.

* Update utils.vimspec

* Revise a code in diagnostics.vim instead of utils.vim to reduce impact of modification

* Create a function to normalize uri

* Add a comment about normalize discussion

* Delete s:is_win check

* Revise comment for normalization of urls
2020-12-25 11:11:47 -08:00
Prabir Shrestha
0c2a9d34e0 add goto definition integration tests for same file (#972)
* add goto definition integration tests for same file
2020-12-24 14:21:49 -08:00
Prabir Shrestha
4ff1d41412 [WIP] do not merge: integration tests with language servers (#959)
* download rust-analyzer

* added empty testproject-rust

* add integration tests for LspDocumentFormatSync

* wipeout all buffer

* set shiftwidth and tabstop

* set gobal shiftwidth and tabstop

* remove tabstop

* sleep 100m

* remove l:got

* get latest line

* sleep 4000m

* use setl shiftwidth=4

* use %bwipeout!

* wait for rust-analyzer to start

* fix lint issues

* indent left

* remove log

* disable log

* set timeout to 10sec

* add 100m sleep

* download rust-analyzer for linux neovim

* add message to diagnostics test

* severity is optional in diagnostics

* download rust-analyzer for mac_neovim

* update README.md with test section
2020-12-23 20:10:22 -08:00
Prabir Shrestha
3176fd0fd4 use reporter spec by default in themis (#962) 2020-12-23 17:58:48 -08:00
Prabir Shrestha
aef000765c four spaces (#961) 2020-12-23 17:51:54 -08:00
Prabir Shrestha
67c6e9040a always add range for diagnostics test (#960) 2020-12-23 17:27:39 -08:00
Prabir Shrestha
5c91c59f2a add lsp#utils#buffer#get_indent_size() (#957) 2020-12-23 11:48:46 -08:00
William Boman
fdb69ab913 populate location list with all modified changes in a WorkspaceEdit (#555) 2020-10-23 19:41:32 -07:00
mattn
6da958babd Fix 849: find nearest paths (#905) 2020-09-18 23:21:08 -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
Prabir Shrestha
e0cacffe54 optimize lsp#omni#get_vim_completion_items() (#835)
* optimize

* fix two omni tests

* fix omni tests
2020-06-13 02:11:02 -07:00
Prabir Shrestha
8df76a63c0 [perf] add g:lsp_get_vim_completion_item_set_kind to enable or disable kind (#824)
* add g:lsp_get_vim_completion_item_set_kind to enable or disable kind
* enable lsp_get_vim_completion_item_set_kind for tests
2020-05-24 23:36:42 -07:00
mattn
7ce02b0781 Fix lsp#utils#path_to_uri (#809)
This should accept URI
2020-04-30 21:55:22 +09:00
hrsh7th
cbddb059b5 Add snippet indicator (#759) 2020-04-19 10:14:38 -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
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
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
hrsh7th
3e207c0ee4 Change text edit implementation to support \r (#718)
* Change text edit implementation to support \r

* Fix edit on unloaded buffer

* Add \r\n tests

* Fix for perf

Co-authored-by: mattn <mattn.jp@gmail.com>
2020-02-15 00:39:40 +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
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
70234feca4 Improve code action (#663)
* Improve code action

* Add LspCodeActionSync

* Fix miss argument

* Fix for the review

* Add utils and tests

* Remove unused function
2020-01-09 08:35:39 -08: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
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