Commit graph

319 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
bors[bot] bf8a55a2df
Merge #9692
9692: Use same cancelled spelling in doc and code. r=matklad a=mattiasgronlund

Right thing might be to update the spelling in the code to
follow American instead of English spelling, that is
using only canceled. But they should at least be aligned.

Co-authored-by: Mattias Grönlund <mattias@gronlund.se>
2021-07-26 10:29:24 +00:00
Jonas Platte c0107d2ea6
Fix some grammar / spelling mistakes 2021-07-26 10:12:41 +02:00
Mattias Grönlund 9e99a9b860 Use same cancelled spelling in doc and code.
Right thing might be to update the spelling in the code to
follow American instead of English spelling, that is
using only canceled. But they should at least be aligned.
2021-07-25 23:18:59 +02:00
Aleksey Kladov efa4a36a50 docs: publish Explaining Rust Analyzer series 2021-07-19 23:41:15 +03:00
Aleksey Kladov 1dc337645a minor: typo 2021-07-19 19:18:39 +03:00
Aleksey Kladov 6a0f7f0852 internal: explain why we avoid serializing everything 2021-07-19 17:47:56 +03:00
Alexander Gonzalez 60be683d5e
fix: Typo in architecture.md 2021-07-18 22:17:45 -04:00
Aleksey Kladov a9d0d1414a internal: remove erroneous default impl 2021-07-12 20:18:07 +03:00
Aleksey Kladov 706bd1c35d minor: one more usless type 2021-07-08 17:18:44 +03:00
Aleksey Kladov 0db4f3f6a4 internal: ensure consistent passing for config params
We pass "context" parametes first, so configs should be on the left.
"Bigger" context wins, so configs goes after db.
2021-07-06 00:00:39 +03: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
Aleksey Kladov 3be9ebe2c3 minor: style 2021-07-04 12:48:29 +03:00
Aleksey Kladov 58d2ece88a internal: overhaul code generation
* Keep codegen adjacent to the relevant crates.
* Remove codgen deps from xtask, speeding-up from-source installation.

This regresses the release process a bit, as it now needs to run the
tests (and, by extension, compile the code).
2021-07-03 22:11:03 +03:00
Jonas Schievink 5f13fb9db9 Add "View Crate Graph (Full)" 2021-07-02 00:10:33 +02:00
bors[bot] 37dc2dfada
Merge #9348
9348: output to log file if RA_LOG_FILE is defined in environment r=rezural a=rezural

This adds a check for RA_LOG_FILE, and logs to that if defined. It currently overrides flags.log_file. If this is undesirable, I will add a check.

Co-authored-by: rezural <rezural@protonmail.com>
2021-06-21 21:42:02 +00:00
rezural ceeee5e3c6 add documentation of RA_LOG_FILE 2021-06-22 07:28:33 +10:00
rezural 530ee4ff8a
add note about passing cfg(debug_assertions)
add note about passing cfg(debug_assertions) to rustc on build. The server will not spin without this arcane hack
2021-06-20 11:23:20 +10:00
Aleksey Kladov 3f4ad44082 internal: document that we don't #[ignore] tests 2021-06-15 11:46:47 +03:00
Jade e23cfeac71
Fix typo in env-var quoting 2021-06-14 00:38:28 -07:00
Florian Diebold 0290b61b1b
Further clarification 2021-06-07 14:50:03 +02:00
Florian Diebold b649376edc
One additional grammar fix 2021-06-07 14:43:58 +02:00
Florian Diebold fc2d286dae
Clarify label documentation
Also some other cleanups while I'm there.
2021-06-07 14:34:41 +02:00
Aleksey Kladov 5e577a6373 minor: expand docs a tiny bit 2021-05-31 17:27:27 +03:00
Lukas Wirth fb7105a580 Add config setting for self-on-the-fly 2021-05-31 15:14:56 +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
Aleksey Kladov 41510f437e minor: adjust config name 2021-05-17 18:37:06 +03:00
Aleksey Kladov 0650f77dd9 internal: remove one more immutable tree 2021-05-14 16:19:27 +03:00
Aleksey Kladov ad0648dc95 Cleanup imports 2021-05-13 13:44:47 +03:00
Jonas Schievink b8d40a02a9 Document viewCrateGraph request 2021-05-11 16:45:51 +02:00
Aleksey Kladov d4a51241ce internal: explain why sentence-per-line 2021-05-06 17:40:36 +03:00
Aleksey Kladov 3f6980e4e1 simplify macro expansion code
Using `Option` arguments such that you always pass `None` or `Some` at
the call site is a code smell.
2021-05-04 22:41:46 +03:00
bors[bot] 576f50637c
Merge #8605
8605: internal: Automatically categorize the changelog entries r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-22 17:35:41 +00:00
Aleksey Kladov 27073f4fc3 feat: make sure nightly regressions don't break users 2021-04-22 11:15:20 +03:00
Laurențiu Nicola 39ce393a9e Automatically categorize the changelog entries 2021-04-20 19:54:58 +03:00
bors[bot] 15b34667c5
Merge #8588
8588: internal: Add guidelines for release notes PR descriptions r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-19 18:38:34 +00:00
Laurențiu Nicola bb4952da04 internal: Add guidelines for release notes PR descriptions 2021-04-19 21:30:44 +03: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
Aleksey Kladov 453b9cf6f0 Update docs/dev/README.md
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-04-19 16:08:50 +03:00