diff options
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 52 | ||||
-rw-r--r-- | docs/user/generated_config.adoc | 5 | ||||
-rw-r--r-- | editors/code/package.json | 6 |
3 files changed, 13 insertions, 50 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 2adf95185..fa72a9bfb 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -142,9 +142,10 @@ config_data! { | |||
142 | highlighting_strings: bool = "true", | 142 | highlighting_strings: bool = "true", |
143 | 143 | ||
144 | /// Whether to show documentation on hover. | 144 | /// Whether to show documentation on hover. |
145 | hover_documentation: bool = "true", | 145 | hover_documentation: bool = "true", |
146 | /// Use markdown syntax for links in hover. | 146 | /// Use markdown syntax for links in hover. |
147 | hover_linksInHover: bool = "true", | 147 | hover_linksInHover | |
148 | hoverActions_linksInHover: bool = "true", | ||
148 | 149 | ||
149 | /// Whether to show `Debug` action. Only applies when | 150 | /// Whether to show `Debug` action. Only applies when |
150 | /// `#rust-analyzer.hoverActions.enable#` is set. | 151 | /// `#rust-analyzer.hoverActions.enable#` is set. |
@@ -163,9 +164,6 @@ config_data! { | |||
163 | /// Whether to show `Run` action. Only applies when | 164 | /// Whether to show `Run` action. Only applies when |
164 | /// `#rust-analyzer.hoverActions.enable#` is set. | 165 | /// `#rust-analyzer.hoverActions.enable#` is set. |
165 | hoverActions_run: bool = "true", | 166 | hoverActions_run: bool = "true", |
166 | #[deprecated = "Use hover.linksInHover instead"] | ||
167 | /// Use markdown syntax for links in hover. | ||
168 | hoverActions_linksInHover: bool = "false", | ||
169 | 167 | ||
170 | /// Whether to show inlay type hints for method chains. | 168 | /// Whether to show inlay type hints for method chains. |
171 | inlayHints_chainingHints: bool = "true", | 169 | inlayHints_chainingHints: bool = "true", |
@@ -732,7 +730,7 @@ impl Config { | |||
732 | run: self.data.hoverActions_enable && self.data.hoverActions_run, | 730 | run: self.data.hoverActions_enable && self.data.hoverActions_run, |
733 | debug: self.data.hoverActions_enable && self.data.hoverActions_debug, | 731 | debug: self.data.hoverActions_enable && self.data.hoverActions_debug, |
734 | goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef, | 732 | goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef, |
735 | links_in_hover: self.data.hoverActions_linksInHover || self.data.hover_linksInHover, | 733 | links_in_hover: self.data.hover_linksInHover, |
736 | markdown: try_or!( | 734 | markdown: try_or!( |
737 | self.caps | 735 | self.caps |
738 | .text_document | 736 | .text_document |
@@ -829,7 +827,6 @@ enum WorskpaceSymbolSearchKindDef { | |||
829 | macro_rules! _config_data { | 827 | macro_rules! _config_data { |
830 | (struct $name:ident { | 828 | (struct $name:ident { |
831 | $( | 829 | $( |
832 | $(#[deprecated=$deprecation_msg:literal])? | ||
833 | $(#[doc=$doc:literal])* | 830 | $(#[doc=$doc:literal])* |
834 | $field:ident $(| $alias:ident)*: $ty:ty = $default:expr, | 831 | $field:ident $(| $alias:ident)*: $ty:ty = $default:expr, |
835 | )* | 832 | )* |
@@ -854,9 +851,8 @@ macro_rules! _config_data { | |||
854 | $({ | 851 | $({ |
855 | let field = stringify!($field); | 852 | let field = stringify!($field); |
856 | let ty = stringify!($ty); | 853 | let ty = stringify!($ty); |
857 | let deprecation_msg = None $( .or(Some($deprecation_msg)) )?; | ||
858 | 854 | ||
859 | (field, ty, &[$($doc),*], $default, deprecation_msg) | 855 | (field, ty, &[$($doc),*], $default) |
860 | },)* | 856 | },)* |
861 | ]) | 857 | ]) |
862 | } | 858 | } |
@@ -867,9 +863,8 @@ macro_rules! _config_data { | |||
867 | $({ | 863 | $({ |
868 | let field = stringify!($field); | 864 | let field = stringify!($field); |
869 | let ty = stringify!($ty); | 865 | let ty = stringify!($ty); |
870 | let deprecation_msg = None $( .or(Some($deprecation_msg)) )?; | ||
871 | 866 | ||
872 | (field, ty, &[$($doc),*], $default, deprecation_msg) | 867 | (field, ty, &[$($doc),*], $default) |
873 | },)* | 868 | },)* |
874 | ]) | 869 | ]) |
875 | } | 870 | } |
@@ -899,9 +894,7 @@ fn get_field<T: DeserializeOwned>( | |||
899 | .unwrap_or(default) | 894 | .unwrap_or(default) |
900 | } | 895 | } |
901 | 896 | ||
902 | fn schema( | 897 | fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json::Value { |
903 | fields: &[(&'static str, &'static str, &[&str], &str, Option<&str>)], | ||
904 | ) -> serde_json::Value { | ||
905 | for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) { | 898 | for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) { |
906 | fn key(f: &str) -> &str { | 899 | fn key(f: &str) -> &str { |
907 | f.splitn(2, '_').next().unwrap() | 900 | f.splitn(2, '_').next().unwrap() |
@@ -911,23 +904,17 @@ fn schema( | |||
911 | 904 | ||
912 | let map = fields | 905 | let map = fields |
913 | .iter() | 906 | .iter() |
914 | .map(|(field, ty, doc, default, deprecation_msg)| { | 907 | .map(|(field, ty, doc, default)| { |
915 | let name = field.replace("_", "."); | 908 | let name = field.replace("_", "."); |
916 | let name = format!("rust-analyzer.{}", name); | 909 | let name = format!("rust-analyzer.{}", name); |
917 | let props = field_props(field, ty, doc, default, deprecation_msg.as_deref()); | 910 | let props = field_props(field, ty, doc, default); |
918 | (name, props) | 911 | (name, props) |
919 | }) | 912 | }) |
920 | .collect::<serde_json::Map<_, _>>(); | 913 | .collect::<serde_json::Map<_, _>>(); |
921 | map.into() | 914 | map.into() |
922 | } | 915 | } |
923 | 916 | ||
924 | fn field_props( | 917 | fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json::Value { |
925 | field: &str, | ||
926 | ty: &str, | ||
927 | doc: &[&str], | ||
928 | default: &str, | ||
929 | deprecation_msg: Option<&str>, | ||
930 | ) -> serde_json::Value { | ||
931 | let doc = doc_comment_to_string(doc); | 918 | let doc = doc_comment_to_string(doc); |
932 | let doc = doc.trim_end_matches('\n'); | 919 | let doc = doc.trim_end_matches('\n'); |
933 | assert!( | 920 | assert!( |
@@ -946,9 +933,6 @@ fn field_props( | |||
946 | } | 933 | } |
947 | set!("markdownDescription": doc); | 934 | set!("markdownDescription": doc); |
948 | set!("default": default); | 935 | set!("default": default); |
949 | if let Some(deprecation_msg) = deprecation_msg { | ||
950 | set!("deprecationMessage": deprecation_msg); | ||
951 | } | ||
952 | 936 | ||
953 | match ty { | 937 | match ty { |
954 | "bool" => set!("type": "boolean"), | 938 | "bool" => set!("type": "boolean"), |
@@ -1045,23 +1029,13 @@ fn field_props( | |||
1045 | } | 1029 | } |
1046 | 1030 | ||
1047 | #[cfg(test)] | 1031 | #[cfg(test)] |
1048 | fn manual(fields: &[(&'static str, &'static str, &[&str], &str, Option<&str>)]) -> String { | 1032 | fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String { |
1049 | fields | 1033 | fields |
1050 | .iter() | 1034 | .iter() |
1051 | .map(|(field, _ty, doc, default, deprecation_msg)| { | 1035 | .map(|(field, _ty, doc, default)| { |
1052 | let name = format!("rust-analyzer.{}", field.replace("_", ".")); | 1036 | let name = format!("rust-analyzer.{}", field.replace("_", ".")); |
1053 | let doc = doc_comment_to_string(*doc); | 1037 | let doc = doc_comment_to_string(*doc); |
1054 | match deprecation_msg { | 1038 | format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc) |
1055 | Some(deprecation_msg) => { | ||
1056 | format!( | ||
1057 | "[[{}]]{} (deprecated: `{}`)::\n+\n--\n{}--\n", | ||
1058 | name, name, deprecation_msg, doc | ||
1059 | ) | ||
1060 | } | ||
1061 | None => { | ||
1062 | format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc) | ||
1063 | } | ||
1064 | } | ||
1065 | }) | 1039 | }) |
1066 | .collect::<String>() | 1040 | .collect::<String>() |
1067 | } | 1041 | } |
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index 94a99c1ba..4105d784f 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc | |||
@@ -250,11 +250,6 @@ Whether to show `References` action. Only applies when | |||
250 | Whether to show `Run` action. Only applies when | 250 | Whether to show `Run` action. Only applies when |
251 | `#rust-analyzer.hoverActions.enable#` is set. | 251 | `#rust-analyzer.hoverActions.enable#` is set. |
252 | -- | 252 | -- |
253 | [[rust-analyzer.hoverActions.linksInHover]]rust-analyzer.hoverActions.linksInHover (deprecated: `Use hover.linksInHover instead`):: | ||
254 | + | ||
255 | -- | ||
256 | Use markdown syntax for links in hover. | ||
257 | -- | ||
258 | [[rust-analyzer.inlayHints.chainingHints]]rust-analyzer.inlayHints.chainingHints (default: `true`):: | 253 | [[rust-analyzer.inlayHints.chainingHints]]rust-analyzer.inlayHints.chainingHints (default: `true`):: |
259 | + | 254 | + |
260 | -- | 255 | -- |
diff --git a/editors/code/package.json b/editors/code/package.json index c24d3491c..43a5cc2b5 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -680,12 +680,6 @@ | |||
680 | "default": true, | 680 | "default": true, |
681 | "type": "boolean" | 681 | "type": "boolean" |
682 | }, | 682 | }, |
683 | "rust-analyzer.hoverActions.linksInHover": { | ||
684 | "markdownDescription": "Use markdown syntax for links in hover.", | ||
685 | "default": false, | ||
686 | "deprecationMessage": "Use hover.linksInHover instead", | ||
687 | "type": "boolean" | ||
688 | }, | ||
689 | "rust-analyzer.inlayHints.chainingHints": { | 683 | "rust-analyzer.inlayHints.chainingHints": { |
690 | "markdownDescription": "Whether to show inlay type hints for method chains.", | 684 | "markdownDescription": "Whether to show inlay type hints for method chains.", |
691 | "default": true, | 685 | "default": true, |