aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs7
-rw-r--r--crates/rust-analyzer/src/reload.rs5
-rw-r--r--docs/dev/lsp-extensions.md8
-rw-r--r--editors/code/src/ctx.ts2
-rw-r--r--editors/code/src/lsp_ext.ts5
5 files changed, 22 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs
index 3976b6529..e1a28b1b4 100644
--- a/crates/rust-analyzer/src/lsp_ext.rs
+++ b/crates/rust-analyzer/src/lsp_ext.rs
@@ -237,8 +237,13 @@ pub enum Status {
237 Invalid, 237 Invalid,
238} 238}
239 239
240#[derive(Deserialize, Serialize)]
241pub struct StatusParams {
242 pub status: Status,
243}
244
240impl Notification for StatusNotification { 245impl Notification for StatusNotification {
241 type Params = Status; 246 type Params = StatusParams;
242 const METHOD: &'static str = "rust-analyzer/status"; 247 const METHOD: &'static str = "rust-analyzer/status";
243} 248}
244 249
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 1907f2f13..b70efcb4d 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -14,6 +14,7 @@ use crate::{
14 lsp_ext, 14 lsp_ext,
15 main_loop::Task, 15 main_loop::Task,
16}; 16};
17use lsp_ext::StatusParams;
17 18
18impl GlobalState { 19impl GlobalState {
19 pub(crate) fn update_configuration(&mut self, config: Config) { 20 pub(crate) fn update_configuration(&mut self, config: Config) {
@@ -86,7 +87,9 @@ impl GlobalState {
86 Status::Invalid => lsp_ext::Status::Invalid, 87 Status::Invalid => lsp_ext::Status::Invalid,
87 Status::NeedsReload => lsp_ext::Status::NeedsReload, 88 Status::NeedsReload => lsp_ext::Status::NeedsReload,
88 }; 89 };
89 self.send_notification::<lsp_ext::StatusNotification>(lsp_status); 90 self.send_notification::<lsp_ext::StatusNotification>(StatusParams {
91 status: lsp_status,
92 });
90 } 93 }
91 } 94 }
92 pub(crate) fn fetch_workspaces(&mut self) { 95 pub(crate) fn fetch_workspaces(&mut self) {
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 1be01fd88..2e3133449 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -412,7 +412,13 @@ Reloads project information (that is, re-executes `cargo metadata`).
412 412
413**Method:** `rust-analyzer/status` 413**Method:** `rust-analyzer/status`
414 414
415**Notification:** `"loading" | "ready" | "invalid" | "needsReload"` 415**Notification:**
416
417```typescript
418interface StatusParams {
419 status: "loading" | "ready" | "invalid" | "needsReload",
420}
421```
416 422
417This notification is sent from server to client. 423This notification is sent from server to client.
418The client can use it to display persistent status to the user (in modline). 424The client can use it to display persistent status to the user (in modline).
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 6e767babf..543f7e02e 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -36,7 +36,7 @@ export class Ctx {
36 36
37 res.pushCleanup(client.start()); 37 res.pushCleanup(client.start());
38 await client.onReady(); 38 await client.onReady();
39 client.onNotification(ra.status, (status) => res.setStatus(status)); 39 client.onNotification(ra.status, (params) => res.setStatus(params.status));
40 return res; 40 return res;
41 } 41 }
42 42
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts
index 494d51c83..8663737a6 100644
--- a/editors/code/src/lsp_ext.ts
+++ b/editors/code/src/lsp_ext.ts
@@ -8,7 +8,10 @@ export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analy
8export const memoryUsage = new lc.RequestType<null, string, void>("rust-analyzer/memoryUsage"); 8export const memoryUsage = new lc.RequestType<null, string, void>("rust-analyzer/memoryUsage");
9 9
10export type Status = "loading" | "ready" | "invalid" | "needsReload"; 10export type Status = "loading" | "ready" | "invalid" | "needsReload";
11export const status = new lc.NotificationType<Status>("rust-analyzer/status"); 11export interface StatusParams {
12 status: Status;
13}
14export const status = new lc.NotificationType<StatusParams>("rust-analyzer/status");
12 15
13export const reloadWorkspace = new lc.RequestType<null, null, void>("rust-analyzer/reloadWorkspace"); 16export const reloadWorkspace = new lc.RequestType<null, null, void>("rust-analyzer/reloadWorkspace");
14 17