aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-01 14:08:25 +0100
committerGitHub <[email protected]>2020-07-01 14:08:25 +0100
commit3f94ad332aa22252a46d948888f5b23c0e21cd38 (patch)
tree8ba9457b48fa73741f9639c5ff6d8baa152a6aac
parente080c19cca52b56ffc62988518faeaabf9c021be (diff)
parentc9f878962a7c9d1c33d5834a1dce2106c9286699 (diff)
Merge #5169
5169: Add reload workspace command r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs6
-rw-r--r--crates/rust-analyzer/src/main_loop.rs2
-rw-r--r--docs/dev/lsp-extensions.md8
-rw-r--r--editors/code/package.json8
-rw-r--r--editors/code/src/commands.ts4
-rw-r--r--editors/code/src/lsp_ext.ts2
-rw-r--r--editors/code/src/main.ts2
7 files changed, 16 insertions, 16 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs
index 1befe678c..82207bbb8 100644
--- a/crates/rust-analyzer/src/lsp_ext.rs
+++ b/crates/rust-analyzer/src/lsp_ext.rs
@@ -14,12 +14,12 @@ impl Request for AnalyzerStatus {
14 const METHOD: &'static str = "rust-analyzer/analyzerStatus"; 14 const METHOD: &'static str = "rust-analyzer/analyzerStatus";
15} 15}
16 16
17pub enum CollectGarbage {} 17pub enum ReloadWorkspace {}
18 18
19impl Request for CollectGarbage { 19impl Request for ReloadWorkspace {
20 type Params = (); 20 type Params = ();
21 type Result = (); 21 type Result = ();
22 const METHOD: &'static str = "rust-analyzer/collectGarbage"; 22 const METHOD: &'static str = "rust-analyzer/reloadWorkspace";
23} 23}
24 24
25pub enum SyntaxTree {} 25pub enum SyntaxTree {}
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 2ce1441b6..e3d49d24d 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -276,7 +276,7 @@ impl GlobalState {
276 self.register_request(&req, request_received); 276 self.register_request(&req, request_received);
277 277
278 RequestDispatcher { req: Some(req), global_state: self } 278 RequestDispatcher { req: Some(req), global_state: self }
279 .on_sync::<lsp_ext::CollectGarbage>(|s, ()| Ok(s.analysis_host.collect_garbage()))? 279 .on_sync::<lsp_ext::ReloadWorkspace>(|s, ()| Ok(s.reload()))?
280 .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? 280 .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
281 .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? 281 .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))?
282 .on_sync::<lsp_types::request::Shutdown>(|_, ()| Ok(()))? 282 .on_sync::<lsp_types::request::Shutdown>(|_, ()| Ok(()))?
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index a0847dad3..c0afb16d3 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -389,15 +389,15 @@ rust-analyzer supports only one `kind`, `"cargo"`. The `args` for `"cargo"` look
389 389
390Returns internal status message, mostly for debugging purposes. 390Returns internal status message, mostly for debugging purposes.
391 391
392## Collect Garbage 392## Reload Workspace
393 393
394**Method:** `rust-analyzer/collectGarbage` 394**Method:** `rust-analyzer/reloadWorkspace`
395 395
396**Request:** `null` 396**Request:** `null`
397 397
398**Response:** `null` 398**Response:** `null`
399 399
400Frees some caches. For internal use, and is mostly broken at the moment. 400Reloads project information (that is, re-executes `cargo metadata`).
401 401
402## Syntax Tree 402## Syntax Tree
403 403
@@ -504,4 +504,4 @@ Such actions on the client side are appended to a hover bottom as command links:
504 | TITLE _Action1_ | _Action2_ | <- second group 504 | TITLE _Action1_ | _Action2_ | <- second group
505 +-----------------------------+ 505 +-----------------------------+
506 ... 506 ...
507``` \ No newline at end of file 507```
diff --git a/editors/code/package.json b/editors/code/package.json
index fcb101fc6..af0a5c851 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -61,7 +61,7 @@
61 "activationEvents": [ 61 "activationEvents": [
62 "onLanguage:rust", 62 "onLanguage:rust",
63 "onCommand:rust-analyzer.analyzerStatus", 63 "onCommand:rust-analyzer.analyzerStatus",
64 "onCommand:rust-analyzer.collectGarbage", 64 "onCommand:rust-analyzer.reloadWorkspace",
65 "workspaceContains:**/Cargo.toml" 65 "workspaceContains:**/Cargo.toml"
66 ], 66 ],
67 "main": "./out/src/main", 67 "main": "./out/src/main",
@@ -143,8 +143,8 @@
143 "category": "Rust Analyzer" 143 "category": "Rust Analyzer"
144 }, 144 },
145 { 145 {
146 "command": "rust-analyzer.collectGarbage", 146 "command": "rust-analyzer.reloadWorkspace",
147 "title": "Run garbage collection", 147 "title": "Reload workspace",
148 "category": "Rust Analyzer" 148 "category": "Rust Analyzer"
149 }, 149 },
150 { 150 {
@@ -815,7 +815,7 @@
815 "when": "inRustProject" 815 "when": "inRustProject"
816 }, 816 },
817 { 817 {
818 "command": "rust-analyzer.collectGarbage", 818 "command": "rust-analyzer.reloadWorkspace",
819 "when": "inRustProject" 819 "when": "inRustProject"
820 }, 820 },
821 { 821 {
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 0e78f5101..19a9c2a0d 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -330,8 +330,8 @@ export function expandMacro(ctx: Ctx): Cmd {
330 }; 330 };
331} 331}
332 332
333export function collectGarbage(ctx: Ctx): Cmd { 333export function reloadWorkspace(ctx: Ctx): Cmd {
334 return async () => ctx.client.sendRequest(ra.collectGarbage, null); 334 return async () => ctx.client.sendRequest(ra.reloadWorkspace, null);
335} 335}
336 336
337export function showReferences(ctx: Ctx): Cmd { 337export function showReferences(ctx: Ctx): Cmd {
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
index fdb99956b..981b6f40e 100644
--- a/editors/code/src/lsp_ext.ts
+++ b/editors/code/src/lsp_ext.ts
@@ -6,7 +6,7 @@ import * as lc from "vscode-languageclient";
6 6
7export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analyzer/analyzerStatus"); 7export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analyzer/analyzerStatus");
8 8
9export const collectGarbage = new lc.RequestType<null, null, void>("rust-analyzer/collectGarbage"); 9export const reloadWorkspace = new lc.RequestType<null, null, void>("rust-analyzer/reloadWorkspace");
10 10
11export interface SyntaxTreeParams { 11export interface SyntaxTreeParams {
12 textDocument: lc.TextDocumentIdentifier; 12 textDocument: lc.TextDocumentIdentifier;
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 5ceab8b44..2982b9cbf 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -88,7 +88,7 @@ export async function activate(context: vscode.ExtensionContext) {
88 }); 88 });
89 89
90 ctx.registerCommand('analyzerStatus', commands.analyzerStatus); 90 ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
91 ctx.registerCommand('collectGarbage', commands.collectGarbage); 91 ctx.registerCommand('reloadWorkspace', commands.reloadWorkspace);
92 ctx.registerCommand('matchingBrace', commands.matchingBrace); 92 ctx.registerCommand('matchingBrace', commands.matchingBrace);
93 ctx.registerCommand('joinLines', commands.joinLines); 93 ctx.registerCommand('joinLines', commands.joinLines);
94 ctx.registerCommand('parentModule', commands.parentModule); 94 ctx.registerCommand('parentModule', commands.parentModule);