diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-31 19:50:34 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-31 19:50:34 +0100 |
commit | 5023860a55328db5ef024225263ed71f46a19350 (patch) | |
tree | 0ea40483691d7b9a7822149c670aeb84231a1bb2 /crates/ra_lsp_server/src/main_loop/subscriptions.rs | |
parent | 6c1ec865fb931ffd789e2caa9e2ce82d1df97c4d (diff) | |
parent | 78e17f65cfa0013ea51d94f0142ca6d4bcc5d088 (diff) |
Merge #1356
1356: move completed requests to a separate file r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/subscriptions.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/subscriptions.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/subscriptions.rs b/crates/ra_lsp_server/src/main_loop/subscriptions.rs index 11bd952d9..470bc1205 100644 --- a/crates/ra_lsp_server/src/main_loop/subscriptions.rs +++ b/crates/ra_lsp_server/src/main_loop/subscriptions.rs | |||
@@ -1,21 +1,19 @@ | |||
1 | use ra_ide_api::FileId; | 1 | use ra_ide_api::FileId; |
2 | use rustc_hash::FxHashSet; | 2 | use rustc_hash::FxHashSet; |
3 | 3 | ||
4 | pub struct Subscriptions { | 4 | #[derive(Default)] |
5 | pub(crate) struct Subscriptions { | ||
5 | subs: FxHashSet<FileId>, | 6 | subs: FxHashSet<FileId>, |
6 | } | 7 | } |
7 | 8 | ||
8 | impl Subscriptions { | 9 | impl Subscriptions { |
9 | pub fn new() -> Subscriptions { | 10 | pub(crate) fn add_sub(&mut self, file_id: FileId) { |
10 | Subscriptions { subs: FxHashSet::default() } | ||
11 | } | ||
12 | pub fn add_sub(&mut self, file_id: FileId) { | ||
13 | self.subs.insert(file_id); | 11 | self.subs.insert(file_id); |
14 | } | 12 | } |
15 | pub fn remove_sub(&mut self, file_id: FileId) { | 13 | pub(crate) fn remove_sub(&mut self, file_id: FileId) { |
16 | self.subs.remove(&file_id); | 14 | self.subs.remove(&file_id); |
17 | } | 15 | } |
18 | pub fn subscriptions(&self) -> Vec<FileId> { | 16 | pub(crate) fn subscriptions(&self) -> Vec<FileId> { |
19 | self.subs.iter().cloned().collect() | 17 | self.subs.iter().cloned().collect() |
20 | } | 18 | } |
21 | } | 19 | } |