diff options
author | Aleksey Kladov <[email protected]> | 2019-07-08 12:09:38 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-08 12:09:38 +0100 |
commit | e075e096cf4970014d2c0829476fd7a45a3f32b1 (patch) | |
tree | b074a36491d838bae9405ac42f3e64ef9b4dcd60 /crates/ra_lsp_server/src/world.rs | |
parent | b042faeb64d858c26b05dbf543925bf626454282 (diff) |
don't send LocationLink unless the client opts-in
closes #1474
Diffstat (limited to 'crates/ra_lsp_server/src/world.rs')
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index fdc577622..9fd654305 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -19,6 +19,13 @@ use crate::{ | |||
19 | LspError, Result, | 19 | LspError, Result, |
20 | }; | 20 | }; |
21 | 21 | ||
22 | #[derive(Debug, Clone)] | ||
23 | pub struct Options { | ||
24 | pub publish_decorations: bool, | ||
25 | pub show_workspace_loaded: bool, | ||
26 | pub supports_location_link: bool, | ||
27 | } | ||
28 | |||
22 | /// `WorldState` is the primary mutable state of the language server | 29 | /// `WorldState` is the primary mutable state of the language server |
23 | /// | 30 | /// |
24 | /// The most interesting components are `vfs`, which stores a consistent | 31 | /// The most interesting components are `vfs`, which stores a consistent |
@@ -26,6 +33,7 @@ use crate::{ | |||
26 | /// incremental salsa database. | 33 | /// incremental salsa database. |
27 | #[derive(Debug)] | 34 | #[derive(Debug)] |
28 | pub struct WorldState { | 35 | pub struct WorldState { |
36 | pub options: Options, | ||
29 | pub roots_to_scan: usize, | 37 | pub roots_to_scan: usize, |
30 | pub roots: Vec<PathBuf>, | 38 | pub roots: Vec<PathBuf>, |
31 | pub workspaces: Arc<Vec<ProjectWorkspace>>, | 39 | pub workspaces: Arc<Vec<ProjectWorkspace>>, |
@@ -36,6 +44,7 @@ pub struct WorldState { | |||
36 | 44 | ||
37 | /// An immutable snapshot of the world's state at a point in time. | 45 | /// An immutable snapshot of the world's state at a point in time. |
38 | pub struct WorldSnapshot { | 46 | pub struct WorldSnapshot { |
47 | pub options: Options, | ||
39 | pub workspaces: Arc<Vec<ProjectWorkspace>>, | 48 | pub workspaces: Arc<Vec<ProjectWorkspace>>, |
40 | pub analysis: Analysis, | 49 | pub analysis: Analysis, |
41 | pub vfs: Arc<RwLock<Vfs>>, | 50 | pub vfs: Arc<RwLock<Vfs>>, |
@@ -47,6 +56,7 @@ impl WorldState { | |||
47 | folder_roots: Vec<PathBuf>, | 56 | folder_roots: Vec<PathBuf>, |
48 | workspaces: Vec<ProjectWorkspace>, | 57 | workspaces: Vec<ProjectWorkspace>, |
49 | lru_capacity: Option<usize>, | 58 | lru_capacity: Option<usize>, |
59 | options: Options, | ||
50 | ) -> WorldState { | 60 | ) -> WorldState { |
51 | let mut change = AnalysisChange::new(); | 61 | let mut change = AnalysisChange::new(); |
52 | 62 | ||
@@ -78,6 +88,7 @@ impl WorldState { | |||
78 | let mut analysis_host = AnalysisHost::new(lru_capacity); | 88 | let mut analysis_host = AnalysisHost::new(lru_capacity); |
79 | analysis_host.apply_change(change); | 89 | analysis_host.apply_change(change); |
80 | WorldState { | 90 | WorldState { |
91 | options, | ||
81 | roots_to_scan, | 92 | roots_to_scan, |
82 | roots: folder_roots, | 93 | roots: folder_roots, |
83 | workspaces: Arc::new(workspaces), | 94 | workspaces: Arc::new(workspaces), |
@@ -140,6 +151,7 @@ impl WorldState { | |||
140 | 151 | ||
141 | pub fn snapshot(&self) -> WorldSnapshot { | 152 | pub fn snapshot(&self) -> WorldSnapshot { |
142 | WorldSnapshot { | 153 | WorldSnapshot { |
154 | options: self.options.clone(), | ||
143 | workspaces: Arc::clone(&self.workspaces), | 155 | workspaces: Arc::clone(&self.workspaces), |
144 | analysis: self.analysis_host.analysis(), | 156 | analysis: self.analysis_host.analysis(), |
145 | vfs: Arc::clone(&self.vfs), | 157 | vfs: Arc::clone(&self.vfs), |