diff options
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 14 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/semantic_tokens.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/support.rs | 1 | ||||
-rw-r--r-- | crates/stdx/src/lib.rs | 2 |
5 files changed, 15 insertions, 14 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 79ea90cc9..d818243e3 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -808,14 +808,14 @@ fn send_startup_progress(sender: &Sender<Message>, loop_state: &mut LoopState) { | |||
808 | ), | 808 | ), |
809 | _ => {} | 809 | _ => {} |
810 | } | 810 | } |
811 | } | ||
812 | 811 | ||
813 | fn send_startup_progress_notif(sender: &Sender<Message>, work_done_progress: WorkDoneProgress) { | 812 | fn send_startup_progress_notif(sender: &Sender<Message>, work_done_progress: WorkDoneProgress) { |
814 | let notif = notification_new::<req::Progress>(req::ProgressParams { | 813 | let notif = notification_new::<req::Progress>(req::ProgressParams { |
815 | token: req::ProgressToken::String("rustAnalyzer/startup".into()), | 814 | token: req::ProgressToken::String("rustAnalyzer/startup".into()), |
816 | value: req::ProgressParamsValue::WorkDone(work_done_progress), | 815 | value: req::ProgressParamsValue::WorkDone(work_done_progress), |
817 | }); | 816 | }); |
818 | sender.send(notif.into()).unwrap(); | 817 | sender.send(notif.into()).unwrap(); |
818 | } | ||
819 | } | 819 | } |
820 | 820 | ||
821 | struct PoolDispatcher<'a> { | 821 | struct PoolDispatcher<'a> { |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 12f8ca297..f60a3f0a0 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -14,7 +14,7 @@ use lsp_types::{ | |||
14 | CodeAction, CodeActionResponse, CodeLens, Command, CompletionItem, Diagnostic, | 14 | CodeAction, CodeActionResponse, CodeLens, Command, CompletionItem, Diagnostic, |
15 | DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, | 15 | DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, |
16 | Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, PrepareRenameResponse, | 16 | Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, PrepareRenameResponse, |
17 | Range, RenameParams, SemanticTokens, SemanticTokensParams, SemanticTokensRangeParams, | 17 | Range, RenameParams, SemanticTokensParams, SemanticTokensRangeParams, |
18 | SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, TextDocumentIdentifier, | 18 | SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, TextDocumentIdentifier, |
19 | TextEdit, WorkspaceEdit, | 19 | TextEdit, WorkspaceEdit, |
20 | }; | 20 | }; |
@@ -1145,7 +1145,7 @@ pub fn handle_semantic_tokens( | |||
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | let tokens = SemanticTokens { data: builder.build(), ..Default::default() }; | 1148 | let tokens = builder.build(); |
1149 | 1149 | ||
1150 | Ok(Some(tokens.into())) | 1150 | Ok(Some(tokens.into())) |
1151 | } | 1151 | } |
@@ -1166,7 +1166,7 @@ pub fn handle_semantic_tokens_range( | |||
1166 | builder.push(highlight_range.range.conv_with(&line_index), token_type, token_modifiers); | 1166 | builder.push(highlight_range.range.conv_with(&line_index), token_type, token_modifiers); |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | let tokens = SemanticTokens { data: builder.build(), ..Default::default() }; | 1169 | let tokens = builder.build(); |
1170 | 1170 | ||
1171 | Ok(Some(tokens.into())) | 1171 | Ok(Some(tokens.into())) |
1172 | } | 1172 | } |
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs index d9ba77050..2a66bbfd8 100644 --- a/crates/rust-analyzer/src/semantic_tokens.rs +++ b/crates/rust-analyzer/src/semantic_tokens.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::ops; | 3 | use std::ops; |
4 | 4 | ||
5 | use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType}; | 5 | use lsp_types::{Range, SemanticToken, SemanticTokenModifier, SemanticTokenType, SemanticTokens}; |
6 | 6 | ||
7 | pub(crate) const ATTRIBUTE: SemanticTokenType = SemanticTokenType::new("attribute"); | 7 | pub(crate) const ATTRIBUTE: SemanticTokenType = SemanticTokenType::new("attribute"); |
8 | pub(crate) const BUILTIN_TYPE: SemanticTokenType = SemanticTokenType::new("builtinType"); | 8 | pub(crate) const BUILTIN_TYPE: SemanticTokenType = SemanticTokenType::new("builtinType"); |
@@ -109,8 +109,8 @@ impl SemanticTokensBuilder { | |||
109 | self.prev_char = range.start.character as u32; | 109 | self.prev_char = range.start.character as u32; |
110 | } | 110 | } |
111 | 111 | ||
112 | pub fn build(self) -> Vec<SemanticToken> { | 112 | pub fn build(self) -> SemanticTokens { |
113 | self.data | 113 | SemanticTokens { result_id: None, data: self.data } |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index 67f3c9332..fc3c65ad9 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -188,6 +188,7 @@ impl Server { | |||
188 | self.client.sender.send(r.into()).unwrap(); | 188 | self.client.sender.send(r.into()).unwrap(); |
189 | while let Some(msg) = self.recv() { | 189 | while let Some(msg) = self.recv() { |
190 | match msg { | 190 | match msg { |
191 | Message::Request(req) if req.method == "window/workDoneProgress/create" => (), | ||
191 | Message::Request(req) => panic!("unexpected request: {:?}", req), | 192 | Message::Request(req) => panic!("unexpected request: {:?}", req), |
192 | Message::Notification(_) => (), | 193 | Message::Notification(_) => (), |
193 | Message::Response(res) => { | 194 | Message::Response(res) => { |
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 8492c17af..d2efa2236 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -5,7 +5,7 @@ use std::{cell::Cell, fmt}; | |||
5 | /// Appends formatted string to a `String`. | 5 | /// Appends formatted string to a `String`. |
6 | #[macro_export] | 6 | #[macro_export] |
7 | macro_rules! format_to { | 7 | macro_rules! format_to { |
8 | (&buf:expr) => (); | 8 | ($buf:expr) => (); |
9 | ($buf:expr, $lit:literal $($arg:tt)*) => { | 9 | ($buf:expr, $lit:literal $($arg:tt)*) => { |
10 | { use ::std::fmt::Write as _; let _ = ::std::write!($buf, $lit $($arg)*); } | 10 | { use ::std::fmt::Write as _; let _ = ::std::write!($buf, $lit $($arg)*); } |
11 | }; | 11 | }; |