diff options
Diffstat (limited to 'crates/rust-analyzer/src/config.rs')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index fab15f860..fa8472e62 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -74,19 +74,18 @@ pub struct LensConfig { | |||
74 | pub run: bool, | 74 | pub run: bool, |
75 | pub debug: bool, | 75 | pub debug: bool, |
76 | pub implementations: bool, | 76 | pub implementations: bool, |
77 | pub method_refs: bool, | ||
77 | } | 78 | } |
78 | 79 | ||
79 | impl Default for LensConfig { | 80 | impl Default for LensConfig { |
80 | fn default() -> Self { | 81 | fn default() -> Self { |
81 | Self { run: true, debug: true, implementations: true } | 82 | Self { run: true, debug: true, implementations: true, method_refs: true } |
82 | } | 83 | } |
83 | } | 84 | } |
84 | 85 | ||
85 | impl LensConfig { | 86 | impl LensConfig { |
86 | pub const NO_LENS: LensConfig = Self { run: false, debug: false, implementations: false }; | ||
87 | |||
88 | pub fn any(&self) -> bool { | 87 | pub fn any(&self) -> bool { |
89 | self.implementations || self.runnable() | 88 | self.implementations || self.runnable() || self.references() |
90 | } | 89 | } |
91 | 90 | ||
92 | pub fn none(&self) -> bool { | 91 | pub fn none(&self) -> bool { |
@@ -96,6 +95,10 @@ impl LensConfig { | |||
96 | pub fn runnable(&self) -> bool { | 95 | pub fn runnable(&self) -> bool { |
97 | self.run || self.debug | 96 | self.run || self.debug |
98 | } | 97 | } |
98 | |||
99 | pub fn references(&self) -> bool { | ||
100 | self.method_refs | ||
101 | } | ||
99 | } | 102 | } |
100 | 103 | ||
101 | #[derive(Debug, Clone)] | 104 | #[derive(Debug, Clone)] |
@@ -278,6 +281,7 @@ impl Config { | |||
278 | run: data.lens_enable && data.lens_run, | 281 | run: data.lens_enable && data.lens_run, |
279 | debug: data.lens_enable && data.lens_debug, | 282 | debug: data.lens_enable && data.lens_debug, |
280 | implementations: data.lens_enable && data.lens_implementations, | 283 | implementations: data.lens_enable && data.lens_implementations, |
284 | method_refs: data.lens_enable && data.lens_methodReferences, | ||
281 | }; | 285 | }; |
282 | 286 | ||
283 | if !data.linkedProjects.is_empty() { | 287 | if !data.linkedProjects.is_empty() { |
@@ -459,10 +463,11 @@ config_data! { | |||
459 | inlayHints_parameterHints: bool = true, | 463 | inlayHints_parameterHints: bool = true, |
460 | inlayHints_typeHints: bool = true, | 464 | inlayHints_typeHints: bool = true, |
461 | 465 | ||
462 | lens_debug: bool = true, | 466 | lens_debug: bool = true, |
463 | lens_enable: bool = true, | 467 | lens_enable: bool = true, |
464 | lens_implementations: bool = true, | 468 | lens_implementations: bool = true, |
465 | lens_run: bool = true, | 469 | lens_run: bool = true, |
470 | lens_methodReferences: bool = true, | ||
466 | 471 | ||
467 | linkedProjects: Vec<ManifestOrProjectJson> = Vec::new(), | 472 | linkedProjects: Vec<ManifestOrProjectJson> = Vec::new(), |
468 | lruCapacity: Option<usize> = None, | 473 | lruCapacity: Option<usize> = None, |