diff options
author | Lukas Wirth <[email protected]> | 2021-06-21 20:57:01 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-06-21 20:57:01 +0100 |
commit | 65d683df367ac1d2b8c421c61b76c9e2c26b8704 (patch) | |
tree | efa86f0065174077b7d3fa1a2c95c50963c2643b /crates/rust-analyzer | |
parent | 99c95b8fa15f2d9239625c19463f552c84ad99a2 (diff) |
Collapse documentation and markdown config settings into an enum
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index de70959a5..b9aa6f0aa 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -10,7 +10,10 @@ | |||
10 | use std::{ffi::OsString, iter, path::PathBuf}; | 10 | use std::{ffi::OsString, iter, path::PathBuf}; |
11 | 11 | ||
12 | use flycheck::FlycheckConfig; | 12 | use flycheck::FlycheckConfig; |
13 | use ide::{AssistConfig, CompletionConfig, DiagnosticsConfig, HoverConfig, InlayHintsConfig}; | 13 | use ide::{ |
14 | AssistConfig, CompletionConfig, DiagnosticsConfig, HoverConfig, HoverDocFormat, | ||
15 | InlayHintsConfig, | ||
16 | }; | ||
14 | use ide_db::helpers::{ | 17 | use ide_db::helpers::{ |
15 | insert_use::{ImportGranularity, InsertUseConfig, PrefixKind}, | 18 | insert_use::{ImportGranularity, InsertUseConfig, PrefixKind}, |
16 | SnippetCap, | 19 | SnippetCap, |
@@ -777,19 +780,25 @@ impl Config { | |||
777 | pub fn hover(&self) -> HoverConfig { | 780 | pub fn hover(&self) -> HoverConfig { |
778 | HoverConfig { | 781 | HoverConfig { |
779 | links_in_hover: self.data.hover_linksInHover, | 782 | links_in_hover: self.data.hover_linksInHover, |
780 | markdown: try_or!( | 783 | documentation: self.data.hover_documentation.then(|| { |
781 | self.caps | 784 | let is_markdown = try_or!( |
782 | .text_document | 785 | self.caps |
783 | .as_ref()? | 786 | .text_document |
784 | .hover | 787 | .as_ref()? |
785 | .as_ref()? | 788 | .hover |
786 | .content_format | 789 | .as_ref()? |
787 | .as_ref()? | 790 | .content_format |
788 | .as_slice(), | 791 | .as_ref()? |
789 | &[] | 792 | .as_slice(), |
790 | ) | 793 | &[] |
791 | .contains(&MarkupKind::Markdown), | 794 | ) |
792 | documentation: self.data.hover_documentation, | 795 | .contains(&MarkupKind::Markdown); |
796 | if is_markdown { | ||
797 | HoverDocFormat::Markdown | ||
798 | } else { | ||
799 | HoverDocFormat::PlainText | ||
800 | } | ||
801 | }), | ||
793 | } | 802 | } |
794 | } | 803 | } |
795 | 804 | ||