diff options
author | Aleksey Kladov <[email protected]> | 2020-06-25 23:54:41 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-25 23:54:41 +0100 |
commit | 5f6f994256a4a91f1caba9cabfd7a4552180a9da (patch) | |
tree | e7cf891ed12ec26e9dc17e774a0c71091dc0eae5 /crates/rust-analyzer | |
parent | dd5841556c97e4f42d20393cfc0543973742833c (diff) |
Simplify
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 9 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 3 |
2 files changed, 4 insertions, 8 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 17de2a075..a8cc71249 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -84,11 +84,7 @@ pub(crate) struct GlobalStateSnapshot { | |||
84 | } | 84 | } |
85 | 85 | ||
86 | impl GlobalState { | 86 | impl GlobalState { |
87 | pub(crate) fn new( | 87 | pub(crate) fn new(sender: Sender<lsp_server::Message>, config: Config) -> GlobalState { |
88 | sender: Sender<lsp_server::Message>, | ||
89 | lru_capacity: Option<usize>, | ||
90 | config: Config, | ||
91 | ) -> GlobalState { | ||
92 | let loader = { | 88 | let loader = { |
93 | let (sender, receiver) = unbounded::<vfs::loader::Message>(); | 89 | let (sender, receiver) = unbounded::<vfs::loader::Message>(); |
94 | let handle = | 90 | let handle = |
@@ -103,12 +99,13 @@ impl GlobalState { | |||
103 | Handle { handle, receiver } | 99 | Handle { handle, receiver } |
104 | }; | 100 | }; |
105 | 101 | ||
102 | let analysis_host = AnalysisHost::new(config.lru_capacity); | ||
106 | GlobalState { | 103 | GlobalState { |
107 | sender, | 104 | sender, |
108 | task_pool, | 105 | task_pool, |
109 | loader, | 106 | loader, |
110 | config, | 107 | config, |
111 | analysis_host: AnalysisHost::new(lru_capacity), | 108 | analysis_host, |
112 | flycheck: None, | 109 | flycheck: None, |
113 | diagnostics: Default::default(), | 110 | diagnostics: Default::default(), |
114 | mem_docs: FxHashSet::default(), | 111 | mem_docs: FxHashSet::default(), |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index d4879283d..d03c68edf 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -44,8 +44,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> { | |||
44 | SetThreadPriority(thread, thread_priority_above_normal); | 44 | SetThreadPriority(thread, thread_priority_above_normal); |
45 | } | 45 | } |
46 | 46 | ||
47 | GlobalState::new(connection.sender.clone(), config.lru_capacity, config) | 47 | GlobalState::new(connection.sender.clone(), config).run(connection.receiver) |
48 | .run(connection.receiver) | ||
49 | } | 48 | } |
50 | 49 | ||
51 | enum Event { | 50 | enum Event { |