mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
req -> lsp_ext
This commit is contained in:
parent
bec3bf701c
commit
3bec2be9de
7 changed files with 58 additions and 53 deletions
|
@ -24,8 +24,7 @@ mod to_proto;
|
||||||
mod from_proto;
|
mod from_proto;
|
||||||
mod main_loop;
|
mod main_loop;
|
||||||
mod markdown;
|
mod markdown;
|
||||||
// TODO: rename to lsp_ext
|
pub mod lsp_ext;
|
||||||
pub mod req;
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
mod world;
|
mod world;
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//! Defines `rust-analyzer` specific custom messages.
|
//! rust-analyzer extensions to the LSP.
|
||||||
|
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use lsp_types::request::Request;
|
use lsp_types::request::Request;
|
||||||
use lsp_types::{Location, Position, Range, TextDocumentIdentifier};
|
use lsp_types::{Location, Position, Range, TextDocumentIdentifier};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
pub enum AnalyzerStatus {}
|
pub enum AnalyzerStatus {}
|
||||||
|
|
||||||
impl Request for AnalyzerStatus {
|
impl Request for AnalyzerStatus {
|
|
@ -38,12 +38,11 @@ use threadpool::ThreadPool;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config, FilesWatcher},
|
config::{Config, FilesWatcher},
|
||||||
diagnostics::DiagnosticTask,
|
diagnostics::DiagnosticTask,
|
||||||
from_proto,
|
from_proto, lsp_ext,
|
||||||
main_loop::{
|
main_loop::{
|
||||||
pending_requests::{PendingRequest, PendingRequests},
|
pending_requests::{PendingRequest, PendingRequests},
|
||||||
subscriptions::Subscriptions,
|
subscriptions::Subscriptions,
|
||||||
},
|
},
|
||||||
req,
|
|
||||||
world::{WorldSnapshot, WorldState},
|
world::{WorldSnapshot, WorldState},
|
||||||
Result,
|
Result,
|
||||||
};
|
};
|
||||||
|
@ -502,26 +501,27 @@ fn on_request(
|
||||||
request_received,
|
request_received,
|
||||||
};
|
};
|
||||||
pool_dispatcher
|
pool_dispatcher
|
||||||
.on_sync::<req::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))?
|
.on_sync::<lsp_ext::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))?
|
||||||
.on_sync::<req::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
|
.on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
|
||||||
.on_sync::<req::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))?
|
.on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))?
|
||||||
.on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| {
|
.on_sync::<lsp_types::request::SelectionRangeRequest>(|s, p| {
|
||||||
handlers::handle_selection_range(s.snapshot(), p)
|
handlers::handle_selection_range(s.snapshot(), p)
|
||||||
})?
|
})?
|
||||||
.on_sync::<req::FindMatchingBrace>(|s, p| {
|
.on_sync::<lsp_ext::FindMatchingBrace>(|s, p| {
|
||||||
handlers::handle_find_matching_brace(s.snapshot(), p)
|
handlers::handle_find_matching_brace(s.snapshot(), p)
|
||||||
})?
|
})?
|
||||||
.on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)?
|
.on::<lsp_ext::AnalyzerStatus>(handlers::handle_analyzer_status)?
|
||||||
.on::<req::SyntaxTree>(handlers::handle_syntax_tree)?
|
.on::<lsp_ext::SyntaxTree>(handlers::handle_syntax_tree)?
|
||||||
.on::<req::ExpandMacro>(handlers::handle_expand_macro)?
|
.on::<lsp_ext::ExpandMacro>(handlers::handle_expand_macro)?
|
||||||
|
.on::<lsp_ext::ParentModule>(handlers::handle_parent_module)?
|
||||||
|
.on::<lsp_ext::Runnables>(handlers::handle_runnables)?
|
||||||
|
.on::<lsp_ext::InlayHints>(handlers::handle_inlay_hints)?
|
||||||
.on::<lsp_types::request::OnTypeFormatting>(handlers::handle_on_type_formatting)?
|
.on::<lsp_types::request::OnTypeFormatting>(handlers::handle_on_type_formatting)?
|
||||||
.on::<lsp_types::request::DocumentSymbolRequest>(handlers::handle_document_symbol)?
|
.on::<lsp_types::request::DocumentSymbolRequest>(handlers::handle_document_symbol)?
|
||||||
.on::<lsp_types::request::WorkspaceSymbol>(handlers::handle_workspace_symbol)?
|
.on::<lsp_types::request::WorkspaceSymbol>(handlers::handle_workspace_symbol)?
|
||||||
.on::<lsp_types::request::GotoDefinition>(handlers::handle_goto_definition)?
|
.on::<lsp_types::request::GotoDefinition>(handlers::handle_goto_definition)?
|
||||||
.on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)?
|
.on::<lsp_types::request::GotoImplementation>(handlers::handle_goto_implementation)?
|
||||||
.on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)?
|
.on::<lsp_types::request::GotoTypeDefinition>(handlers::handle_goto_type_definition)?
|
||||||
.on::<req::ParentModule>(handlers::handle_parent_module)?
|
|
||||||
.on::<req::Runnables>(handlers::handle_runnables)?
|
|
||||||
.on::<lsp_types::request::Completion>(handlers::handle_completion)?
|
.on::<lsp_types::request::Completion>(handlers::handle_completion)?
|
||||||
.on::<lsp_types::request::CodeActionRequest>(handlers::handle_code_action)?
|
.on::<lsp_types::request::CodeActionRequest>(handlers::handle_code_action)?
|
||||||
.on::<lsp_types::request::CodeLensRequest>(handlers::handle_code_lens)?
|
.on::<lsp_types::request::CodeLensRequest>(handlers::handle_code_lens)?
|
||||||
|
@ -534,7 +534,6 @@ fn on_request(
|
||||||
.on::<lsp_types::request::References>(handlers::handle_references)?
|
.on::<lsp_types::request::References>(handlers::handle_references)?
|
||||||
.on::<lsp_types::request::Formatting>(handlers::handle_formatting)?
|
.on::<lsp_types::request::Formatting>(handlers::handle_formatting)?
|
||||||
.on::<lsp_types::request::DocumentHighlightRequest>(handlers::handle_document_highlight)?
|
.on::<lsp_types::request::DocumentHighlightRequest>(handlers::handle_document_highlight)?
|
||||||
.on::<req::InlayHints>(handlers::handle_inlay_hints)?
|
|
||||||
.on::<lsp_types::request::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)?
|
.on::<lsp_types::request::CallHierarchyPrepare>(handlers::handle_call_hierarchy_prepare)?
|
||||||
.on::<lsp_types::request::CallHierarchyIncomingCalls>(
|
.on::<lsp_types::request::CallHierarchyIncomingCalls>(
|
||||||
handlers::handle_call_hierarchy_incoming,
|
handlers::handle_call_hierarchy_incoming,
|
||||||
|
@ -546,7 +545,7 @@ fn on_request(
|
||||||
.on::<lsp_types::request::SemanticTokensRangeRequest>(
|
.on::<lsp_types::request::SemanticTokensRangeRequest>(
|
||||||
handlers::handle_semantic_tokens_range,
|
handlers::handle_semantic_tokens_range,
|
||||||
)?
|
)?
|
||||||
.on::<req::Ssr>(handlers::handle_ssr)?
|
.on::<lsp_ext::Ssr>(handlers::handle_ssr)?
|
||||||
.finish();
|
.finish();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ use crate::{
|
||||||
config::RustfmtConfig,
|
config::RustfmtConfig,
|
||||||
diagnostics::DiagnosticTask,
|
diagnostics::DiagnosticTask,
|
||||||
from_json, from_proto,
|
from_json, from_proto,
|
||||||
req::{self, InlayHint, InlayHintsParams},
|
lsp_ext::{self, InlayHint, InlayHintsParams},
|
||||||
to_proto,
|
to_proto,
|
||||||
world::WorldSnapshot,
|
world::WorldSnapshot,
|
||||||
LspError, Result,
|
LspError, Result,
|
||||||
|
@ -52,7 +52,10 @@ pub fn handle_analyzer_status(world: WorldSnapshot, _: ()) -> Result<String> {
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -> Result<String> {
|
pub fn handle_syntax_tree(
|
||||||
|
world: WorldSnapshot,
|
||||||
|
params: lsp_ext::SyntaxTreeParams,
|
||||||
|
) -> Result<String> {
|
||||||
let _p = profile("handle_syntax_tree");
|
let _p = profile("handle_syntax_tree");
|
||||||
let id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
let id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
||||||
let line_index = world.analysis().file_line_index(id)?;
|
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(
|
pub fn handle_expand_macro(
|
||||||
world: WorldSnapshot,
|
world: WorldSnapshot,
|
||||||
params: req::ExpandMacroParams,
|
params: lsp_ext::ExpandMacroParams,
|
||||||
) -> Result<Option<req::ExpandedMacro>> {
|
) -> Result<Option<lsp_ext::ExpandedMacro>> {
|
||||||
let _p = profile("handle_expand_macro");
|
let _p = profile("handle_expand_macro");
|
||||||
let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
||||||
let line_index = world.analysis().file_line_index(file_id)?;
|
let line_index = world.analysis().file_line_index(file_id)?;
|
||||||
|
@ -74,7 +77,7 @@ pub fn handle_expand_macro(
|
||||||
None => Ok(None),
|
None => Ok(None),
|
||||||
Some(offset) => {
|
Some(offset) => {
|
||||||
let res = world.analysis().expand_macro(FilePosition { file_id, 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(
|
pub fn handle_find_matching_brace(
|
||||||
world: WorldSnapshot,
|
world: WorldSnapshot,
|
||||||
params: req::FindMatchingBraceParams,
|
params: lsp_ext::FindMatchingBraceParams,
|
||||||
) -> Result<Vec<Position>> {
|
) -> Result<Vec<Position>> {
|
||||||
let _p = profile("handle_find_matching_brace");
|
let _p = profile("handle_find_matching_brace");
|
||||||
let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
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(
|
pub fn handle_join_lines(
|
||||||
world: WorldSnapshot,
|
world: WorldSnapshot,
|
||||||
params: req::JoinLinesParams,
|
params: lsp_ext::JoinLinesParams,
|
||||||
) -> Result<req::SourceChange> {
|
) -> Result<lsp_ext::SourceChange> {
|
||||||
let _p = profile("handle_join_lines");
|
let _p = profile("handle_join_lines");
|
||||||
let frange = from_proto::file_range(&world, params.text_document, params.range)?;
|
let frange = from_proto::file_range(&world, params.text_document, params.range)?;
|
||||||
let source_change = world.analysis().join_lines(frange)?;
|
let source_change = world.analysis().join_lines(frange)?;
|
||||||
|
@ -157,7 +160,7 @@ pub fn handle_join_lines(
|
||||||
pub fn handle_on_enter(
|
pub fn handle_on_enter(
|
||||||
world: WorldSnapshot,
|
world: WorldSnapshot,
|
||||||
params: lsp_types::TextDocumentPositionParams,
|
params: lsp_types::TextDocumentPositionParams,
|
||||||
) -> Result<Option<req::SourceChange>> {
|
) -> Result<Option<lsp_ext::SourceChange>> {
|
||||||
let _p = profile("handle_on_enter");
|
let _p = profile("handle_on_enter");
|
||||||
let position = from_proto::file_position(&world, params)?;
|
let position = from_proto::file_position(&world, params)?;
|
||||||
match world.analysis().on_enter(position)? {
|
match world.analysis().on_enter(position)? {
|
||||||
|
@ -388,8 +391,8 @@ pub fn handle_parent_module(
|
||||||
|
|
||||||
pub fn handle_runnables(
|
pub fn handle_runnables(
|
||||||
world: WorldSnapshot,
|
world: WorldSnapshot,
|
||||||
params: req::RunnablesParams,
|
params: lsp_ext::RunnablesParams,
|
||||||
) -> Result<Vec<req::Runnable>> {
|
) -> Result<Vec<lsp_ext::Runnable>> {
|
||||||
let _p = profile("handle_runnables");
|
let _p = profile("handle_runnables");
|
||||||
let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
let file_id = from_proto::file_id(&world, ¶ms.text_document.uri)?;
|
||||||
let line_index = world.analysis().file_line_index(file_id)?;
|
let line_index = world.analysis().file_line_index(file_id)?;
|
||||||
|
@ -419,7 +422,7 @@ pub fn handle_runnables(
|
||||||
match cargo_spec {
|
match cargo_spec {
|
||||||
Some(spec) => {
|
Some(spec) => {
|
||||||
for &cmd in ["check", "test"].iter() {
|
for &cmd in ["check", "test"].iter() {
|
||||||
res.push(req::Runnable {
|
res.push(lsp_ext::Runnable {
|
||||||
range: Default::default(),
|
range: Default::default(),
|
||||||
label: format!("cargo {} -p {}", cmd, spec.package),
|
label: format!("cargo {} -p {}", cmd, spec.package),
|
||||||
bin: "cargo".to_string(),
|
bin: "cargo".to_string(),
|
||||||
|
@ -431,7 +434,7 @@ pub fn handle_runnables(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
res.push(req::Runnable {
|
res.push(lsp_ext::Runnable {
|
||||||
range: Default::default(),
|
range: Default::default(),
|
||||||
label: "cargo check --workspace".to_string(),
|
label: "cargo check --workspace".to_string(),
|
||||||
bin: "cargo".to_string(),
|
bin: "cargo".to_string(),
|
||||||
|
@ -972,7 +975,10 @@ pub fn handle_document_highlight(
|
||||||
Ok(Some(res))
|
Ok(Some(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_ssr(world: WorldSnapshot, params: req::SsrParams) -> Result<req::SourceChange> {
|
pub fn handle_ssr(
|
||||||
|
world: WorldSnapshot,
|
||||||
|
params: lsp_ext::SsrParams,
|
||||||
|
) -> Result<lsp_ext::SourceChange> {
|
||||||
let _p = profile("handle_ssr");
|
let _p = profile("handle_ssr");
|
||||||
let source_change =
|
let source_change =
|
||||||
world.analysis().structural_search_replace(¶ms.query, params.parse_only)??;
|
world.analysis().structural_search_replace(¶ms.query, params.parse_only)??;
|
||||||
|
@ -1003,7 +1009,7 @@ fn to_lsp_runnable(
|
||||||
world: &WorldSnapshot,
|
world: &WorldSnapshot,
|
||||||
file_id: FileId,
|
file_id: FileId,
|
||||||
runnable: Runnable,
|
runnable: Runnable,
|
||||||
) -> Result<req::Runnable> {
|
) -> Result<lsp_ext::Runnable> {
|
||||||
let spec = CargoTargetSpec::for_file(world, file_id)?;
|
let spec = CargoTargetSpec::for_file(world, file_id)?;
|
||||||
let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?;
|
let (args, extra_args) = CargoTargetSpec::runnable_args(spec, &runnable.kind)?;
|
||||||
let line_index = world.analysis().file_line_index(file_id)?;
|
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::DocTest { test_id, .. } => format!("doctest {}", test_id),
|
||||||
RunnableKind::Bin => "run binary".to_string(),
|
RunnableKind::Bin => "run binary".to_string(),
|
||||||
};
|
};
|
||||||
Ok(req::Runnable {
|
Ok(lsp_ext::Runnable {
|
||||||
range: to_proto::range(&line_index, runnable.range),
|
range: to_proto::range(&line_index, runnable.range),
|
||||||
label,
|
label,
|
||||||
bin: "cargo".to_string(),
|
bin: "cargo".to_string(),
|
||||||
|
|
|
@ -10,7 +10,7 @@ use ra_syntax::{SyntaxKind, TextRange, TextSize};
|
||||||
use ra_text_edit::{Indel, TextEdit};
|
use ra_text_edit::{Indel, TextEdit};
|
||||||
use ra_vfs::LineEndings;
|
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 {
|
pub(crate) fn position(line_index: &LineIndex, offset: TextSize) -> lsp_types::Position {
|
||||||
let line_col = line_index.line_col(offset);
|
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) }
|
lsp_types::SignatureInformation { label, documentation, parameters: Some(parameters) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn inlay_int(line_index: &LineIndex, inlay_hint: InlayHint) -> req::InlayHint {
|
pub(crate) fn inlay_int(line_index: &LineIndex, inlay_hint: InlayHint) -> lsp_ext::InlayHint {
|
||||||
req::InlayHint {
|
lsp_ext::InlayHint {
|
||||||
label: inlay_hint.label.to_string(),
|
label: inlay_hint.label.to_string(),
|
||||||
range: range(line_index, inlay_hint.range),
|
range: range(line_index, inlay_hint.range),
|
||||||
kind: match inlay_hint.kind {
|
kind: match inlay_hint.kind {
|
||||||
InlayKind::ParameterHint => req::InlayKind::ParameterHint,
|
InlayKind::ParameterHint => lsp_ext::InlayKind::ParameterHint,
|
||||||
InlayKind::TypeHint => req::InlayKind::TypeHint,
|
InlayKind::TypeHint => lsp_ext::InlayKind::TypeHint,
|
||||||
InlayKind::ChainingHint => req::InlayKind::ChainingHint,
|
InlayKind::ChainingHint => lsp_ext::InlayKind::ChainingHint,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ pub(crate) fn resource_op(
|
||||||
pub(crate) fn source_change(
|
pub(crate) fn source_change(
|
||||||
world: &WorldSnapshot,
|
world: &WorldSnapshot,
|
||||||
source_change: SourceChange,
|
source_change: SourceChange,
|
||||||
) -> Result<req::SourceChange> {
|
) -> Result<lsp_ext::SourceChange> {
|
||||||
let cursor_position = match source_change.cursor_position {
|
let cursor_position = match source_change.cursor_position {
|
||||||
None => None,
|
None => None,
|
||||||
Some(pos) => {
|
Some(pos) => {
|
||||||
|
@ -513,7 +513,7 @@ pub(crate) fn source_change(
|
||||||
changes: None,
|
changes: None,
|
||||||
document_changes: Some(lsp_types::DocumentChanges::Operations(document_changes)),
|
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(
|
pub fn call_hierarchy_item(
|
||||||
|
|
|
@ -3,15 +3,16 @@ mod support;
|
||||||
use std::{collections::HashMap, path::PathBuf, time::Instant};
|
use std::{collections::HashMap, path::PathBuf, time::Instant};
|
||||||
|
|
||||||
use lsp_types::{
|
use lsp_types::{
|
||||||
CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions,
|
notification::DidOpenTextDocument,
|
||||||
GotoDefinitionParams, HoverParams, PartialResultParams, Position, Range, TextDocumentItem,
|
request::{
|
||||||
TextDocumentPositionParams, WorkDoneProgressParams,
|
CodeActionRequest, Completion, Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest,
|
||||||
};
|
},
|
||||||
use rust_analyzer::req::{
|
CodeActionContext, CodeActionParams, CompletionParams, DidOpenTextDocumentParams,
|
||||||
CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument,
|
DocumentFormattingParams, FormattingOptions, GotoDefinitionParams, HoverParams,
|
||||||
Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest, OnEnter, Runnables,
|
PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams,
|
||||||
RunnablesParams,
|
WorkDoneProgressParams,
|
||||||
};
|
};
|
||||||
|
use rust_analyzer::lsp_ext::{OnEnter, Runnables, RunnablesParams};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use test_utils::skip_slow_tests;
|
use test_utils::skip_slow_tests;
|
||||||
|
|
|
@ -13,15 +13,15 @@ use lsp_types::{
|
||||||
request::Shutdown,
|
request::Shutdown,
|
||||||
DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress,
|
DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url, WorkDoneProgress,
|
||||||
};
|
};
|
||||||
|
use lsp_types::{ProgressParams, ProgressParamsValue};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::{to_string_pretty, Value};
|
use serde_json::{to_string_pretty, Value};
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use test_utils::{find_mismatch, parse_fixture};
|
use test_utils::{find_mismatch, parse_fixture};
|
||||||
|
|
||||||
use req::{ProgressParams, ProgressParamsValue};
|
|
||||||
use rust_analyzer::{
|
use rust_analyzer::{
|
||||||
config::{ClientCapsConfig, Config},
|
config::{ClientCapsConfig, Config},
|
||||||
main_loop, req,
|
main_loop,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Project<'a> {
|
pub struct Project<'a> {
|
||||||
|
@ -206,7 +206,7 @@ impl Server {
|
||||||
Message::Notification(n) if n.method == "$/progress" => {
|
Message::Notification(n) if n.method == "$/progress" => {
|
||||||
match n.clone().extract::<ProgressParams>("$/progress").unwrap() {
|
match n.clone().extract::<ProgressParams>("$/progress").unwrap() {
|
||||||
ProgressParams {
|
ProgressParams {
|
||||||
token: req::ProgressToken::String(ref token),
|
token: lsp_types::ProgressToken::String(ref token),
|
||||||
value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)),
|
value: ProgressParamsValue::WorkDone(WorkDoneProgress::End(_)),
|
||||||
} if token == "rustAnalyzer/startup" => true,
|
} if token == "rustAnalyzer/startup" => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue