diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs | 26 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 8 |
3 files changed, 18 insertions, 20 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index c25d90a50..52e4fcbec 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -38,13 +38,6 @@ pub struct SyntaxTreeParams { | |||
38 | pub range: Option<Range>, | 38 | pub range: Option<Range>, |
39 | } | 39 | } |
40 | 40 | ||
41 | #[derive(Deserialize, Serialize, Debug)] | ||
42 | #[serde(rename_all = "camelCase")] | ||
43 | pub struct ExpandedMacro { | ||
44 | pub name: String, | ||
45 | pub expansion: String, | ||
46 | } | ||
47 | |||
48 | pub enum ExpandMacro {} | 41 | pub enum ExpandMacro {} |
49 | 42 | ||
50 | impl Request for ExpandMacro { | 43 | impl Request for ExpandMacro { |
@@ -60,19 +53,26 @@ pub struct ExpandMacroParams { | |||
60 | pub position: Option<Position>, | 53 | pub position: Option<Position>, |
61 | } | 54 | } |
62 | 55 | ||
63 | pub enum FindMatchingBrace {} | 56 | #[derive(Deserialize, Serialize, Debug)] |
57 | #[serde(rename_all = "camelCase")] | ||
58 | pub struct ExpandedMacro { | ||
59 | pub name: String, | ||
60 | pub expansion: String, | ||
61 | } | ||
62 | |||
63 | pub enum MatchingBrace {} | ||
64 | 64 | ||
65 | impl Request for FindMatchingBrace { | 65 | impl Request for MatchingBrace { |
66 | type Params = FindMatchingBraceParams; | 66 | type Params = MatchingBraceParams; |
67 | type Result = Vec<Position>; | 67 | type Result = Vec<Position>; |
68 | const METHOD: &'static str = "rust-analyzer/findMatchingBrace"; | 68 | const METHOD: &'static str = "experimental/matchingBrace"; |
69 | } | 69 | } |
70 | 70 | ||
71 | #[derive(Deserialize, Serialize, Debug)] | 71 | #[derive(Deserialize, Serialize, Debug)] |
72 | #[serde(rename_all = "camelCase")] | 72 | #[serde(rename_all = "camelCase")] |
73 | pub struct FindMatchingBraceParams { | 73 | pub struct MatchingBraceParams { |
74 | pub text_document: TextDocumentIdentifier, | 74 | pub text_document: TextDocumentIdentifier, |
75 | pub offsets: Vec<Position>, | 75 | pub positions: Vec<Position>, |
76 | } | 76 | } |
77 | 77 | ||
78 | pub enum ParentModule {} | 78 | pub enum ParentModule {} |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 87795fffb..f1287d52c 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -509,9 +509,7 @@ fn on_request( | |||
509 | .on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| { | 509 | .on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| { |
510 | handlers::handle_selection_range(s.snapshot(), p) | 510 | handlers::handle_selection_range(s.snapshot(), p) |
511 | })? | 511 | })? |
512 | .on_sync::<lsp_ext::FindMatchingBrace>(|s, p| { | 512 | .on_sync::<lsp_ext::MatchingBrace>(|s, p| handlers::handle_matching_brace(s.snapshot(), p))? |
513 | handlers::handle_find_matching_brace(s.snapshot(), p) | ||
514 | })? | ||
515 | .on::<lsp_ext::AnalyzerStatus>(handlers::handle_analyzer_status)? | 513 | .on::<lsp_ext::AnalyzerStatus>(handlers::handle_analyzer_status)? |
516 | .on::<lsp_ext::SyntaxTree>(handlers::handle_syntax_tree)? | 514 | .on::<lsp_ext::SyntaxTree>(handlers::handle_syntax_tree)? |
517 | .on::<lsp_ext::ExpandMacro>(handlers::handle_expand_macro)? | 515 | .on::<lsp_ext::ExpandMacro>(handlers::handle_expand_macro)? |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 2aaff3ea4..d73107968 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -126,15 +126,15 @@ pub fn handle_selection_range( | |||
126 | Ok(Some(res?)) | 126 | Ok(Some(res?)) |
127 | } | 127 | } |
128 | 128 | ||
129 | pub fn handle_find_matching_brace( | 129 | pub fn handle_matching_brace( |
130 | world: WorldSnapshot, | 130 | world: WorldSnapshot, |
131 | params: lsp_ext::FindMatchingBraceParams, | 131 | params: lsp_ext::MatchingBraceParams, |
132 | ) -> Result<Vec<Position>> { | 132 | ) -> Result<Vec<Position>> { |
133 | let _p = profile("handle_find_matching_brace"); | 133 | let _p = profile("handle_matching_brace"); |
134 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 134 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
135 | let line_index = world.analysis().file_line_index(file_id)?; | 135 | let line_index = world.analysis().file_line_index(file_id)?; |
136 | let res = params | 136 | let res = params |
137 | .offsets | 137 | .positions |
138 | .into_iter() | 138 | .into_iter() |
139 | .map(|position| { | 139 | .map(|position| { |
140 | let offset = from_proto::offset(&line_index, position); | 140 | let offset = from_proto::offset(&line_index, position); |