diff options
author | Aleksey Kladov <[email protected]> | 2020-05-10 18:25:37 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-10 18:27:12 +0100 |
commit | 3bec2be9de400dc044ae924cb0ae36faa454d111 (patch) | |
tree | 4112350b871554073f17ba556f2f557c39e578c4 /crates | |
parent | bec3bf701c9e7d0a99c5a89e5c95ce543ce21dbe (diff) |
req -> lsp_ext
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs (renamed from crates/rust-analyzer/src/req.rs) | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 25 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop/handlers.rs | 38 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 16 | ||||
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/main.rs | 17 | ||||
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/support.rs | 6 |
7 files changed, 58 insertions, 53 deletions
diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs index 6d719108c..57d0e9218 100644 --- a/crates/rust-analyzer/src/lib.rs +++ b/crates/rust-analyzer/src/lib.rs | |||
@@ -24,8 +24,7 @@ mod to_proto; | |||
24 | mod from_proto; | 24 | mod from_proto; |
25 | mod main_loop; | 25 | mod main_loop; |
26 | mod markdown; | 26 | mod markdown; |
27 | // TODO: rename to lsp_ext | 27 | pub mod lsp_ext; |
28 | pub mod req; | ||
29 | pub mod config; | 28 | pub mod config; |
30 | mod world; | 29 | mod world; |
31 | mod diagnostics; | 30 | mod diagnostics; |
diff --git a/crates/rust-analyzer/src/req.rs b/crates/rust-analyzer/src/lsp_ext.rs index aeb29370c..313a8c769 100644 --- a/crates/rust-analyzer/src/req.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -1,12 +1,12 @@ | |||
1 | //! Defines `rust-analyzer` specific custom messages. | 1 | //! rust-analyzer extensions to the LSP. |
2 | |||
3 | use std::path::PathBuf; | ||
2 | 4 | ||
3 | use lsp_types::request::Request; | 5 | use lsp_types::request::Request; |
4 | use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; | 6 | use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; |
5 | use rustc_hash::FxHashMap; | 7 | use rustc_hash::FxHashMap; |
6 | use serde::{Deserialize, Serialize}; | 8 | use serde::{Deserialize, Serialize}; |
7 | 9 | ||
8 | use std::path::PathBuf; | ||
9 | |||
10 | pub enum AnalyzerStatus {} | 10 | pub enum AnalyzerStatus {} |
11 | 11 | ||
12 | impl Request for AnalyzerStatus { | 12 | impl Request for AnalyzerStatus { |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 333ecc859..fa72a9cc6 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -38,12 +38,11 @@ use threadpool::ThreadPool; | |||
38 | use crate::{ | 38 | use crate::{ |
39 | config::{Config, FilesWatcher}, | 39 | config::{Config, FilesWatcher}, |
40 | diagnostics::DiagnosticTask, | 40 | diagnostics::DiagnosticTask, |
41 | from_proto, | 41 | from_proto, lsp_ext, |
42 | main_loop::{ | 42 | main_loop::{ |
43 | pending_requests::{PendingRequest, PendingRequests}, | 43 | pending_requests::{PendingRequest, PendingRequests}, |
44 | subscriptions::Subscriptions, | 44 | subscriptions::Subscriptions, |
45 | }, | 45 | }, |
46 | req, | ||
47 | world::{WorldSnapshot, WorldState}, | 46 | world::{WorldSnapshot, WorldState}, |
48 | Result, | 47 | Result, |
49 | }; | 48 | }; |
@@ -502,26 +501,27 @@ fn on_request( | |||
502 | request_received, | 501 | request_received, |
503 | }; | 502 | }; |
504 | pool_dispatcher | 503 | pool_dispatcher |
505 | .on_sync::<req::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))? | 504 | .on_sync::<lsp_ext::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))? |
506 | .on_sync::<req::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? | 505 | .on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))? |
507 | .on_sync::<req::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? | 506 | .on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))? |
508 | .on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| { | 507 | .on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| { |
509 | handlers::handle_selection_range(s.snapshot(), p) | 508 | handlers::handle_selection_range(s.snapshot(), p) |
510 | })? | 509 | })? |
511 | .on_sync::<req::FindMatchingBrace>(|s, p| { | 510 | .on_sync::<lsp_ext::FindMatchingBrace>(|s, p| { |
512 | handlers::handle_find_matching_brace(s.snapshot(), p) | 511 | handlers::handle_find_matching_brace(s.snapshot(), p) |
513 | })? | 512 | })? |
514 | .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? | 513 | .on::<lsp_ext::AnalyzerStatus>(handlers::handle_analyzer_status)? |
515 | .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? | 514 | .on::<lsp_ext::SyntaxTree>(handlers::handle_syntax_tree)? |
516 | .on::<req::ExpandMacro>(handlers::handle_expand_macro)? | 515 | .on::<lsp_ext::ExpandMacro>(handlers::handle_expand_macro)? |
516 | .on::<lsp_ext::ParentModule>(handlers::handle_parent_module)? | ||
517 | .on::<lsp_ext::Runnables>(handlers::handle_runnables)? | ||
518 | .on::<lsp_ext::InlayHints>(handlers::handle_inlay_hints)? | ||
517 | .on::<lsp_types::request::OnTypeFormatting>(handlers::handle_on_type_formatting)? | 519 | .on::<lsp_types::request::OnTypeFormatting>(handlers::handle_on_type_formatting)? |
518 | .on::<lsp_types::request::DocumentSymbolRequest>(handlers::handle_document_symbol)? | 520 | .on::<lsp_types::request::DocumentSymbolRequest>(handlers::handle_document_symbol)? |
519 | .on::<lsp_types::request::WorkspaceSymbol>(handlers::handle_workspace_symbol)? | 521 | .on::<lsp_types::request::WorkspaceSymbol>(handlers::handle_workspace_symbol)? |
520 | .on::<lsp_types::request::GotoDefinition>(handlers::handle_goto_definition)? | 522 | .on::<lsp_types::request::GotoDefinition>(handlers::handle_goto_definition)? |
521 | .on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)? | 523 | .on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)? |
522 | .on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)? | 524 | .on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)? |
523 | .on::<req::ParentModule>(handlers::handle_parent_module)? | ||
524 | .on::<req::Runnables>(handlers::handle_runnables)? | ||
525 | .on::<lsp_types::request::Completion>(handlers::handle_completion)? | 525 | .on::<lsp_types::request::Completion>(handlers::handle_completion)? |
526 | .on::<lsp_types::request::CodeActionRequest>(handlers::handle_code_action)? | 526 | .on::<lsp_types::request::CodeActionRequest>(handlers::handle_code_action)? |
527 | .on::<lsp_types::request::CodeLensRequest>(handlers::handle_code_lens)? | 527 | .on::<lsp_types::request::CodeLensRequest>(handlers::handle_code_lens)? |
@@ -534,7 +534,6 @@ fn on_request( | |||
534 | .on::<lsp_types::request::References>(handlers::handle_references)? | 534 | .on::<lsp_types::request::References>(handlers::handle_references)? |
535 | .on::<lsp_types::request::Formatting>(handlers::handle_formatting)? | 535 | .on::<lsp_types::request::Formatting>(handlers::handle_formatting)? |
536 | .on::<lsp_types::request::DocumentHighlightRequest>(handlers::handle_document_highlight)? | 536 | .on::<lsp_types::request::DocumentHighlightRequest>(handlers::handle_document_highlight)? |
537 | .on::<req::InlayHints>(handlers::handle_inlay_hints)? | ||
538 | .on::<lsp_types::request::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)? | 537 | .on::<lsp_types::request::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)? |
539 | .on::<lsp_types::request::CallHierarchyIncomingCalls>( | 538 | .on::<lsp_types::request::CallHierarchyIncomingCalls>( |
540 | handlers::handle_call_hierarchy_incoming, | 539 | handlers::handle_call_hierarchy_incoming, |
@@ -546,7 +545,7 @@ fn on_request( | |||
546 | .on::<lsp_types::request::SemanticTokensRangeRequest>( | 545 | .on::<lsp_types::request::SemanticTokensRangeRequest>( |
547 | handlers::handle_semantic_tokens_range, | 546 | handlers::handle_semantic_tokens_range, |
548 | )? | 547 | )? |
549 | .on::<req::Ssr>(handlers::handle_ssr)? | 548 | .on::<lsp_ext::Ssr>(handlers::handle_ssr)? |
550 | .finish(); | 549 | .finish(); |
551 | Ok(()) | 550 | Ok(()) |
552 | } | 551 | } |
diff --git a/crates/rust-analyzer/src/main_loop/handlers.rs b/crates/rust-analyzer/src/main_loop/handlers.rs index 7aa77d19a..be8688bc3 100644 --- a/crates/rust-analyzer/src/main_loop/handlers.rs +++ b/crates/rust-analyzer/src/main_loop/handlers.rs | |||
@@ -34,7 +34,7 @@ use crate::{ | |||
34 | config::RustfmtConfig, | 34 | config::RustfmtConfig, |
35 | diagnostics::DiagnosticTask, | 35 | diagnostics::DiagnosticTask, |
36 | from_json, from_proto, | 36 | from_json, from_proto, |
37 | req::{self, InlayHint, InlayHintsParams}, | 37 | lsp_ext::{self, InlayHint, InlayHintsParams}, |
38 | to_proto, | 38 | to_proto, |
39 | world::WorldSnapshot, | 39 | world::WorldSnapshot, |
40 | LspError, Result, | 40 | LspError, Result, |
@@ -52,7 +52,10 @@ pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> { | |||
52 | Ok(buf) | 52 | Ok(buf) |
53 | } | 53 | } |
54 | 54 | ||
55 | pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -> Result<String> { | 55 | pub fn handle_syntax_tree( |
56 | world: WorldSnapshot, | ||
57 | params: lsp_ext::SyntaxTreeParams, | ||
58 | ) -> Result<String> { | ||
56 | let _p = profile("handle_syntax_tree"); | 59 | let _p = profile("handle_syntax_tree"); |
57 | let id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 60 | let id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
58 | let line_index = world.analysis().file_line_index(id)?; | 61 | let line_index = world.analysis().file_line_index(id)?; |
@@ -63,8 +66,8 @@ pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) - | |||
63 | 66 | ||
64 | pub fn handle_expand_macro( | 67 | pub fn handle_expand_macro( |
65 | world: WorldSnapshot, | 68 | world: WorldSnapshot, |
66 | params: req::ExpandMacroParams, | 69 | params: lsp_ext::ExpandMacroParams, |
67 | ) -> Result<Option<req::ExpandedMacro>> { | 70 | ) -> Result<Option<lsp_ext::ExpandedMacro>> { |
68 | let _p = profile("handle_expand_macro"); | 71 | let _p = profile("handle_expand_macro"); |
69 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 72 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
70 | let line_index = world.analysis().file_line_index(file_id)?; | 73 | let line_index = world.analysis().file_line_index(file_id)?; |
@@ -74,7 +77,7 @@ pub fn handle_expand_macro( | |||
74 | None => Ok(None), | 77 | None => Ok(None), |
75 | Some(offset) => { | 78 | Some(offset) => { |
76 | let res = world.analysis().expand_macro(FilePosition { file_id, offset })?; | 79 | let res = world.analysis().expand_macro(FilePosition { file_id, offset })?; |
77 | Ok(res.map(|it| req::ExpandedMacro { name: it.name, expansion: it.expansion })) | 80 | Ok(res.map(|it| lsp_ext::ExpandedMacro { name: it.name, expansion: it.expansion })) |
78 | } | 81 | } |
79 | } | 82 | } |
80 | } | 83 | } |
@@ -124,7 +127,7 @@ pub fn handle_selection_range( | |||
124 | 127 | ||
125 | pub fn handle_find_matching_brace( | 128 | pub fn handle_find_matching_brace( |
126 | world: WorldSnapshot, | 129 | world: WorldSnapshot, |
127 | params: req::FindMatchingBraceParams, | 130 | params: lsp_ext::FindMatchingBraceParams, |
128 | ) -> Result<Vec<Position>> { | 131 | ) -> Result<Vec<Position>> { |
129 | let _p = profile("handle_find_matching_brace"); | 132 | let _p = profile("handle_find_matching_brace"); |
130 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 133 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
@@ -146,8 +149,8 @@ pub fn handle_find_matching_brace( | |||
146 | 149 | ||
147 | pub fn handle_join_lines( | 150 | pub fn handle_join_lines( |
148 | world: WorldSnapshot, | 151 | world: WorldSnapshot, |
149 | params: req::JoinLinesParams, | 152 | params: lsp_ext::JoinLinesParams, |
150 | ) -> Result<req::SourceChange> { | 153 | ) -> Result<lsp_ext::SourceChange> { |
151 | let _p = profile("handle_join_lines"); | 154 | let _p = profile("handle_join_lines"); |
152 | let frange = from_proto::file_range(&world, params.text_document, params.range)?; | 155 | let frange = from_proto::file_range(&world, params.text_document, params.range)?; |
153 | let source_change = world.analysis().join_lines(frange)?; | 156 | let source_change = world.analysis().join_lines(frange)?; |
@@ -157,7 +160,7 @@ pub fn handle_join_lines( | |||
157 | pub fn handle_on_enter( | 160 | pub fn handle_on_enter( |
158 | world: WorldSnapshot, | 161 | world: WorldSnapshot, |
159 | params: lsp_types::TextDocumentPositionParams, | 162 | params: lsp_types::TextDocumentPositionParams, |
160 | ) -> Result<Option<req::SourceChange>> { | 163 | ) -> Result<Option<lsp_ext::SourceChange>> { |
161 | let _p = profile("handle_on_enter"); | 164 | let _p = profile("handle_on_enter"); |
162 | let position = from_proto::file_position(&world, params)?; | 165 | let position = from_proto::file_position(&world, params)?; |
163 | match world.analysis().on_enter(position)? { | 166 | match world.analysis().on_enter(position)? { |
@@ -388,8 +391,8 @@ pub fn handle_parent_module( | |||
388 | 391 | ||
389 | pub fn handle_runnables( | 392 | pub fn handle_runnables( |
390 | world: WorldSnapshot, | 393 | world: WorldSnapshot, |
391 | params: req::RunnablesParams, | 394 | params: lsp_ext::RunnablesParams, |
392 | ) -> Result<Vec<req::Runnable>> { | 395 | ) -> Result<Vec<lsp_ext::Runnable>> { |
393 | let _p = profile("handle_runnables"); | 396 | let _p = profile("handle_runnables"); |
394 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; | 397 | let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; |
395 | let line_index = world.analysis().file_line_index(file_id)?; | 398 | let line_index = world.analysis().file_line_index(file_id)?; |
@@ -419,7 +422,7 @@ pub fn handle_runnables( | |||
419 | match cargo_spec { | 422 | match cargo_spec { |
420 | Some(spec) => { | 423 | Some(spec) => { |
421 | for &cmd in ["check", "test"].iter() { | 424 | for &cmd in ["check", "test"].iter() { |
422 | res.push(req::Runnable { | 425 | res.push(lsp_ext::Runnable { |
423 | range: Default::default(), | 426 | range: Default::default(), |
424 | label: format!("cargo {} -p {}", cmd, spec.package), | 427 | label: format!("cargo {} -p {}", cmd, spec.package), |
425 | bin: "cargo".to_string(), | 428 | bin: "cargo".to_string(), |
@@ -431,7 +434,7 @@ pub fn handle_runnables( | |||
431 | } | 434 | } |
432 | } | 435 | } |
433 | None => { | 436 | None => { |
434 | res.push(req::Runnable { | 437 | res.push(lsp_ext::Runnable { |
435 | range: Default::default(), | 438 | range: Default::default(), |
436 | label: "cargo check --workspace".to_string(), | 439 | label: "cargo check --workspace".to_string(), |
437 | bin: "cargo".to_string(), | 440 | bin: "cargo".to_string(), |
@@ -972,7 +975,10 @@ pub fn handle_document_highlight( | |||
972 | Ok(Some(res)) | 975 | Ok(Some(res)) |
973 | } | 976 | } |
974 | 977 | ||
975 | pub fn handle_ssr(world: WorldSnapshot, params: req::SsrParams) -> Result<req::SourceChange> { | 978 | pub fn handle_ssr( |
979 | world: WorldSnapshot, | ||
980 | params: lsp_ext::SsrParams, | ||
981 | ) -> Result<lsp_ext::SourceChange> { | ||
976 | let _p = profile("handle_ssr"); | 982 | let _p = profile("handle_ssr"); |
977 | let source_change = | 983 | let source_change = |
978 | world.analysis().structural_search_replace(¶ms.query, params.parse_only)??; | 984 | world.analysis().structural_search_replace(¶ms.query, params.parse_only)??; |
@@ -1003,7 +1009,7 @@ fn to_lsp_runnable( | |||
1003 | world: &WorldSnapshot, | 1009 | world: &WorldSnapshot, |
1004 | file_id: FileId, | 1010 | file_id: FileId, |
1005 | runnable: Runnable, | 1011 | runnable: Runnable, |
1006 | ) -> Result<req::Runnable> { | 1012 | ) -> Result<lsp_ext::Runnable> { |
1007 | let spec = CargoTargetSpec::for_file(world, file_id)?; | 1013 | let spec = CargoTargetSpec::for_file(world, file_id)?; |
1008 | let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; | 1014 | let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; |
1009 | let line_index = world.analysis().file_line_index(file_id)?; | 1015 | let line_index = world.analysis().file_line_index(file_id)?; |
@@ -1014,7 +1020,7 @@ fn to_lsp_runnable( | |||
1014 | RunnableKind::DocTest { test_id, .. } => format!("doctest {}", test_id), | 1020 | RunnableKind::DocTest { test_id, .. } => format!("doctest {}", test_id), |
1015 | RunnableKind::Bin => "run binary".to_string(), | 1021 | RunnableKind::Bin => "run binary".to_string(), |
1016 | }; | 1022 | }; |
1017 | Ok(req::Runnable { | 1023 | Ok(lsp_ext::Runnable { |
1018 | range: to_proto::range(&line_index, runnable.range), | 1024 | range: to_proto::range(&line_index, runnable.range), |
1019 | label, | 1025 | label, |
1020 | bin: "cargo".to_string(), | 1026 | bin: "cargo".to_string(), |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 4157ce8ea..4500d4982 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -10,7 +10,7 @@ use ra_syntax::{SyntaxKind, TextRange, TextSize}; | |||
10 | use ra_text_edit::{Indel, TextEdit}; | 10 | use ra_text_edit::{Indel, TextEdit}; |
11 | use ra_vfs::LineEndings; | 11 | use ra_vfs::LineEndings; |
12 | 12 | ||
13 | use crate::{req, semantic_tokens, world::WorldSnapshot, Result}; | 13 | use crate::{lsp_ext, semantic_tokens, world::WorldSnapshot, Result}; |
14 | 14 | ||
15 | pub(crate) fn position(line_index: &LineIndex, offset: TextSize) -> lsp_types::Position { | 15 | pub(crate) fn position(line_index: &LineIndex, offset: TextSize) -> lsp_types::Position { |
16 | let line_col = line_index.line_col(offset); | 16 | let line_col = line_index.line_col(offset); |
@@ -215,14 +215,14 @@ pub(crate) fn signature_information( | |||
215 | lsp_types::SignatureInformation { label, documentation, parameters: Some(parameters) } | 215 | lsp_types::SignatureInformation { label, documentation, parameters: Some(parameters) } |
216 | } | 216 | } |
217 | 217 | ||
218 | pub(crate) fn inlay_int(line_index: &LineIndex, inlay_hint: InlayHint) -> req::InlayHint { | 218 | pub(crate) fn inlay_int(line_index: &LineIndex, inlay_hint: InlayHint) -> lsp_ext::InlayHint { |
219 | req::InlayHint { | 219 | lsp_ext::InlayHint { |
220 | label: inlay_hint.label.to_string(), | 220 | label: inlay_hint.label.to_string(), |
221 | range: range(line_index, inlay_hint.range), | 221 | range: range(line_index, inlay_hint.range), |
222 | kind: match inlay_hint.kind { | 222 | kind: match inlay_hint.kind { |
223 | InlayKind::ParameterHint => req::InlayKind::ParameterHint, | 223 | InlayKind::ParameterHint => lsp_ext::InlayKind::ParameterHint, |
224 | InlayKind::TypeHint => req::InlayKind::TypeHint, | 224 | InlayKind::TypeHint => lsp_ext::InlayKind::TypeHint, |
225 | InlayKind::ChainingHint => req::InlayKind::ChainingHint, | 225 | InlayKind::ChainingHint => lsp_ext::InlayKind::ChainingHint, |
226 | }, | 226 | }, |
227 | } | 227 | } |
228 | } | 228 | } |
@@ -478,7 +478,7 @@ pub(crate) fn resource_op( | |||
478 | pub(crate) fn source_change( | 478 | pub(crate) fn source_change( |
479 | world: &WorldSnapshot, | 479 | world: &WorldSnapshot, |
480 | source_change: SourceChange, | 480 | source_change: SourceChange, |
481 | ) -> Result<req::SourceChange> { | 481 | ) -> Result<lsp_ext::SourceChange> { |
482 | let cursor_position = match source_change.cursor_position { | 482 | let cursor_position = match source_change.cursor_position { |
483 | None => None, | 483 | None => None, |
484 | Some(pos) => { | 484 | Some(pos) => { |
@@ -513,7 +513,7 @@ pub(crate) fn source_change( | |||
513 | changes: None, | 513 | changes: None, |
514 | document_changes: Some(lsp_types::DocumentChanges::Operations(document_changes)), | 514 | document_changes: Some(lsp_types::DocumentChanges::Operations(document_changes)), |
515 | }; | 515 | }; |
516 | Ok(req::SourceChange { label: source_change.label, workspace_edit, cursor_position }) | 516 | Ok(lsp_ext::SourceChange { label: source_change.label, workspace_edit, cursor_position }) |
517 | } | 517 | } |
518 | 518 | ||
519 | pub fn call_hierarchy_item( | 519 | pub fn call_hierarchy_item( |
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs index e459e3a3c..5011cc273 100644 --- a/crates/rust-analyzer/tests/heavy_tests/main.rs +++ b/crates/rust-analyzer/tests/heavy_tests/main.rs | |||
@@ -3,15 +3,16 @@ mod support; | |||
3 | use std::{collections::HashMap, path::PathBuf, time::Instant}; | 3 | use std::{collections::HashMap, path::PathBuf, time::Instant}; |
4 | 4 | ||
5 | use lsp_types::{ | 5 | use lsp_types::{ |
6 | CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions, | 6 | notification::DidOpenTextDocument, |
7 | GotoDefinitionParams, HoverParams, PartialResultParams, Position, Range, TextDocumentItem, | 7 | request::{ |
8 | TextDocumentPositionParams, WorkDoneProgressParams, | 8 | CodeActionRequest, Completion, Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest, |
9 | }; | 9 | }, |
10 | use rust_analyzer::req::{ | 10 | CodeActionContext, CodeActionParams, CompletionParams, DidOpenTextDocumentParams, |
11 | CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument, | 11 | DocumentFormattingParams, FormattingOptions, GotoDefinitionParams, HoverParams, |
12 | Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest, OnEnter, Runnables, | 12 | PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams, |
13 | RunnablesParams, | 13 | WorkDoneProgressParams, |
14 | }; | 14 | }; |
15 | use rust_analyzer::lsp_ext::{OnEnter, Runnables, RunnablesParams}; | ||
15 | use serde_json::json; | 16 | use serde_json::json; |
16 | use tempfile::TempDir; | 17 | use tempfile::TempDir; |
17 | use test_utils::skip_slow_tests; | 18 | use test_utils::skip_slow_tests; |
diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index 8d47ee4f6..8756ad4a3 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs | |||
@@ -13,15 +13,15 @@ use lsp_types::{ | |||
13 | request::Shutdown, | 13 | request::Shutdown, |
14 | DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress, | 14 | DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress, |
15 | }; | 15 | }; |
16 | use lsp_types::{ProgressParams, ProgressParamsValue}; | ||
16 | use serde::Serialize; | 17 | use serde::Serialize; |
17 | use serde_json::{to_string_pretty, Value}; | 18 | use serde_json::{to_string_pretty, Value}; |
18 | use tempfile::TempDir; | 19 | use tempfile::TempDir; |
19 | use test_utils::{find_mismatch, parse_fixture}; | 20 | use test_utils::{find_mismatch, parse_fixture}; |
20 | 21 | ||
21 | use req::{ProgressParams, ProgressParamsValue}; | ||
22 | use rust_analyzer::{ | 22 | use rust_analyzer::{ |
23 | config::{ClientCapsConfig, Config}, | 23 | config::{ClientCapsConfig, Config}, |
24 | main_loop, req, | 24 | main_loop, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | pub struct Project<'a> { | 27 | pub struct Project<'a> { |
@@ -206,7 +206,7 @@ impl Server { | |||
206 | Message::Notification(n) if n.method == "$/progress" => { | 206 | Message::Notification(n) if n.method == "$/progress" => { |
207 | match n.clone().extract::<ProgressParams>("$/progress").unwrap() { | 207 | match n.clone().extract::<ProgressParams>("$/progress").unwrap() { |
208 | ProgressParams { | 208 | ProgressParams { |
209 | token: req::ProgressToken::String(ref token), | 209 | token: lsp_types::ProgressToken::String(ref token), |
210 | value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)), | 210 | value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)), |
211 | } if token == "rustAnalyzer/startup" => true, | 211 | } if token == "rustAnalyzer/startup" => true, |
212 | _ => false, | 212 | _ => false, |