Commit Graph

69 Commits

Author SHA1 Message Date
Aleksey Kladov
be84f85c1d feat: gate custom clint-side commands behind capabilities
Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
2021-07-30 19:16:33 +03:00
Aleksey Kladov
68836c0dbe minor: drop impl-specific stuff from lsp docs
The lc. prefix is a copy-paste from our typescript code, it doesn't make
sense in the impl-agnostic docs.
2021-07-30 16:37:41 +03:00
Alexander Gonzalez
41943f2328 refactor: Apply PR suggestions 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
c6fab1993a test: Update lsp_ext.rs hash 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
ca85185bc6 docs: Update the lsp-extensions.md with the Hover Range capability 2021-07-27 18:31:21 -04:00
bors[bot]
2c638a467e
Merge #9709
9709: fix: add capability for "open cargo.toml" lsp extension r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-27 16:41:02 +00:00
Aleksey Kladov
7d6c4142b2 fix: add capability for "open cargo.toml" lsp extension 2021-07-27 19:40:19 +03:00
Alexander Gonzalez
c865b56744 docs: Fix several typos and grammar mistakes 2021-07-26 18:15:40 -04:00
Aleksey Kladov
f34762abb7 internal: better factoring for to_proto::completion
One source completion can produce up to two lsp completions.
Additionally, `preselct` and `sort_text` are global properties of the
whole set of completions, so the right granularity here is to convert
many completions.

As a side-benefit, we no loger allocate intermediate vec.
2021-07-04 14:08:33 +03:00
Jonas Schievink
5f13fb9db9 Add "View Crate Graph (Full)" 2021-07-02 00:10:33 +02:00
Aleksey Kladov
cabb679cbb internal: explain the motivation behind early configuration 2021-05-27 11:16:14 +03:00
Jonas Schievink
3360053312 Update lsp-extensions.md 2021-05-22 00:03:36 +02:00
Aleksey Kladov
1fd31f7f4c feat: allow clients to feature detect symbol filtering 2021-05-19 13:28:58 +03:00
alcroito
1f7d2a6c22 Add new LSP extension for workspace symbol lookup
The new extension allows filtering of workspace symbool lookup
results by search scope or search kind.

Filtering can be configured in 3 different ways:

 - The '#' or '*' markers can be added inline with the symbol lookup
   query.

   The '#' marker means symbols should be looked up in the current
   workspace and any dependencies. If not specified, only current
   workspace is considered.

   The '*' marker means all kinds of symbols should be looked up
   (types, functions, etc). If not specified, only type symbols are
   returned.

 - Each LSP request can take an optional search_scope or search_kind
   argument query parameter.

 - Finally there are 2 global config options that can be set for all
   requests served by the active RA instance.

Add support for setting the global config options to the VSCode
extension.
The extension does not use the per-request way, but it's useful for
other IDEs.

The latest version of VSCode filters out the inline markers, so
currently the only reasonable way to use the new functionality is
via the global config.
2021-05-18 00:40:30 +02:00
Jonas Schievink
b8d40a02a9 Document viewCrateGraph request 2021-05-11 16:45:51 +02:00
Aleksey Kladov
dcb759b727 Remove confusion around serverStatusNotification 2021-04-19 18:12:25 +03:00
Aleksey Kladov
e5d91e8992 Fix spec bug 2021-04-19 17:55:51 +03:00
Lukas Wirth
b501b59eda Update lsp-extensions docs 2021-04-18 12:50:44 +02:00
Jonas Schievink
30aae2cefb Move cursor position when using item movers 2021-04-14 00:03:04 +02:00
Kirill Bulatov
b5f3815aee Small grammar fixes 2021-04-06 21:42:27 +03:00
Aleksey Kladov
8fe20b19d4 More robust status notifications 2021-04-06 15:45:31 +03:00
sim
d542a2b463
docs: Fix moveItem method name 2021-04-04 11:49:32 -07:00
ivan770
7d60458495
Item up and down movers 2021-03-18 11:22:27 +02:00
bors[bot]
7accf6bc37
Merge #7799
7799: Related tests r=matklad a=vsrs

![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif)
This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc

The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :)



Co-authored-by: vsrs <vit@conrlab.com>
2021-03-13 13:50:35 +00:00
vsrs
49cdb2452a Fix LSP extensions documentation 2021-03-11 17:59:27 +03:00
Aleksey Kladov
5b2b310827 Clarify that all caps are experimental 2021-03-09 12:02:20 +03:00
vsrs
5e88436517 Update lsp-extensions.md 2021-02-27 21:07:58 +03:00
Aleksey Kladov
3f09e3fba6 document offsets 2021-02-16 19:22:09 +03:00
ivan770
13e9d9809a
Remove CodeLensResolveData mention from lsp-extensions.md 2021-02-13 19:36:29 +02:00
ivan770
185da286d2
Moved CodeLens to ide crate 2021-02-13 13:07:47 +02:00
Peter Wischer
f18fc5a0ae fix nightly warning legacy_derive_helpers
see https://github.com/rust-lang/rust/issues/79202
2021-02-12 13:57:38 +01:00
Lukas Wirth
f82ce500a9 Fix spelling mistakes in docs/dev 2021-02-03 13:46:51 +01:00
Edwin Cheng
d069ef60b6 Update lsp-extension.md hash 2021-01-29 01:32:31 +08:00
Edwin Cheng
edcafe7865 Update doc 2021-01-29 01:04:14 +08:00
Phil Ellison
db53db8046 Address review suggestion, fix tidy tests 2021-01-01 19:25:18 +00:00
kjeremy
233fdb12ce Latest LSP 3.16 protocol
Pulls in https://github.com/gluon-lang/lsp-types/pull/186
2020-11-16 15:10:13 -05:00
Anatol Liu
b1b7727e04 add open Cargo.toml action 2020-11-12 17:48:07 -08:00
Aleksey Kladov
7d2eb000b0 Switch to upstream protocol for resolving code action
Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.
2020-11-10 18:48:46 +01:00
Igor Aleksanov
d718366567 Document change of 'cargo' Runnable kind in lsp-extensions.md 2020-10-16 20:58:57 +03:00
Aleksey Kladov
d852189e56 Add reminder to update lsp-extensions.md 2020-10-14 13:30:06 +02:00
Zac Pullar-Strecker
f1decfc110 Fix send->sent typo 2020-10-08 15:04:57 +13:00
Zac Pullar-Strecker
62b76e7004 Document the protocol extension 2020-10-08 15:04:20 +13:00
Aleksey Kladov
af8063fe37 Extend **Status** command to also show dep info for the file
This should help with troubleshooting wrong project configuration
2020-09-29 22:13:23 +02:00
vsrs
1eed036a6e Fix StatusNotification 2020-08-17 14:56:27 +03:00
David Lattimore
3975952601 SSR: Pass current file position through to SSR code.
In a subsequent commit, it will be used for resolving paths.
2020-07-24 21:34:00 +10:00
Jeremy Kolb
9c0ead30b9
Clarify initializationOptions 2020-07-22 10:05:36 -04:00
Aleksey Kladov
3ef7676076 Implement StatusBar 2020-07-02 15:32:14 +02:00
Aleksey Kladov
c9f878962a Add reload workspace command 2020-07-01 14:57:59 +02:00
vsrs
da7ec4b339 Add hover actions LSP extension documentation. 2020-06-05 15:00:28 +03:00
Mikhail Rakhmanov
1f7de306f5 Add documentation 2020-06-03 18:57:50 +02:00