]> git.lizzy.rs Git - rust.git/commitdiff
Fix StatusNotification
authorvsrs <vit@conrlab.com>
Mon, 17 Aug 2020 11:56:27 +0000 (14:56 +0300)
committervsrs <vit@conrlab.com>
Mon, 17 Aug 2020 11:56:27 +0000 (14:56 +0300)
crates/rust-analyzer/src/lsp_ext.rs
crates/rust-analyzer/src/reload.rs
docs/dev/lsp-extensions.md
editors/code/src/ctx.ts
editors/code/src/lsp_ext.ts

index 3976b6529ee3554ceb3f06b89f0f5258b871dbf4..e1a28b1b4bade2dd7e18721dad9eab7060378045 100644 (file)
@@ -237,8 +237,13 @@ pub enum Status {
     Invalid,
 }
 
+#[derive(Deserialize, Serialize)]
+pub struct StatusParams {
+    pub status: Status,
+}
+
 impl Notification for StatusNotification {
-    type Params = Status;
+    type Params = StatusParams;
     const METHOD: &'static str = "rust-analyzer/status";
 }
 
index 1907f2f132d65b6931b68a95ca4ba117dfcb9942..b70efcb4d2ae7dce6913db46d1b400ecee4a5dfd 100644 (file)
@@ -14,6 +14,7 @@
     lsp_ext,
     main_loop::Task,
 };
+use lsp_ext::StatusParams;
 
 impl GlobalState {
     pub(crate) fn update_configuration(&mut self, config: Config) {
@@ -86,7 +87,9 @@ pub(crate) fn transition(&mut self, new_status: Status) {
                 Status::Invalid => lsp_ext::Status::Invalid,
                 Status::NeedsReload => lsp_ext::Status::NeedsReload,
             };
-            self.send_notification::<lsp_ext::StatusNotification>(lsp_status);
+            self.send_notification::<lsp_ext::StatusNotification>(StatusParams {
+                status: lsp_status,
+            });
         }
     }
     pub(crate) fn fetch_workspaces(&mut self) {
index 1be01fd8842cc8eacb34d35a386f336075d52af3..2e3133449fb44fbe3e60291d285db19ec15a5a44 100644 (file)
@@ -412,7 +412,13 @@ Reloads project information (that is, re-executes `cargo metadata`).
 
 **Method:** `rust-analyzer/status`
 
-**Notification:** `"loading" | "ready" | "invalid" | "needsReload"`
+**Notification:**
+
+```typescript
+interface StatusParams {
+    status: "loading" | "ready" | "invalid" | "needsReload",
+}
+```
 
 This notification is sent from server to client.
 The client can use it to display persistent status to the user (in modline).
index 6e767babf449ea20cc6595e91b4606a7b895d34b..543f7e02e389b0840fb874b6c4a62899d35873e0 100644 (file)
@@ -36,7 +36,7 @@ export class Ctx {
 
         res.pushCleanup(client.start());
         await client.onReady();
-        client.onNotification(ra.status, (status) => res.setStatus(status));
+        client.onNotification(ra.status, (params) => res.setStatus(params.status));
         return res;
     }
 
index 494d51c83a1c3a2d3b94446bae866759ce5ddbc9..8663737a6849ca38ad261c3f5777a7c534b937aa 100644 (file)
@@ -8,7 +8,10 @@ export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analy
 export const memoryUsage = new lc.RequestType<null, string, void>("rust-analyzer/memoryUsage");
 
 export type Status = "loading" | "ready" | "invalid" | "needsReload";
-export const status = new lc.NotificationType<Status>("rust-analyzer/status");
+export interface StatusParams {
+    status: Status;
+}
+export const status = new lc.NotificationType<StatusParams>("rust-analyzer/status");
 
 export const reloadWorkspace = new lc.RequestType<null, null, void>("rust-analyzer/reloadWorkspace");