5039: Flatten module hierarchy r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-06-24 16:58:44 +00:00 committed by GitHub
commit bff7307b8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 67 deletions

View file

@ -20,7 +20,7 @@ use crate::{
diagnostics::{CheckFixes, DiagnosticCollection}, diagnostics::{CheckFixes, DiagnosticCollection},
from_proto, from_proto,
line_endings::LineEndings, line_endings::LineEndings,
main_loop::request_metrics::{LatestRequests, RequestMetrics}, request_metrics::{LatestRequests, RequestMetrics},
to_proto::url_from_abs_path, to_proto::url_from_abs_path,
Result, Result,
}; };
@ -46,32 +46,32 @@ fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) ->
/// snapshot of the file systems, and `analysis_host`, which stores our /// snapshot of the file systems, and `analysis_host`, which stores our
/// incremental salsa database. /// incremental salsa database.
#[derive(Debug)] #[derive(Debug)]
pub struct GlobalState { pub(crate) struct GlobalState {
pub config: Config, pub(crate) config: Config,
pub workspaces: Arc<Vec<ProjectWorkspace>>, pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
pub analysis_host: AnalysisHost, pub(crate) analysis_host: AnalysisHost,
pub loader: Box<dyn vfs::loader::Handle>, pub(crate) loader: Box<dyn vfs::loader::Handle>,
pub task_receiver: Receiver<vfs::loader::Message>, pub(crate) task_receiver: Receiver<vfs::loader::Message>,
pub flycheck: Option<Flycheck>, pub(crate) flycheck: Option<Flycheck>,
pub diagnostics: DiagnosticCollection, pub(crate) diagnostics: DiagnosticCollection,
pub proc_macro_client: ProcMacroClient, pub(crate) proc_macro_client: ProcMacroClient,
pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
source_root_config: SourceRootConfig, source_root_config: SourceRootConfig,
} }
/// An immutable snapshot of the world's state at a point in time. /// An immutable snapshot of the world's state at a point in time.
pub struct GlobalStateSnapshot { pub(crate) struct GlobalStateSnapshot {
pub config: Config, pub(crate) config: Config,
pub workspaces: Arc<Vec<ProjectWorkspace>>, pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
pub analysis: Analysis, pub(crate) analysis: Analysis,
pub check_fixes: CheckFixes, pub(crate) check_fixes: CheckFixes,
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
} }
impl GlobalState { impl GlobalState {
pub fn new( pub(crate) fn new(
workspaces: Vec<ProjectWorkspace>, workspaces: Vec<ProjectWorkspace>,
lru_capacity: Option<usize>, lru_capacity: Option<usize>,
config: Config, config: Config,
@ -241,7 +241,7 @@ impl GlobalStateSnapshot {
self.vfs.read().1[&id] self.vfs.read().1[&id]
} }
pub fn anchored_path(&self, file_id: FileId, path: &str) -> Url { pub(crate) fn anchored_path(&self, file_id: FileId, path: &str) -> Url {
let mut base = self.vfs.read().0.file_path(file_id); let mut base = self.vfs.read().0.file_path(file_id);
base.pop(); base.pop();
let path = base.join(path); let path = base.join(path);
@ -264,7 +264,7 @@ impl GlobalStateSnapshot {
}) })
} }
pub fn status(&self) -> String { pub(crate) fn status(&self) -> String {
let mut buf = String::new(); let mut buf = String::new();
if self.workspaces.is_empty() { if self.workspaces.is_empty() {
buf.push_str("no workspaces\n") buf.push_str("no workspaces\n")
@ -349,7 +349,7 @@ pub(crate) struct SourceRootConfig {
} }
impl SourceRootConfig { impl SourceRootConfig {
pub fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> {
self.fsc self.fsc
.partition(vfs) .partition(vfs)
.into_iter() .into_iter()

View file

@ -38,7 +38,7 @@ use crate::{
to_proto, LspError, Result, to_proto, LspError, Result,
}; };
pub fn handle_analyzer_status(snap: GlobalStateSnapshot, _: ()) -> Result<String> { pub(crate) fn handle_analyzer_status(snap: GlobalStateSnapshot, _: ()) -> Result<String> {
let _p = profile("handle_analyzer_status"); let _p = profile("handle_analyzer_status");
let mut buf = snap.status(); let mut buf = snap.status();
format_to!(buf, "\n\nrequests:\n"); format_to!(buf, "\n\nrequests:\n");
@ -50,7 +50,7 @@ pub fn handle_analyzer_status(snap: GlobalStateSnapshot, _: ()) -> Result<String
Ok(buf) Ok(buf)
} }
pub fn handle_syntax_tree( pub(crate) fn handle_syntax_tree(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::SyntaxTreeParams, params: lsp_ext::SyntaxTreeParams,
) -> Result<String> { ) -> Result<String> {
@ -62,7 +62,7 @@ pub fn handle_syntax_tree(
Ok(res) Ok(res)
} }
pub fn handle_expand_macro( pub(crate) fn handle_expand_macro(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::ExpandMacroParams, params: lsp_ext::ExpandMacroParams,
) -> Result<Option<lsp_ext::ExpandedMacro>> { ) -> Result<Option<lsp_ext::ExpandedMacro>> {
@ -75,7 +75,7 @@ pub fn handle_expand_macro(
Ok(res.map(|it| lsp_ext::ExpandedMacro { name: it.name, expansion: it.expansion })) Ok(res.map(|it| lsp_ext::ExpandedMacro { name: it.name, expansion: it.expansion }))
} }
pub fn handle_selection_range( pub(crate) fn handle_selection_range(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::SelectionRangeParams, params: lsp_types::SelectionRangeParams,
) -> Result<Option<Vec<lsp_types::SelectionRange>>> { ) -> Result<Option<Vec<lsp_types::SelectionRange>>> {
@ -118,7 +118,7 @@ pub fn handle_selection_range(
Ok(Some(res?)) Ok(Some(res?))
} }
pub fn handle_matching_brace( pub(crate) fn handle_matching_brace(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::MatchingBraceParams, params: lsp_ext::MatchingBraceParams,
) -> Result<Vec<Position>> { ) -> Result<Vec<Position>> {
@ -140,7 +140,7 @@ pub fn handle_matching_brace(
Ok(res) Ok(res)
} }
pub fn handle_join_lines( pub(crate) fn handle_join_lines(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::JoinLinesParams, params: lsp_ext::JoinLinesParams,
) -> Result<Vec<lsp_types::TextEdit>> { ) -> Result<Vec<lsp_types::TextEdit>> {
@ -163,7 +163,7 @@ pub fn handle_join_lines(
Ok(res) Ok(res)
} }
pub fn handle_on_enter( pub(crate) fn handle_on_enter(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::TextDocumentPositionParams, params: lsp_types::TextDocumentPositionParams,
) -> Result<Option<Vec<lsp_ext::SnippetTextEdit>>> { ) -> Result<Option<Vec<lsp_ext::SnippetTextEdit>>> {
@ -180,7 +180,7 @@ pub fn handle_on_enter(
} }
// Don't forget to add new trigger characters to `ServerCapabilities` in `caps.rs`. // Don't forget to add new trigger characters to `ServerCapabilities` in `caps.rs`.
pub fn handle_on_type_formatting( pub(crate) fn handle_on_type_formatting(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::DocumentOnTypeFormattingParams, params: lsp_types::DocumentOnTypeFormattingParams,
) -> Result<Option<Vec<lsp_types::TextEdit>>> { ) -> Result<Option<Vec<lsp_types::TextEdit>>> {
@ -219,7 +219,7 @@ pub fn handle_on_type_formatting(
Ok(Some(change)) Ok(Some(change))
} }
pub fn handle_document_symbol( pub(crate) fn handle_document_symbol(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::DocumentSymbolParams, params: lsp_types::DocumentSymbolParams,
) -> Result<Option<lsp_types::DocumentSymbolResponse>> { ) -> Result<Option<lsp_types::DocumentSymbolResponse>> {
@ -287,7 +287,7 @@ pub fn handle_document_symbol(
} }
} }
pub fn handle_workspace_symbol( pub(crate) fn handle_workspace_symbol(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::WorkspaceSymbolParams, params: lsp_types::WorkspaceSymbolParams,
) -> Result<Option<Vec<SymbolInformation>>> { ) -> Result<Option<Vec<SymbolInformation>>> {
@ -331,7 +331,7 @@ pub fn handle_workspace_symbol(
} }
} }
pub fn handle_goto_definition( pub(crate) fn handle_goto_definition(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::GotoDefinitionParams, params: lsp_types::GotoDefinitionParams,
) -> Result<Option<lsp_types::GotoDefinitionResponse>> { ) -> Result<Option<lsp_types::GotoDefinitionResponse>> {
@ -346,7 +346,7 @@ pub fn handle_goto_definition(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_goto_implementation( pub(crate) fn handle_goto_implementation(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::request::GotoImplementationParams, params: lsp_types::request::GotoImplementationParams,
) -> Result<Option<lsp_types::request::GotoImplementationResponse>> { ) -> Result<Option<lsp_types::request::GotoImplementationResponse>> {
@ -361,7 +361,7 @@ pub fn handle_goto_implementation(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_goto_type_definition( pub(crate) fn handle_goto_type_definition(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::request::GotoTypeDefinitionParams, params: lsp_types::request::GotoTypeDefinitionParams,
) -> Result<Option<lsp_types::request::GotoTypeDefinitionResponse>> { ) -> Result<Option<lsp_types::request::GotoTypeDefinitionResponse>> {
@ -376,7 +376,7 @@ pub fn handle_goto_type_definition(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_parent_module( pub(crate) fn handle_parent_module(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::TextDocumentPositionParams, params: lsp_types::TextDocumentPositionParams,
) -> Result<Option<lsp_types::GotoDefinitionResponse>> { ) -> Result<Option<lsp_types::GotoDefinitionResponse>> {
@ -387,7 +387,7 @@ pub fn handle_parent_module(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_runnables( pub(crate) fn handle_runnables(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::RunnablesParams, params: lsp_ext::RunnablesParams,
) -> Result<Vec<lsp_ext::Runnable>> { ) -> Result<Vec<lsp_ext::Runnable>> {
@ -446,7 +446,7 @@ pub fn handle_runnables(
Ok(res) Ok(res)
} }
pub fn handle_completion( pub(crate) fn handle_completion(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::CompletionParams, params: lsp_types::CompletionParams,
) -> Result<Option<lsp_types::CompletionResponse>> { ) -> Result<Option<lsp_types::CompletionResponse>> {
@ -488,7 +488,7 @@ pub fn handle_completion(
Ok(Some(items.into())) Ok(Some(items.into()))
} }
pub fn handle_folding_range( pub(crate) fn handle_folding_range(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: FoldingRangeParams, params: FoldingRangeParams,
) -> Result<Option<Vec<FoldingRange>>> { ) -> Result<Option<Vec<FoldingRange>>> {
@ -505,7 +505,7 @@ pub fn handle_folding_range(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_signature_help( pub(crate) fn handle_signature_help(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::SignatureHelpParams, params: lsp_types::SignatureHelpParams,
) -> Result<Option<lsp_types::SignatureHelp>> { ) -> Result<Option<lsp_types::SignatureHelp>> {
@ -529,7 +529,7 @@ pub fn handle_signature_help(
})) }))
} }
pub fn handle_hover( pub(crate) fn handle_hover(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::HoverParams, params: lsp_types::HoverParams,
) -> Result<Option<lsp_ext::Hover>> { ) -> Result<Option<lsp_ext::Hover>> {
@ -555,7 +555,7 @@ pub fn handle_hover(
Ok(Some(hover)) Ok(Some(hover))
} }
pub fn handle_prepare_rename( pub(crate) fn handle_prepare_rename(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::TextDocumentPositionParams, params: lsp_types::TextDocumentPositionParams,
) -> Result<Option<PrepareRenameResponse>> { ) -> Result<Option<PrepareRenameResponse>> {
@ -573,7 +573,7 @@ pub fn handle_prepare_rename(
Ok(Some(PrepareRenameResponse::Range(range))) Ok(Some(PrepareRenameResponse::Range(range)))
} }
pub fn handle_rename( pub(crate) fn handle_rename(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: RenameParams, params: RenameParams,
) -> Result<Option<WorkspaceEdit>> { ) -> Result<Option<WorkspaceEdit>> {
@ -597,7 +597,7 @@ pub fn handle_rename(
Ok(Some(workspace_edit)) Ok(Some(workspace_edit))
} }
pub fn handle_references( pub(crate) fn handle_references(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::ReferenceParams, params: lsp_types::ReferenceParams,
) -> Result<Option<Vec<Location>>> { ) -> Result<Option<Vec<Location>>> {
@ -624,7 +624,7 @@ pub fn handle_references(
Ok(Some(locations)) Ok(Some(locations))
} }
pub fn handle_formatting( pub(crate) fn handle_formatting(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: DocumentFormattingParams, params: DocumentFormattingParams,
) -> Result<Option<Vec<lsp_types::TextEdit>>> { ) -> Result<Option<Vec<lsp_types::TextEdit>>> {
@ -739,7 +739,7 @@ fn handle_fixes(
Ok(()) Ok(())
} }
pub fn handle_code_action( pub(crate) fn handle_code_action(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::CodeActionParams, params: lsp_types::CodeActionParams,
) -> Result<Option<Vec<lsp_ext::CodeAction>>> { ) -> Result<Option<Vec<lsp_ext::CodeAction>>> {
@ -774,7 +774,7 @@ pub fn handle_code_action(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_resolve_code_action( pub(crate) fn handle_resolve_code_action(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::ResolveCodeActionParams, params: lsp_ext::ResolveCodeActionParams,
) -> Result<Option<lsp_ext::SnippetWorkspaceEdit>> { ) -> Result<Option<lsp_ext::SnippetWorkspaceEdit>> {
@ -792,7 +792,7 @@ pub fn handle_resolve_code_action(
Ok(to_proto::resolved_code_action(&snap, assist.clone())?.edit) Ok(to_proto::resolved_code_action(&snap, assist.clone())?.edit)
} }
pub fn handle_code_lens( pub(crate) fn handle_code_lens(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::CodeLensParams, params: lsp_types::CodeLensParams,
) -> Result<Option<Vec<CodeLens>>> { ) -> Result<Option<Vec<CodeLens>>> {
@ -873,7 +873,7 @@ enum CodeLensResolveData {
Impls(lsp_types::request::GotoImplementationParams), Impls(lsp_types::request::GotoImplementationParams),
} }
pub fn handle_code_lens_resolve( pub(crate) fn handle_code_lens_resolve(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
code_lens: CodeLens, code_lens: CodeLens,
) -> Result<CodeLens> { ) -> Result<CodeLens> {
@ -910,7 +910,7 @@ pub fn handle_code_lens_resolve(
} }
} }
pub fn handle_document_highlight( pub(crate) fn handle_document_highlight(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_types::DocumentHighlightParams, params: lsp_types::DocumentHighlightParams,
) -> Result<Option<Vec<DocumentHighlight>>> { ) -> Result<Option<Vec<DocumentHighlight>>> {
@ -937,7 +937,7 @@ pub fn handle_document_highlight(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_ssr( pub(crate) fn handle_ssr(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: lsp_ext::SsrParams, params: lsp_ext::SsrParams,
) -> Result<lsp_types::WorkspaceEdit> { ) -> Result<lsp_types::WorkspaceEdit> {
@ -947,7 +947,10 @@ pub fn handle_ssr(
to_proto::workspace_edit(&snap, source_change) to_proto::workspace_edit(&snap, source_change)
} }
pub fn publish_diagnostics(snap: &GlobalStateSnapshot, file_id: FileId) -> Result<DiagnosticTask> { pub(crate) fn publish_diagnostics(
snap: &GlobalStateSnapshot,
file_id: FileId,
) -> Result<DiagnosticTask> {
let _p = profile("publish_diagnostics"); let _p = profile("publish_diagnostics");
let line_index = snap.analysis().file_line_index(file_id)?; let line_index = snap.analysis().file_line_index(file_id)?;
let diagnostics: Vec<Diagnostic> = snap let diagnostics: Vec<Diagnostic> = snap
@ -967,7 +970,7 @@ pub fn publish_diagnostics(snap: &GlobalStateSnapshot, file_id: FileId) -> Resul
Ok(DiagnosticTask::SetNative(file_id, diagnostics)) Ok(DiagnosticTask::SetNative(file_id, diagnostics))
} }
pub fn handle_inlay_hints( pub(crate) fn handle_inlay_hints(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: InlayHintsParams, params: InlayHintsParams,
) -> Result<Vec<InlayHint>> { ) -> Result<Vec<InlayHint>> {
@ -982,7 +985,7 @@ pub fn handle_inlay_hints(
.collect()) .collect())
} }
pub fn handle_call_hierarchy_prepare( pub(crate) fn handle_call_hierarchy_prepare(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: CallHierarchyPrepareParams, params: CallHierarchyPrepareParams,
) -> Result<Option<Vec<CallHierarchyItem>>> { ) -> Result<Option<Vec<CallHierarchyItem>>> {
@ -1004,7 +1007,7 @@ pub fn handle_call_hierarchy_prepare(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_call_hierarchy_incoming( pub(crate) fn handle_call_hierarchy_incoming(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: CallHierarchyIncomingCallsParams, params: CallHierarchyIncomingCallsParams,
) -> Result<Option<Vec<CallHierarchyIncomingCall>>> { ) -> Result<Option<Vec<CallHierarchyIncomingCall>>> {
@ -1039,7 +1042,7 @@ pub fn handle_call_hierarchy_incoming(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_call_hierarchy_outgoing( pub(crate) fn handle_call_hierarchy_outgoing(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: CallHierarchyOutgoingCallsParams, params: CallHierarchyOutgoingCallsParams,
) -> Result<Option<Vec<CallHierarchyOutgoingCall>>> { ) -> Result<Option<Vec<CallHierarchyOutgoingCall>>> {
@ -1074,7 +1077,7 @@ pub fn handle_call_hierarchy_outgoing(
Ok(Some(res)) Ok(Some(res))
} }
pub fn handle_semantic_tokens( pub(crate) fn handle_semantic_tokens(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: SemanticTokensParams, params: SemanticTokensParams,
) -> Result<Option<SemanticTokensResult>> { ) -> Result<Option<SemanticTokensResult>> {
@ -1089,7 +1092,7 @@ pub fn handle_semantic_tokens(
Ok(Some(semantic_tokens.into())) Ok(Some(semantic_tokens.into()))
} }
pub fn handle_semantic_tokens_range( pub(crate) fn handle_semantic_tokens_range(
snap: GlobalStateSnapshot, snap: GlobalStateSnapshot,
params: SemanticTokensRangeParams, params: SemanticTokensRangeParams,
) -> Result<Option<SemanticTokensRangeResult>> { ) -> Result<Option<SemanticTokensRangeResult>> {

View file

@ -17,18 +17,20 @@ macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
} }
mod global_state;
mod main_loop;
mod handlers;
mod caps; mod caps;
mod cargo_target_spec; mod cargo_target_spec;
mod to_proto; mod to_proto;
mod from_proto; mod from_proto;
mod main_loop; mod semantic_tokens;
mod markdown; mod markdown;
mod diagnostics;
mod line_endings;
mod request_metrics;
pub mod lsp_ext; pub mod lsp_ext;
pub mod config; pub mod config;
mod global_state;
mod diagnostics;
mod semantic_tokens;
mod line_endings;
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;

View file

@ -1,9 +1,5 @@
//! The main loop of `rust-analyzer` responsible for dispatching LSP //! The main loop of `rust-analyzer` responsible for dispatching LSP
//! requests/replies and notifications back to the client. //! requests/replies and notifications back to the client.
mod handlers;
pub(crate) mod request_metrics;
use std::{ use std::{
env, env,
error::Error, error::Error,
@ -19,6 +15,7 @@ use lsp_server::{
Connection, ErrorCode, Message, Notification, ReqQueue, Request, RequestId, Response, Connection, ErrorCode, Message, Notification, ReqQueue, Request, RequestId, Response,
}; };
use lsp_types::{request::Request as _, NumberOrString, TextDocumentContentChangeEvent}; use lsp_types::{request::Request as _, NumberOrString, TextDocumentContentChangeEvent};
use ra_db::VfsPath;
use ra_flycheck::CheckTask; use ra_flycheck::CheckTask;
use ra_ide::{Canceled, FileId, LineIndex}; use ra_ide::{Canceled, FileId, LineIndex};
use ra_prof::profile; use ra_prof::profile;
@ -32,11 +29,10 @@ use crate::{
diagnostics::DiagnosticTask, diagnostics::DiagnosticTask,
from_proto, from_proto,
global_state::{file_id_to_url, GlobalState, GlobalStateSnapshot}, global_state::{file_id_to_url, GlobalState, GlobalStateSnapshot},
lsp_ext, handlers, lsp_ext,
main_loop::request_metrics::RequestMetrics, request_metrics::RequestMetrics,
Result, Result,
}; };
use ra_db::VfsPath;
#[derive(Debug)] #[derive(Debug)]
pub struct LspError { pub struct LspError {