From 3bec2be9de400dc044ae924cb0ae36faa454d111 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 10 May 2020 19:25:37 +0200 Subject: req -> lsp_ext --- crates/rust-analyzer/src/lib.rs | 3 +- crates/rust-analyzer/src/lsp_ext.rs | 185 ++++++++++++++++++++++ crates/rust-analyzer/src/main_loop.rs | 25 ++- crates/rust-analyzer/src/main_loop/handlers.rs | 38 +++-- crates/rust-analyzer/src/req.rs | 185 ---------------------- crates/rust-analyzer/src/to_proto.rs | 16 +- crates/rust-analyzer/tests/heavy_tests/main.rs | 17 +- crates/rust-analyzer/tests/heavy_tests/support.rs | 6 +- 8 files changed, 240 insertions(+), 235 deletions(-) create mode 100644 crates/rust-analyzer/src/lsp_ext.rs delete mode 100644 crates/rust-analyzer/src/req.rs 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; mod from_proto; mod main_loop; mod markdown; -// TODO: rename to lsp_ext -pub mod req; +pub mod lsp_ext; pub mod config; mod world; mod diagnostics; diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs new file mode 100644 index 000000000..313a8c769 --- /dev/null +++ b/crates/rust-analyzer/src/lsp_ext.rs @@ -0,0 +1,185 @@ +//! rust-analyzer extensions to the LSP. + +use std::path::PathBuf; + +use lsp_types::request::Request; +use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; +use rustc_hash::FxHashMap; +use serde::{Deserialize, Serialize}; + +pub enum AnalyzerStatus {} + +impl Request for AnalyzerStatus { + type Params = (); + type Result = String; + const METHOD: &'static str = "rust-analyzer/analyzerStatus"; +} + +pub enum CollectGarbage {} + +impl Request for CollectGarbage { + type Params = (); + type Result = (); + const METHOD: &'static str = "rust-analyzer/collectGarbage"; +} + +pub enum SyntaxTree {} + +impl Request for SyntaxTree { + type Params = SyntaxTreeParams; + type Result = String; + const METHOD: &'static str = "rust-analyzer/syntaxTree"; +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct SyntaxTreeParams { + pub text_document: TextDocumentIdentifier, + pub range: Option, +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct ExpandedMacro { + pub name: String, + pub expansion: String, +} + +pub enum ExpandMacro {} + +impl Request for ExpandMacro { + type Params = ExpandMacroParams; + type Result = Option; + const METHOD: &'static str = "rust-analyzer/expandMacro"; +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct ExpandMacroParams { + pub text_document: TextDocumentIdentifier, + pub position: Option, +} + +pub enum FindMatchingBrace {} + +impl Request for FindMatchingBrace { + type Params = FindMatchingBraceParams; + type Result = Vec; + const METHOD: &'static str = "rust-analyzer/findMatchingBrace"; +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct FindMatchingBraceParams { + pub text_document: TextDocumentIdentifier, + pub offsets: Vec, +} + +pub enum ParentModule {} + +impl Request for ParentModule { + type Params = lsp_types::TextDocumentPositionParams; + type Result = Vec; + const METHOD: &'static str = "rust-analyzer/parentModule"; +} + +pub enum JoinLines {} + +impl Request for JoinLines { + type Params = JoinLinesParams; + type Result = SourceChange; + const METHOD: &'static str = "rust-analyzer/joinLines"; +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct JoinLinesParams { + pub text_document: TextDocumentIdentifier, + pub range: Range, +} + +pub enum OnEnter {} + +impl Request for OnEnter { + type Params = lsp_types::TextDocumentPositionParams; + type Result = Option; + const METHOD: &'static str = "rust-analyzer/onEnter"; +} + +pub enum Runnables {} + +impl Request for Runnables { + type Params = RunnablesParams; + type Result = Vec; + const METHOD: &'static str = "rust-analyzer/runnables"; +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct RunnablesParams { + pub text_document: TextDocumentIdentifier, + pub position: Option, +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct Runnable { + pub range: Range, + pub label: String, + pub bin: String, + pub args: Vec, + pub extra_args: Vec, + pub env: FxHashMap, + pub cwd: Option, +} + +#[derive(Deserialize, Serialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct SourceChange { + pub label: String, + pub workspace_edit: lsp_types::WorkspaceEdit, + pub cursor_position: Option, +} + +pub enum InlayHints {} + +impl Request for InlayHints { + type Params = InlayHintsParams; + type Result = Vec; + const METHOD: &'static str = "rust-analyzer/inlayHints"; +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintsParams { + pub text_document: TextDocumentIdentifier, +} + +#[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] +pub enum InlayKind { + TypeHint, + ParameterHint, + ChainingHint, +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct InlayHint { + pub range: Range, + pub kind: InlayKind, + pub label: String, +} + +pub enum Ssr {} + +impl Request for Ssr { + type Params = SsrParams; + type Result = SourceChange; + const METHOD: &'static str = "rust-analyzer/ssr"; +} + +#[derive(Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SsrParams { + pub query: String, + pub parse_only: bool, +} 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; use crate::{ config::{Config, FilesWatcher}, diagnostics::DiagnosticTask, - from_proto, + from_proto, lsp_ext, main_loop::{ pending_requests::{PendingRequest, PendingRequests}, subscriptions::Subscriptions, }, - req, world::{WorldSnapshot, WorldState}, Result, }; @@ -502,26 +501,27 @@ fn on_request( request_received, }; pool_dispatcher - .on_sync::(|s, ()| Ok(s.collect_garbage()))? - .on_sync::(|s, p| handlers::handle_join_lines(s.snapshot(), p))? - .on_sync::(|s, p| handlers::handle_on_enter(s.snapshot(), p))? + .on_sync::(|s, ()| Ok(s.collect_garbage()))? + .on_sync::(|s, p| handlers::handle_join_lines(s.snapshot(), p))? + .on_sync::(|s, p| handlers::handle_on_enter(s.snapshot(), p))? .on_sync::(|s, p| { handlers::handle_selection_range(s.snapshot(), p) })? - .on_sync::(|s, p| { + .on_sync::(|s, p| { handlers::handle_find_matching_brace(s.snapshot(), p) })? - .on::(handlers::handle_analyzer_status)? - .on::(handlers::handle_syntax_tree)? - .on::(handlers::handle_expand_macro)? + .on::(handlers::handle_analyzer_status)? + .on::(handlers::handle_syntax_tree)? + .on::(handlers::handle_expand_macro)? + .on::(handlers::handle_parent_module)? + .on::(handlers::handle_runnables)? + .on::(handlers::handle_inlay_hints)? .on::(handlers::handle_on_type_formatting)? .on::(handlers::handle_document_symbol)? .on::(handlers::handle_workspace_symbol)? .on::(handlers::handle_goto_definition)? .on::(handlers::handle_goto_implementation)? .on::(handlers::handle_goto_type_definition)? - .on::(handlers::handle_parent_module)? - .on::(handlers::handle_runnables)? .on::(handlers::handle_completion)? .on::(handlers::handle_code_action)? .on::(handlers::handle_code_lens)? @@ -534,7 +534,6 @@ fn on_request( .on::(handlers::handle_references)? .on::(handlers::handle_formatting)? .on::(handlers::handle_document_highlight)? - .on::(handlers::handle_inlay_hints)? .on::(handlers::handle_call_hierarchy_prepare)? .on::( handlers::handle_call_hierarchy_incoming, @@ -546,7 +545,7 @@ fn on_request( .on::( handlers::handle_semantic_tokens_range, )? - .on::(handlers::handle_ssr)? + .on::(handlers::handle_ssr)? .finish(); Ok(()) } 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::{ config::RustfmtConfig, diagnostics::DiagnosticTask, from_json, from_proto, - req::{self, InlayHint, InlayHintsParams}, + lsp_ext::{self, InlayHint, InlayHintsParams}, to_proto, world::WorldSnapshot, LspError, Result, @@ -52,7 +52,10 @@ pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result { Ok(buf) } -pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -> Result { +pub fn handle_syntax_tree( + world: WorldSnapshot, + params: lsp_ext::SyntaxTreeParams, +) -> Result { let _p = profile("handle_syntax_tree"); let id = from_proto::file_id(&world, ¶ms.text_document.uri)?; let line_index = world.analysis().file_line_index(id)?; @@ -63,8 +66,8 @@ pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) - pub fn handle_expand_macro( world: WorldSnapshot, - params: req::ExpandMacroParams, -) -> Result> { + params: lsp_ext::ExpandMacroParams, +) -> Result> { let _p = profile("handle_expand_macro"); let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; let line_index = world.analysis().file_line_index(file_id)?; @@ -74,7 +77,7 @@ pub fn handle_expand_macro( None => Ok(None), Some(offset) => { let res = world.analysis().expand_macro(FilePosition { file_id, offset })?; - Ok(res.map(|it| req::ExpandedMacro { name: it.name, expansion: it.expansion })) + Ok(res.map(|it| lsp_ext::ExpandedMacro { name: it.name, expansion: it.expansion })) } } } @@ -124,7 +127,7 @@ pub fn handle_selection_range( pub fn handle_find_matching_brace( world: WorldSnapshot, - params: req::FindMatchingBraceParams, + params: lsp_ext::FindMatchingBraceParams, ) -> Result> { let _p = profile("handle_find_matching_brace"); let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; @@ -146,8 +149,8 @@ pub fn handle_find_matching_brace( pub fn handle_join_lines( world: WorldSnapshot, - params: req::JoinLinesParams, -) -> Result { + params: lsp_ext::JoinLinesParams, +) -> Result { let _p = profile("handle_join_lines"); let frange = from_proto::file_range(&world, params.text_document, params.range)?; let source_change = world.analysis().join_lines(frange)?; @@ -157,7 +160,7 @@ pub fn handle_join_lines( pub fn handle_on_enter( world: WorldSnapshot, params: lsp_types::TextDocumentPositionParams, -) -> Result> { +) -> Result> { let _p = profile("handle_on_enter"); let position = from_proto::file_position(&world, params)?; match world.analysis().on_enter(position)? { @@ -388,8 +391,8 @@ pub fn handle_parent_module( pub fn handle_runnables( world: WorldSnapshot, - params: req::RunnablesParams, -) -> Result> { + params: lsp_ext::RunnablesParams, +) -> Result> { let _p = profile("handle_runnables"); let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?; let line_index = world.analysis().file_line_index(file_id)?; @@ -419,7 +422,7 @@ pub fn handle_runnables( match cargo_spec { Some(spec) => { for &cmd in ["check", "test"].iter() { - res.push(req::Runnable { + res.push(lsp_ext::Runnable { range: Default::default(), label: format!("cargo {} -p {}", cmd, spec.package), bin: "cargo".to_string(), @@ -431,7 +434,7 @@ pub fn handle_runnables( } } None => { - res.push(req::Runnable { + res.push(lsp_ext::Runnable { range: Default::default(), label: "cargo check --workspace".to_string(), bin: "cargo".to_string(), @@ -972,7 +975,10 @@ pub fn handle_document_highlight( Ok(Some(res)) } -pub fn handle_ssr(world: WorldSnapshot, params: req::SsrParams) -> Result { +pub fn handle_ssr( + world: WorldSnapshot, + params: lsp_ext::SsrParams, +) -> Result { let _p = profile("handle_ssr"); let source_change = world.analysis().structural_search_replace(¶ms.query, params.parse_only)??; @@ -1003,7 +1009,7 @@ fn to_lsp_runnable( world: &WorldSnapshot, file_id: FileId, runnable: Runnable, -) -> Result { +) -> Result { let spec = CargoTargetSpec::for_file(world, file_id)?; let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?; let line_index = world.analysis().file_line_index(file_id)?; @@ -1014,7 +1020,7 @@ fn to_lsp_runnable( RunnableKind::DocTest { test_id, .. } => format!("doctest {}", test_id), RunnableKind::Bin => "run binary".to_string(), }; - Ok(req::Runnable { + Ok(lsp_ext::Runnable { range: to_proto::range(&line_index, runnable.range), label, bin: "cargo".to_string(), diff --git a/crates/rust-analyzer/src/req.rs b/crates/rust-analyzer/src/req.rs deleted file mode 100644 index aeb29370c..000000000 --- a/crates/rust-analyzer/src/req.rs +++ /dev/null @@ -1,185 +0,0 @@ -//! Defines `rust-analyzer` specific custom messages. - -use lsp_types::request::Request; -use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; -use rustc_hash::FxHashMap; -use serde::{Deserialize, Serialize}; - -use std::path::PathBuf; - -pub enum AnalyzerStatus {} - -impl Request for AnalyzerStatus { - type Params = (); - type Result = String; - const METHOD: &'static str = "rust-analyzer/analyzerStatus"; -} - -pub enum CollectGarbage {} - -impl Request for CollectGarbage { - type Params = (); - type Result = (); - const METHOD: &'static str = "rust-analyzer/collectGarbage"; -} - -pub enum SyntaxTree {} - -impl Request for SyntaxTree { - type Params = SyntaxTreeParams; - type Result = String; - const METHOD: &'static str = "rust-analyzer/syntaxTree"; -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct SyntaxTreeParams { - pub text_document: TextDocumentIdentifier, - pub range: Option, -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct ExpandedMacro { - pub name: String, - pub expansion: String, -} - -pub enum ExpandMacro {} - -impl Request for ExpandMacro { - type Params = ExpandMacroParams; - type Result = Option; - const METHOD: &'static str = "rust-analyzer/expandMacro"; -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct ExpandMacroParams { - pub text_document: TextDocumentIdentifier, - pub position: Option, -} - -pub enum FindMatchingBrace {} - -impl Request for FindMatchingBrace { - type Params = FindMatchingBraceParams; - type Result = Vec; - const METHOD: &'static str = "rust-analyzer/findMatchingBrace"; -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct FindMatchingBraceParams { - pub text_document: TextDocumentIdentifier, - pub offsets: Vec, -} - -pub enum ParentModule {} - -impl Request for ParentModule { - type Params = lsp_types::TextDocumentPositionParams; - type Result = Vec; - const METHOD: &'static str = "rust-analyzer/parentModule"; -} - -pub enum JoinLines {} - -impl Request for JoinLines { - type Params = JoinLinesParams; - type Result = SourceChange; - const METHOD: &'static str = "rust-analyzer/joinLines"; -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct JoinLinesParams { - pub text_document: TextDocumentIdentifier, - pub range: Range, -} - -pub enum OnEnter {} - -impl Request for OnEnter { - type Params = lsp_types::TextDocumentPositionParams; - type Result = Option; - const METHOD: &'static str = "rust-analyzer/onEnter"; -} - -pub enum Runnables {} - -impl Request for Runnables { - type Params = RunnablesParams; - type Result = Vec; - const METHOD: &'static str = "rust-analyzer/runnables"; -} - -#[derive(Serialize, Deserialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct RunnablesParams { - pub text_document: TextDocumentIdentifier, - pub position: Option, -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct Runnable { - pub range: Range, - pub label: String, - pub bin: String, - pub args: Vec, - pub extra_args: Vec, - pub env: FxHashMap, - pub cwd: Option, -} - -#[derive(Deserialize, Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct SourceChange { - pub label: String, - pub workspace_edit: lsp_types::WorkspaceEdit, - pub cursor_position: Option, -} - -pub enum InlayHints {} - -impl Request for InlayHints { - type Params = InlayHintsParams; - type Result = Vec; - const METHOD: &'static str = "rust-analyzer/inlayHints"; -} - -#[derive(Serialize, Deserialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct InlayHintsParams { - pub text_document: TextDocumentIdentifier, -} - -#[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] -pub enum InlayKind { - TypeHint, - ParameterHint, - ChainingHint, -} - -#[derive(Debug, Deserialize, Serialize)] -pub struct InlayHint { - pub range: Range, - pub kind: InlayKind, - pub label: String, -} - -pub enum Ssr {} - -impl Request for Ssr { - type Params = SsrParams; - type Result = SourceChange; - const METHOD: &'static str = "rust-analyzer/ssr"; -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct SsrParams { - pub query: String, - pub parse_only: bool, -} 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}; use ra_text_edit::{Indel, TextEdit}; use ra_vfs::LineEndings; -use crate::{req, semantic_tokens, world::WorldSnapshot, Result}; +use crate::{lsp_ext, semantic_tokens, world::WorldSnapshot, Result}; pub(crate) fn position(line_index: &LineIndex, offset: TextSize) -> lsp_types::Position { let line_col = line_index.line_col(offset); @@ -215,14 +215,14 @@ pub(crate) fn signature_information( lsp_types::SignatureInformation { label, documentation, parameters: Some(parameters) } } -pub(crate) fn inlay_int(line_index: &LineIndex, inlay_hint: InlayHint) -> req::InlayHint { - req::InlayHint { +pub(crate) fn inlay_int(line_index: &LineIndex, inlay_hint: InlayHint) -> lsp_ext::InlayHint { + lsp_ext::InlayHint { label: inlay_hint.label.to_string(), range: range(line_index, inlay_hint.range), kind: match inlay_hint.kind { - InlayKind::ParameterHint => req::InlayKind::ParameterHint, - InlayKind::TypeHint => req::InlayKind::TypeHint, - InlayKind::ChainingHint => req::InlayKind::ChainingHint, + InlayKind::ParameterHint => lsp_ext::InlayKind::ParameterHint, + InlayKind::TypeHint => lsp_ext::InlayKind::TypeHint, + InlayKind::ChainingHint => lsp_ext::InlayKind::ChainingHint, }, } } @@ -478,7 +478,7 @@ pub(crate) fn resource_op( pub(crate) fn source_change( world: &WorldSnapshot, source_change: SourceChange, -) -> Result { +) -> Result { let cursor_position = match source_change.cursor_position { None => None, Some(pos) => { @@ -513,7 +513,7 @@ pub(crate) fn source_change( changes: None, document_changes: Some(lsp_types::DocumentChanges::Operations(document_changes)), }; - Ok(req::SourceChange { label: source_change.label, workspace_edit, cursor_position }) + Ok(lsp_ext::SourceChange { label: source_change.label, workspace_edit, cursor_position }) } 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; use std::{collections::HashMap, path::PathBuf, time::Instant}; use lsp_types::{ - CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions, - GotoDefinitionParams, HoverParams, PartialResultParams, Position, Range, TextDocumentItem, - TextDocumentPositionParams, WorkDoneProgressParams, -}; -use rust_analyzer::req::{ - CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument, - Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest, OnEnter, Runnables, - RunnablesParams, + notification::DidOpenTextDocument, + request::{ + CodeActionRequest, Completion, Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest, + }, + CodeActionContext, CodeActionParams, CompletionParams, DidOpenTextDocumentParams, + DocumentFormattingParams, FormattingOptions, GotoDefinitionParams, HoverParams, + PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams, + WorkDoneProgressParams, }; +use rust_analyzer::lsp_ext::{OnEnter, Runnables, RunnablesParams}; use serde_json::json; use tempfile::TempDir; 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::{ request::Shutdown, DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress, }; +use lsp_types::{ProgressParams, ProgressParamsValue}; use serde::Serialize; use serde_json::{to_string_pretty, Value}; use tempfile::TempDir; use test_utils::{find_mismatch, parse_fixture}; -use req::{ProgressParams, ProgressParamsValue}; use rust_analyzer::{ config::{ClientCapsConfig, Config}, - main_loop, req, + main_loop, }; pub struct Project<'a> { @@ -206,7 +206,7 @@ impl Server { Message::Notification(n) if n.method == "$/progress" => { match n.clone().extract::("$/progress").unwrap() { ProgressParams { - token: req::ProgressToken::String(ref token), + token: lsp_types::ProgressToken::String(ref token), value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)), } if token == "rustAnalyzer/startup" => true, _ => false, -- cgit v1.2.3