Commit Graph

225 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
6d4719e794 make lsp#ensure_flush_all public for delaying initialize 2025-11-03 08:10:25 +09:00
Rodrigo Goya
6b7aabde99 Add check for server entry in buffer entry. (#1548) 2024-07-19 22:59:14 -07:00
Krzysztof Sachanowicz
3af8f3b38e Fix various bugs when loading many buffers (#1511)
* fix languageId incorrectly set to "ctrlspace"

* remove get_line_count_buf() which incorrectly returned line('$') for hidden buffers

The problem was that current buffer may not be the one requested. Later it
caused vim to throw exception about invalid line number when setting text props,
and that led to initialization failure for some buffers (and lsp_buffer_enabled
autocommand not fired).

* don't register server twice

* skip registering server only if server_info matches

* revert changes to lsp#register_server

---------

Co-authored-by: Krzysztof Sachanowicz <ksachanowicz@striketechnologies.com>
2023-11-24 19:40:24 -08:00
Illia Bobyr
aa93b2a570 LspStopServer: Stop all and stop specific (#1491)
It is convenient to be able to stop all LSP servers, regardless of the
currently active buffer.

Also, it seems confusing that when a server name is specified, it is
only stopped if it is also one handling the current buffer type.  I
would imagine it is quite rare to have more than one server handing a
specific buffer type.  And if one explicitly specified a name, it seems
reasonable to stop this particular server, regardless of the currently
active buffer.
2023-09-08 21:17:24 -07: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
Prabir Shrestha
5c1df0cf12 Prefer native lsp api when in vim. (#1362)
* add g:lsp_experimental_native_lsp flag to enable native vim lsp client

* send request and correctly call on_notification

* add support for native client in lsp#client#send_notification

* Add native lsp client support for lsp#client#send_response

* add native notification support

* add support for native stop job

* handle error response for document_formatting.vim and code_action.vim

* add missing return for code action

* fix indent

* undo code action error

* check for a:response to be of type dict as stderr will send string

* use out_cb and err_cb instead of channel callback

* bump has_native_client version check to 8.2.4780 which fixes LSP parsing messages when partial data is received

* rename g:lsp_experimental_native_lsp to g:lsp_use_native_client

* fix s:native_err_cb

* pass env

* disable lsp_use_native_client

* add lsp#utils#has_native_lsp_client()

* clean up log

* handle requests from server

* fix lint issues

* update docs
2022-12-19 19:44:45 -08:00
David Briscoe
0c8fda7921 Print workspace_config with :verbose LspStatus (#1279)
* Make verbose LspStatus show workspace config

Need the trailing echo to ensure the next lsp server is on a new line.

* Use pretty printing if available

* checkhealth: Print server status and config

Add initial checkhealth support.
See https://github.com/rhysd/vim-healthcheck

Lists server status, advice for failure, and lists workspace config to
help debug issues or understand server state. Doesn't do much error
detecting.

* checkhealth: Print each server config as a section

checkhealth doesn't allow a lot of formatting (no indentation), so it's
hard to make the config output readable. Output each server as a
separate section instead of one giant config block to make the start of
each server easier to see.
2022-10-29 10:43:57 -07:00
Takayuki Tsukitani
9d4dbf7e68 move symbol into workspace (#1382) 2022-10-24 18:47:35 -07:00
Takayuki Tsukitani
a85b71bfc8 Fix default supported capabilities (#1379)
* add missing supported capabilities

* sort alphabetically

* set `dynamicRegistration` to `v:false` for adding capabilities

* add `prepareSupportDefaultBehavior` to `rename` capability
2022-10-19 18:26:32 +09:00
Lie Ryan
2bb97d2938 Replace references to pylsp with pyls (#1378)
The palantir pyls repository is no longer maintained, the documentation
should not lead user down the path of configuring this dead end project.
pylps is the actively maintained sucessor project forked from pyls.
2022-10-16 20:30:19 -07:00
mattn
4d8a27513d Inlay hint (#1347)
* inlay hint

* implement inlayHints

* implement inlayHints

* update doc

* fix

* fix

* separate highlights

* update/clear

* use callbag

* remove from doc

* disable default

* update doc

* check version

* check label array

* call prop_remove()

* use lsp#utils#range#get_range()

* add comma

* add lsp_inlay_hints_mode

* own highlight

* update doc

* fix style check

* rename

lsp#utils#_has_virtual_text to lsp#utils#_has_nvim_virtual_text
lsp#utils#_has_vim9textprops to lsp#utils#_has_vim_virtual_text

* update doc

* fix version

* remove all
2022-08-25 02:02:42 +09:00
Radek Simko
e5d2d3f744 fix reporting of typeHierarchy capability (#1350) 2022-08-20 11:32:46 -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
frankplow
68c018eb1a Semantic Tokens Support (#1275)
* initial naive implementation of semanticTokens

* fix race condition when starting new lsp server

* fix error when closing and re-opening a buffer

* support nvim highlighting

* provide tokenTypes and tokenModifiers client capabilities

* move semantic.vim to autoload/lsp/internal

* refactor semantic tokens to use a callbag

* remove scope tree functions

* refactor decoding of semanticTokens responses

* improve semantic tokens nvim support

* add support for multi-byte characters

* update semantic tokens on TextChangedP

* don't apply semantic highlighting to large files

* replace semantic_highlight server key with custom highlight groups

* rename g:lsp_large_buffer_threshold to g:lsp_max_buffer_size

* fix typo: correct LpEvents to LspEvents

* update semantic highlighting documentation

* change has('popupwin') to exists('autoload/lsp/internal/semantic.vimTextChangedP')

* correct lsp_max_buffer_size usage

* add LspSemanticHighlightGroups helper command

* use explicit scope and reorganise decode_tokens

* use robust comparison + single quoted strings in s:init_highlight

* update semantic highlighting on VimEnter

* support semanticTokens/full/delta requests

* request semanticTokens/full on BufNewFile or BufReadPost

* perform full semantic updates on lsp_buffer_enabled

* support SemanticTokensDelta response to textDocument/semanticTokens/full/delta request

* decide between full or delta semanticTokens request based on state

* use prop_add_list to add semantic tokens

* sort semanticTokens edits before applying

* update semantic.vim to conform to google style guide

* update default semantic highlight groups to better match usage

* fix parsing of SemanticTokensOptions

* mention g:lsp_semantic_enabled in vim-lsp-semantic docs

* document g:lsp_semantic_delay

* add support for semantic token modifiers

* sort semantic tokens modifiers alphabetically

* correctly report semantic tokens capabilities
2022-06-30 20:11:47 -07:00
fungus
74e458bc9c add new preview window id api (#1323)
* add new preview window id api
resolves #1281

* add alias for getpreviewwinid()

* add documentation
2022-06-17 22:32:24 -07:00
mattn
013625b3b1 fix queue (#1316) 2022-05-23 10:17:33 +09:00
mattn
1e1a0981a7 check server_name (#1315) 2022-05-23 02:01:33 +09:00
mattn
8df4aa4019 Send response for workspace/workspaceFolders (#1302)
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_workspaceFolders
2022-04-18 02:44:37 +09:00
mattn
49656401fc Add env (#1292)
* passing env to lsp#utils#job#start

* passing env to lsp#client#start

* env for only cmd

* do not need to add

* possible to specify env for the server

* update job.vim
2022-04-05 07:39:13 +09:00
Prabir Shrestha
3d0fc4072b Add initial support for workspace folders (#1265)
* add g:lsp_experimental_workspace_folders

* send client capabilities for workspaceFolders if g:lsp_experimental_workspace_folders is enabled

* fix g:lsp_experimental_workspace_folders missing s

* send workspaceFolders if workspaceFolder capability is defined via client

* add local copy add opened workspace folders

* Add support for workspace folders

* document Workspace folders

* add indent

* fix doc indent
2022-02-12 12:28:43 -08:00
Eric Larson
66b56c026f highlight change: NonText -> Comment (#1266) 2022-01-14 17:56:49 -08:00
Prabir Shrestha
10bbcb1142 use new floating window api for hover (#1078)
* use new floating window api for hover

* rename type to ui

* fix lint issues

* add support for --ui=float|preview for LspHover

* add g:lsp_hover_ui

* always show below the cursor

* close on move

* fix when using empty g:lsp_hover_ui

* add hover preview support

* apply markdown for preview

* show top if available

* fix col position when far right

* silent deletebufline

* fix indent

* remove language

* set language

* fix normalize

* don't close if curpos hasn't changed

* if hover window is foused close

* add border

* add double tap support for floating LspHover window and lsp-hover-close plug

* fix indent

* fix lint issue

* fix grammar

* *ed

* remove echom register

* fix indent

* add lsp-hover-float and lsp-hover-preview plug
2021-12-17 15:04:04 -08:00
hrsh7th
a91419ea0a Use textEdit.range.start.character as a complete col (#1236) 2021-11-30 14:47:12 +09:00
mattn
ee38eb1bc6 Support untitled buffer (#1152)
* Support untitled buffer

* Enable opt out

* Add documentation

* Add documentation

* Use correct buffer names

* Wipeout file contents
2021-09-27 18:22:58 +09:00
hrsh7th
4f2d66d061 Add publishDiagnostics capabilities (#1212) 2021-08-27 14:12:35 +09:00
Prabir Shrestha
fb0a72306e Revert "perf: parse array instead of combining it to string (#1175)" (#1199)
This reverts commit f53a98754e.
2021-06-16 00:14:44 -07:00
hrsh7th
ddd5abb5b6 Fix borderchars and debug=throw (#1178) 2021-06-02 12:56:57 +09:00
Prabir Shrestha
f53a98754e perf: parse array instead of combining it to string (#1175) 2021-05-30 13:17:54 -07:00
hrsh7th
9dc382c04a Send workspace_config only if changed (#1137) 2021-04-12 20:16:39 +09:00
Linda_pp
ce3add957a Fix document layout and misspellings (#1127)
* fix document layout

* fix misspellings
2021-03-31 23:09:06 +09:00
Linda_pp
4d4a908224 select preferred action by default in quickpick (#1126)
spec: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
2021-03-30 02:30:38 +09: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
a3b58eb7c4 Handle disabled code action (#1115)
* handle disabled code action

* enable disabledSupport capability

Co-authored-by: hrsh7th <hrsh7th@gmail.com>
2021-03-21 22:17:51 +09:00
Prabir Shrestha
eb237a2ced [WIP] add codeaction sign support (#1085)
* add codeaction sign support

* add hl LspCodeActionText

* add docs

* add support for multiple servers

* only set signs if buffer exists
2021-03-06 10:56:44 -08:00
Prabir Shrestha
ca2b527dc5 add lsp#notification() for proper $/cancel support (#1079) 2021-02-28 13:47:45 -08:00
hrsh7th
6a2b97cd59 Add scroll keymapping (#1058)
* Add lsp#scroll function

* Update README.md

* Add example setting to docs
2021-02-22 20:51:48 +09:00
Prabir Shrestha
21a29936ed pass server_name as part of next notification in lsp#request (#1064) 2021-02-02 04:10:04 +00:00
Prabir Shrestha
cacfc79eb4 completion/resolve support for documentation and use the new floating window (#1052)
* doc

* floating window with completion/resolve

* add comments

* use _split_by_eol

* copy event

* fix dupe

* Fix size/markdown/detail

* - Improve for exceptional case
- Fix code style
- Support detail only case

* Add lsp_float_opened/lsp_float_closed

* remove old documentation code

* update documenation and change flags to use g:lsp_completion_documentation

Co-authored-by: hrsh7th <hrsh7th@gmail.com>
2021-01-23 09:11:27 -08:00
Prabir Shrestha
1a7a6e08de add support for codeLens/resolve (#1007) 2021-01-02 19:25:19 -08:00
Prabir Shrestha
d78d219abd allow to enable or disable diagnostics per buffer (#1005) 2021-01-02 14:20:05 -08:00
Prabir Shrestha
268341fe60 Diagnostics refactor movements (#1004) 2021-01-02 13:59:31 -08:00
Prabir Shrestha
7c43b01635 refactor diagnostics get buffer first error line to use the new internal state (#1003) 2021-01-02 13:06:07 -08:00
Prabir Shrestha
098509278d refactor diagnostics count to using diagnostics state (#999) 2021-01-02 00:14:05 -08:00
Prabir Shrestha
efd07d859e Revamp diagnostics highlights (#995) 2020-12-31 23:13:19 -08:00
Prabir Shrestha
b4f710f143 use callbag share for stream and avoid directly using s:Stream (#996)
Returns a shared version of callbag when calling lsp#stream so that there is a refcount to avoid accidental unsubscriptions and new subscribers will auto subscribe.
2020-12-31 22:14:27 -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
mattn
ee854b4c55 Add tcp feature (#985)
* Add tcp feature

* Update doc

* Update async.vim embed

* Update doc
2021-01-01 01:28:06 +09:00
Prabir Shrestha
5743ae2110 Diagnostics signs revamp (#994) 2020-12-31 01:23:26 -08:00
Prabir Shrestha
1489cf8295 Revamp diagnostics virtual text (#990) 2020-12-30 14:49:44 -08:00
Prabir Shrestha
c4a867b51c add lsp_server_exit notification (#980) 2020-12-27 10:59:27 -08:00