From 9ea6564940cac525438d1b79b574979b1ef746c4 Mon Sep 17 00:00:00 2001 From: PtiBouchon Date: Mon, 8 Jan 2024 22:51:19 +0100 Subject: [PATCH] Add possible values in the doc + json package --- crates/rust-analyzer/src/config.rs | 18 +++++++++++++++ docs/user/generated_config.adoc | 18 +++++++++++++++ editors/code/package.json | 36 +++++++++++++++--------------- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index fe009f82a71f..6dd0d4e2d3de 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -153,6 +153,7 @@ config_data! { /// Check all targets and tests (`--all-targets`). check_allTargets | checkOnSave_allTargets: bool = "true", /// Cargo command to use for `cargo check`. + /// Common alternative is `"clippy"`. check_command | checkOnSave_command: String = "\"check\"", /// Extra arguments for `cargo check`. check_extraArgs | checkOnSave_extraArgs: Vec = "[]", @@ -223,6 +224,7 @@ config_data! { /// with `self` prefixed to them when inside a method. completion_autoself_enable: bool = "true", /// Whether to add parenthesis and argument snippets when completing function. + /// Possible values are: `"fill_arguments"`, `"add_parentheses"`, `"none"`. completion_callable_snippets: CallableCompletionDef = "\"fill_arguments\"", /// Whether to show full function/method signatures in completion docs. completion_fullFunctionSignatures_enable: bool = "false", @@ -301,6 +303,7 @@ config_data! { /// also need to add the folders to Code's `files.watcherExclude`. files_excludeDirs: Vec = "[]", /// Controls file watching implementation. + /// Possible values are: `"client"`, `"notify"`, `"server"`. files_watcher: FilesWatcherDef = "\"client\"", /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords. @@ -340,19 +343,23 @@ config_data! { /// Use markdown syntax for links on hover. hover_links_enable: bool = "true", /// How to render the align information in a memory layout hover. + /// Possible values are: `"hexadecimal"`, `"decimal"`, `"both"`. hover_memoryLayout_alignment: Option = "\"hexadecimal\"", /// Whether to show memory layout data on hover. hover_memoryLayout_enable: bool = "true", /// How to render the niche information in a memory layout hover. hover_memoryLayout_niches: Option = "false", /// How to render the offset information in a memory layout hover. + /// Possible values are: `"hexadecimal"`, `"decimal"`, `"both"`. hover_memoryLayout_offset: Option = "\"hexadecimal\"", /// How to render the size information in a memory layout hover. + /// Possible values are: `"hexadecimal"`, `"decimal"`, `"both"`. hover_memoryLayout_size: Option = "\"both\"", /// Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file. imports_granularity_enforce: bool = "false", /// How imports should be grouped into use statements. + /// Possible values are: `"preserve"`, `"item"`, `"crate"`, `"module"`. imports_granularity_group: ImportGranularityDef = "\"crate\"", /// Group inserted imports by the https://rust-analyzer.github.io/manual.html#auto-import[following order]. Groups are separated by newlines. imports_group_enable: bool = "true", @@ -363,6 +370,7 @@ config_data! { /// Whether to prefer import paths containing a `prelude` module. imports_preferPrelude: bool = "false", /// The path structure for newly inserted paths to use. + /// Possible values are: `"plain"`, `"by_self"`, `"by_crate"`. imports_prefix: ImportPrefixDef = "\"plain\"", /// Whether to show inlay type hints for binding modes. @@ -377,20 +385,26 @@ config_data! { /// Whether to show inlay hints for closure captures. inlayHints_closureCaptureHints_enable: bool = "false", /// Whether to show inlay type hints for return types of closures. + /// Possible values are: `"always"`, `"never"`, `"with_block"`. inlayHints_closureReturnTypeHints_enable: ClosureReturnTypeHintsDef = "\"never\"", /// Closure notation in type and chaining inlay hints. + /// Possible values are: `"impl_fn"`, `"rust_analyzer"`, `"with_id"`, `"hide"`. inlayHints_closureStyle: ClosureStyle = "\"impl_fn\"", /// Whether to show enum variant discriminant hints. + /// Possible values are: `"always"`, `"never"`, `"fieldless"`. inlayHints_discriminantHints_enable: DiscriminantHintsDef = "\"never\"", /// Whether to show inlay hints for type adjustments. + /// Possible values are: `"always"`, `"never"`, `"reborrow"`. inlayHints_expressionAdjustmentHints_enable: AdjustmentHintsDef = "\"never\"", /// Whether to hide inlay hints for type adjustments outside of `unsafe` blocks. inlayHints_expressionAdjustmentHints_hideOutsideUnsafe: bool = "false", /// Whether to show inlay hints as postfix ops (`.*` instead of `*`, etc). + /// Possible values are: `"prefix"`, `"postfix"`, `"prefer_prefix"`, `"prefer_postfix"`. inlayHints_expressionAdjustmentHints_mode: AdjustmentHintsModeDef = "\"prefix\"", /// Whether to show implicit drop hints. inlayHints_implicitDrops_enable: bool = "false", /// Whether to show inlay type hints for elided lifetimes in function signatures. + /// Possible values are: `"always"`, `"never"`, `"skip_trivial"`. inlayHints_lifetimeElisionHints_enable: LifetimeElisionDef = "\"never\"", /// Whether to prefer using parameter names as the name for elided lifetime hints if possible. inlayHints_lifetimeElisionHints_useParameterNames: bool = "false", @@ -438,6 +452,7 @@ config_data! { /// `#rust-analyzer.lens.enable#` is set. lens_implementations_enable: bool = "true", /// Where to render annotations. + /// Possible values are: `"above_name"`, `"above_whole_item"`. lens_location: AnnotationLocation = "\"above_name\"", /// Whether to show `References` lens for Struct, Enum, and Union. /// Only applies when `#rust-analyzer.lens.enable#` is set. @@ -562,6 +577,7 @@ config_data! { semanticHighlighting_strings_enable: bool = "true", /// Show full signature of the callable. Only shows parameters if disabled. + /// Possible values are: `"full"`, `"parameters"`. signatureInfo_detail: SignatureDetail = "\"full\"", /// Show documentation. signatureInfo_documentation_enable: bool = "true", @@ -570,12 +586,14 @@ config_data! { typing_autoClosingAngleBrackets_enable: bool = "false", /// Workspace symbol search kind. + /// Possible values are: `"only_types"`, `"all_symbols"`. workspace_symbol_search_kind: WorkspaceSymbolSearchKindDef = "\"only_types\"", /// Limits the number of items returned from a workspace symbol search (Defaults to 128). /// Some clients like vs-code issue new searches on result filtering and don't require all results to be returned in the initial search. /// Other clients requires all results upfront and might require a higher limit. workspace_symbol_search_limit: usize = "128", /// Workspace symbol search scope. + /// Possible values are: `"workspace"`, `"workspace_and_dependencies"`. workspace_symbol_search_scope: WorkspaceSymbolSearchScopeDef = "\"workspace\"", } } diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index ecc90abff135..2206ff692a67 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc @@ -153,6 +153,7 @@ Check all targets and tests (`--all-targets`). + -- Cargo command to use for `cargo check`. +Common alternative is `"clippy"`. -- [[rust-analyzer.check.extraArgs]]rust-analyzer.check.extraArgs (default: `[]`):: + @@ -257,6 +258,7 @@ with `self` prefixed to them when inside a method. + -- Whether to add parenthesis and argument snippets when completing function. +Possible values are: `"fill_arguments"`, `"add_parentheses"`, `"none"`. -- [[rust-analyzer.completion.fullFunctionSignatures.enable]]rust-analyzer.completion.fullFunctionSignatures.enable (default: `false`):: + @@ -377,6 +379,7 @@ also need to add the folders to Code's `files.watcherExclude`. + -- Controls file watching implementation. +Possible values are: `"client"`, `"notify"`, `"server"`. -- [[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`):: + @@ -458,6 +461,7 @@ Use markdown syntax for links on hover. + -- How to render the align information in a memory layout hover. +Possible values are: `"hexadecimal"`, `"decimal"`, `"both"`. -- [[rust-analyzer.hover.memoryLayout.enable]]rust-analyzer.hover.memoryLayout.enable (default: `true`):: + @@ -473,11 +477,13 @@ How to render the niche information in a memory layout hover. + -- How to render the offset information in a memory layout hover. +Possible values are: `"hexadecimal"`, `"decimal"`, `"both"`. -- [[rust-analyzer.hover.memoryLayout.size]]rust-analyzer.hover.memoryLayout.size (default: `"both"`):: + -- How to render the size information in a memory layout hover. +Possible values are: `"hexadecimal"`, `"decimal"`, `"both"`. -- [[rust-analyzer.imports.granularity.enforce]]rust-analyzer.imports.granularity.enforce (default: `false`):: + @@ -488,6 +494,7 @@ Whether to enforce the import granularity setting for all files. If set to false + -- How imports should be grouped into use statements. +Possible values are: `"preserve"`, `"item"`, `"crate"`, `"module"`. -- [[rust-analyzer.imports.group.enable]]rust-analyzer.imports.group.enable (default: `true`):: + @@ -513,6 +520,7 @@ Whether to prefer import paths containing a `prelude` module. + -- The path structure for newly inserted paths to use. +Possible values are: `"plain"`, `"by_self"`, `"by_crate"`. -- [[rust-analyzer.inlayHints.bindingModeHints.enable]]rust-analyzer.inlayHints.bindingModeHints.enable (default: `false`):: + @@ -544,21 +552,25 @@ Whether to show inlay hints for closure captures. + -- Whether to show inlay type hints for return types of closures. +Possible values are: `"always"`, `"never"`, `"with_block"`. -- [[rust-analyzer.inlayHints.closureStyle]]rust-analyzer.inlayHints.closureStyle (default: `"impl_fn"`):: + -- Closure notation in type and chaining inlay hints. +Possible values are: `"impl_fn"`, `"rust_analyzer"`, `"with_id"`, `"hide"`. -- [[rust-analyzer.inlayHints.discriminantHints.enable]]rust-analyzer.inlayHints.discriminantHints.enable (default: `"never"`):: + -- Whether to show enum variant discriminant hints. +Possible values are: `"always"`, `"never"`, `"fieldless"`. -- [[rust-analyzer.inlayHints.expressionAdjustmentHints.enable]]rust-analyzer.inlayHints.expressionAdjustmentHints.enable (default: `"never"`):: + -- Whether to show inlay hints for type adjustments. +Possible values are: `"always"`, `"never"`, `"reborrow"`. -- [[rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe]]rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe (default: `false`):: + @@ -569,6 +581,7 @@ Whether to hide inlay hints for type adjustments outside of `unsafe` blocks. + -- Whether to show inlay hints as postfix ops (`.*` instead of `*`, etc). +Possible values are: `"prefix"`, `"postfix"`, `"prefer_prefix"`, `"prefer_postfix"`. -- [[rust-analyzer.inlayHints.implicitDrops.enable]]rust-analyzer.inlayHints.implicitDrops.enable (default: `false`):: + @@ -579,6 +592,7 @@ Whether to show implicit drop hints. + -- Whether to show inlay type hints for elided lifetimes in function signatures. +Possible values are: `"always"`, `"never"`, `"skip_trivial"`. -- [[rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames]]rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames (default: `false`):: + @@ -680,6 +694,7 @@ Whether to show `Implementations` lens. Only applies when + -- Where to render annotations. +Possible values are: `"above_name"`, `"above_whole_item"`. -- [[rust-analyzer.lens.references.adt.enable]]rust-analyzer.lens.references.adt.enable (default: `false`):: + @@ -885,6 +900,7 @@ their contents. + -- Show full signature of the callable. Only shows parameters if disabled. +Possible values are: `"full"`, `"parameters"`. -- [[rust-analyzer.signatureInfo.documentation.enable]]rust-analyzer.signatureInfo.documentation.enable (default: `true`):: + @@ -900,6 +916,7 @@ Whether to insert closing angle brackets when typing an opening angle bracket of + -- Workspace symbol search kind. +Possible values are: `"only_types"`, `"all_symbols"`. -- [[rust-analyzer.workspace.symbol.search.limit]]rust-analyzer.workspace.symbol.search.limit (default: `128`):: + @@ -912,4 +929,5 @@ Other clients requires all results upfront and might require a higher limit. + -- Workspace symbol search scope. +Possible values are: `"workspace"`, `"workspace_and_dependencies"`. -- diff --git a/editors/code/package.json b/editors/code/package.json index 8307f6833e6f..fa42aad5afca 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -685,7 +685,7 @@ "type": "boolean" }, "rust-analyzer.check.command": { - "markdownDescription": "Cargo command to use for `cargo check`.", + "markdownDescription": "Cargo command to use for `cargo check`.\nCommon alternative is `\"clippy\"`.", "default": "check", "type": "string" }, @@ -809,7 +809,7 @@ "type": "boolean" }, "rust-analyzer.completion.callable.snippets": { - "markdownDescription": "Whether to add parenthesis and argument snippets when completing function.", + "markdownDescription": "Whether to add parenthesis and argument snippets when completing function.\nPossible values are: `\"fill_arguments\"`, `\"add_parentheses\"`, `\"none\"`.", "default": "fill_arguments", "type": "string", "enum": [ @@ -941,7 +941,7 @@ } }, "rust-analyzer.files.watcher": { - "markdownDescription": "Controls file watching implementation.", + "markdownDescription": "Controls file watching implementation.\nPossible values are: `\"client\"`, `\"notify\"`, `\"server\"`.", "default": "client", "type": "string", "enum": [ @@ -1024,7 +1024,7 @@ "type": "boolean" }, "rust-analyzer.hover.memoryLayout.alignment": { - "markdownDescription": "How to render the align information in a memory layout hover.", + "markdownDescription": "How to render the align information in a memory layout hover.\nPossible values are: `\"hexadecimal\"`, `\"decimal\"`, `\"both\"`.", "default": "hexadecimal", "anyOf": [ { @@ -1059,7 +1059,7 @@ ] }, "rust-analyzer.hover.memoryLayout.offset": { - "markdownDescription": "How to render the offset information in a memory layout hover.", + "markdownDescription": "How to render the offset information in a memory layout hover.\nPossible values are: `\"hexadecimal\"`, `\"decimal\"`, `\"both\"`.", "default": "hexadecimal", "anyOf": [ { @@ -1081,7 +1081,7 @@ ] }, "rust-analyzer.hover.memoryLayout.size": { - "markdownDescription": "How to render the size information in a memory layout hover.", + "markdownDescription": "How to render the size information in a memory layout hover.\nPossible values are: `\"hexadecimal\"`, `\"decimal\"`, `\"both\"`.", "default": "both", "anyOf": [ { @@ -1108,7 +1108,7 @@ "type": "boolean" }, "rust-analyzer.imports.granularity.group": { - "markdownDescription": "How imports should be grouped into use statements.", + "markdownDescription": "How imports should be grouped into use statements.\nPossible values are: `\"preserve\"`, `\"item\"`, `\"crate\"`, `\"module\"`.", "default": "crate", "type": "string", "enum": [ @@ -1145,7 +1145,7 @@ "type": "boolean" }, "rust-analyzer.imports.prefix": { - "markdownDescription": "The path structure for newly inserted paths to use.", + "markdownDescription": "The path structure for newly inserted paths to use.\nPossible values are: `\"plain\"`, `\"by_self\"`, `\"by_crate\"`.", "default": "plain", "type": "string", "enum": [ @@ -1186,7 +1186,7 @@ "type": "boolean" }, "rust-analyzer.inlayHints.closureReturnTypeHints.enable": { - "markdownDescription": "Whether to show inlay type hints for return types of closures.", + "markdownDescription": "Whether to show inlay type hints for return types of closures.\nPossible values are: `\"always\"`, `\"never\"`, `\"with_block\"`.", "default": "never", "type": "string", "enum": [ @@ -1201,7 +1201,7 @@ ] }, "rust-analyzer.inlayHints.closureStyle": { - "markdownDescription": "Closure notation in type and chaining inlay hints.", + "markdownDescription": "Closure notation in type and chaining inlay hints.\nPossible values are: `\"impl_fn\"`, `\"rust_analyzer\"`, `\"with_id\"`, `\"hide\"`.", "default": "impl_fn", "type": "string", "enum": [ @@ -1218,7 +1218,7 @@ ] }, "rust-analyzer.inlayHints.discriminantHints.enable": { - "markdownDescription": "Whether to show enum variant discriminant hints.", + "markdownDescription": "Whether to show enum variant discriminant hints.\nPossible values are: `\"always\"`, `\"never\"`, `\"fieldless\"`.", "default": "never", "type": "string", "enum": [ @@ -1233,7 +1233,7 @@ ] }, "rust-analyzer.inlayHints.expressionAdjustmentHints.enable": { - "markdownDescription": "Whether to show inlay hints for type adjustments.", + "markdownDescription": "Whether to show inlay hints for type adjustments.\nPossible values are: `\"always\"`, `\"never\"`, `\"reborrow\"`.", "default": "never", "type": "string", "enum": [ @@ -1253,7 +1253,7 @@ "type": "boolean" }, "rust-analyzer.inlayHints.expressionAdjustmentHints.mode": { - "markdownDescription": "Whether to show inlay hints as postfix ops (`.*` instead of `*`, etc).", + "markdownDescription": "Whether to show inlay hints as postfix ops (`.*` instead of `*`, etc).\nPossible values are: `\"prefix\"`, `\"postfix\"`, `\"prefer_prefix\"`, `\"prefer_postfix\"`.", "default": "prefix", "type": "string", "enum": [ @@ -1275,7 +1275,7 @@ "type": "boolean" }, "rust-analyzer.inlayHints.lifetimeElisionHints.enable": { - "markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.", + "markdownDescription": "Whether to show inlay type hints for elided lifetimes in function signatures.\nPossible values are: `\"always\"`, `\"never\"`, `\"skip_trivial\"`.", "default": "never", "type": "string", "enum": [ @@ -1394,7 +1394,7 @@ "type": "boolean" }, "rust-analyzer.lens.location": { - "markdownDescription": "Where to render annotations.", + "markdownDescription": "Where to render annotations.\nPossible values are: `\"above_name\"`, `\"above_whole_item\"`.", "default": "above_name", "type": "string", "enum": [ @@ -1602,7 +1602,7 @@ "type": "boolean" }, "rust-analyzer.signatureInfo.detail": { - "markdownDescription": "Show full signature of the callable. Only shows parameters if disabled.", + "markdownDescription": "Show full signature of the callable. Only shows parameters if disabled.\nPossible values are: `\"full\"`, `\"parameters\"`.", "default": "full", "type": "string", "enum": [ @@ -1625,7 +1625,7 @@ "type": "boolean" }, "rust-analyzer.workspace.symbol.search.kind": { - "markdownDescription": "Workspace symbol search kind.", + "markdownDescription": "Workspace symbol search kind.\nPossible values are: `\"only_types\"`, `\"all_symbols\"`.", "default": "only_types", "type": "string", "enum": [ @@ -1644,7 +1644,7 @@ "minimum": 0 }, "rust-analyzer.workspace.symbol.search.scope": { - "markdownDescription": "Workspace symbol search scope.", + "markdownDescription": "Workspace symbol search scope.\nPossible values are: `\"workspace\"`, `\"workspace_and_dependencies\"`.", "default": "workspace", "type": "string", "enum": [