diff options
author | kjeremy <[email protected]> | 2020-07-24 14:01:48 +0100 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-07-24 14:02:57 +0100 |
commit | 48da2d4c16a05bf0559c864d2b3f1b832d1fec85 (patch) | |
tree | 83d2512711ead30e30e2ca93aaf57a3a577676c3 /crates/rust-analyzer/src/global_state.rs | |
parent | 0e5095d3cac11d4b569c6e1594bd07937556c812 (diff) |
Add DocumentData to represent in-memory document with LSP info
Diffstat (limited to 'crates/rust-analyzer/src/global_state.rs')
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 80937dbc4..b2d65a6d1 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -17,6 +17,7 @@ use rustc_hash::FxHashMap; | |||
17 | use crate::{ | 17 | use crate::{ |
18 | config::Config, | 18 | config::Config, |
19 | diagnostics::{CheckFixes, DiagnosticCollection}, | 19 | diagnostics::{CheckFixes, DiagnosticCollection}, |
20 | document::DocumentData, | ||
20 | from_proto, | 21 | from_proto, |
21 | line_endings::LineEndings, | 22 | line_endings::LineEndings, |
22 | main_loop::Task, | 23 | main_loop::Task, |
@@ -69,7 +70,7 @@ pub(crate) struct GlobalState { | |||
69 | pub(crate) config: Config, | 70 | pub(crate) config: Config, |
70 | pub(crate) analysis_host: AnalysisHost, | 71 | pub(crate) analysis_host: AnalysisHost, |
71 | pub(crate) diagnostics: DiagnosticCollection, | 72 | pub(crate) diagnostics: DiagnosticCollection, |
72 | pub(crate) mem_docs: FxHashMap<VfsPath, Option<i64>>, | 73 | pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>, |
73 | pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, | 74 | pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, |
74 | pub(crate) status: Status, | 75 | pub(crate) status: Status, |
75 | pub(crate) source_root_config: SourceRootConfig, | 76 | pub(crate) source_root_config: SourceRootConfig, |
@@ -84,7 +85,7 @@ pub(crate) struct GlobalStateSnapshot { | |||
84 | pub(crate) analysis: Analysis, | 85 | pub(crate) analysis: Analysis, |
85 | pub(crate) check_fixes: CheckFixes, | 86 | pub(crate) check_fixes: CheckFixes, |
86 | pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, | 87 | pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, |
87 | mem_docs: FxHashMap<VfsPath, Option<i64>>, | 88 | mem_docs: FxHashMap<VfsPath, DocumentData>, |
88 | vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, | 89 | vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, |
89 | pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>, | 90 | pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>, |
90 | } | 91 | } |
@@ -259,7 +260,7 @@ impl GlobalStateSnapshot { | |||
259 | 260 | ||
260 | pub(crate) fn url_file_version(&self, url: &Url) -> Option<i64> { | 261 | pub(crate) fn url_file_version(&self, url: &Url) -> Option<i64> { |
261 | let path = from_proto::vfs_path(&url).ok()?; | 262 | let path = from_proto::vfs_path(&url).ok()?; |
262 | self.mem_docs.get(&path).copied()? | 263 | self.mem_docs.get(&path)?.version |
263 | } | 264 | } |
264 | 265 | ||
265 | pub(crate) fn anchored_path(&self, file_id: FileId, path: &str) -> Url { | 266 | pub(crate) fn anchored_path(&self, file_id: FileId, path: &str) -> Url { |