diff --git a/CHANGELOG.md b/CHANGELOG.md index fe6cb04b822..20b8719573b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ #### Other changes - `rome lsp-proxy` should accept the global CLI options [#4505](https://github.com/rome/tools/issues/4505) +- Enhance help descriptions ### Configuration diff --git a/Cargo.lock b/Cargo.lock index 6b8bd3c2f79..5edd5e2a90a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,18 +152,18 @@ checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" [[package]] name = "bpaf" -version = "0.7.10" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "423bafba382cc2c561f486bfcae41c6692833eaff0a631d10c37a9489ccd3783" +checksum = "7ae5e130595d17ed4f7061317c2792ba94dc7754de93012c6d4c7191eb5d6c4b" dependencies = [ "bpaf_derive", ] [[package]] name = "bpaf_derive" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9ee23ce08bc40839a8153f4b873fcfa08405221ed2cd9a4968d1a94ad83234" +checksum = "29a7fca07923e14266ed2107f9fa592a6d4895afe2e10242ffeeda56f6009314" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 3669c13c71a..955fce05927 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ tokio = { version = "~1.18.5" } insta = "1.21.2" quote = { version = "1.0.21" } lazy_static = "1.4.0" -bpaf = { version = "0.7.10", features = ["derive"] } +bpaf = { version = "0.8.0", features = ["derive"] } bitflags = "2.2.1" diff --git a/crates/rome_cli/src/cli_options.rs b/crates/rome_cli/src/cli_options.rs index 1635609416a..5bc02348768 100644 --- a/crates/rome_cli/src/cli_options.rs +++ b/crates/rome_cli/src/cli_options.rs @@ -1,6 +1,7 @@ use bpaf::Bpaf; use std::str::FromStr; +/// Global options applied to all commands #[derive(Debug, Clone, Bpaf)] pub struct CliOptions { /// Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap b/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap index 4c3c09cc9a0..fe477cd16f5 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap @@ -7,7 +7,7 @@ expression: content ```block Run various checks on a set of files. -Usage: [--apply] [--apply-unsafe] ... +Usage: [--apply] [--apply-unsafe] []... Available positional items: Single file, single path or list of paths @@ -18,6 +18,8 @@ Available options: --formatter-enabled Allow to enable or disable the formatter check. --linter-enabled Allow to enable or disable the linter check. --organize-imports-enabled Allow to enable or disable the organize imports. + The configuration that is contained inside the file `rome.json` + Set of properties to integrate Rome with a VCS software. --vcs-client-kind The kind of client. --vcs-enabled Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file Whether Rome should use the VCS ignore file. When [true], @@ -27,11 +29,16 @@ Available options: configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted + + The configuration of the filesystem --files-max-size The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB + + Options applied to the formatter --indent-style The indent style. --indent-size The size of the indentation, 2 by default --line-width What's the max width of a line. Defaults to 80. + --quote-style The style for quotes. Defaults to double. --quote-properties When properties in objects are quoted. Defaults to asNeeded. @@ -39,6 +46,8 @@ Available options: comma-separated syntactic structures. Defaults to "all". --semicolons Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + + Global options applied to all commands --colors Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible @@ -50,6 +59,7 @@ Available options: --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --json Reports information using the JSON format + --stdin-file-path A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome check --stdin-file-path=file.js" -h, --help Prints help information diff --git a/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap b/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap index 4e37c793361..679fc61c78f 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap @@ -8,7 +8,7 @@ expression: content Command to use in CI environments. Run various checks of a set of files. Usage: [--formatter-enabled true|false] [--linter-enabled true|false] [--organize-imports-enabled -true|false] ... +true|false] []... Available positional items: Single file, single path or list of paths @@ -17,6 +17,8 @@ Available options: --formatter-enabled Allow to enable or disable the formatter check. --linter-enabled Allow to enable or disable the linter check. --organize-imports-enabled Allow to enable or disable the organize imports. + The configuration that is contained inside the file `rome.json` + Set of properties to integrate Rome with a VCS software. --vcs-client-kind The kind of client. --vcs-enabled Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file Whether Rome should use the VCS ignore file. When [true], @@ -26,11 +28,16 @@ Available options: configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted + + The configuration of the filesystem --files-max-size The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB + + Options applied to the formatter --indent-style The indent style. --indent-size The size of the indentation, 2 by default --line-width What's the max width of a line. Defaults to 80. + --quote-style The style for quotes. Defaults to double. --quote-properties When properties in objects are quoted. Defaults to asNeeded. @@ -38,6 +45,8 @@ Available options: comma-separated syntactic structures. Defaults to "all". --semicolons Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + + Global options applied to all commands --colors Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible @@ -49,6 +58,7 @@ Available options: --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --json Reports information using the JSON format + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap b/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap index 6aa2ade2696..6d9f8df111a 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap @@ -7,15 +7,17 @@ expression: content ```block Run the formatter on a set of files. -Usage: [--write] ... +Usage: [--write] []... Available positional items: Single file, single path or list of paths Available options: + Options applied to the formatter --indent-style The indent style. --indent-size The size of the indentation, 2 by default --line-width What's the max width of a line. Defaults to 80. + --quote-style The style for quotes. Defaults to double. --quote-properties When properties in objects are quoted. Defaults to asNeeded. @@ -23,6 +25,7 @@ Available options: comma-separated syntactic structures. Defaults to "all". --semicolons Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + Set of properties to integrate Rome with a VCS software. --vcs-client-kind The kind of client. --vcs-enabled Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file Whether Rome should use the VCS ignore file. When [true], @@ -32,10 +35,14 @@ Available options: configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted + + The configuration of the filesystem --files-max-size The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB + --stdin-file-path A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome format --stdin-file-path=file.js" + Global options applied to all commands --colors Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible @@ -47,6 +54,7 @@ Available options: --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --json Reports information using the JSON format + --write -h, --help Prints help information diff --git a/crates/rome_cli/tests/snapshots/main_commands_init/init_help.snap b/crates/rome_cli/tests/snapshots/main_commands_init/init_help.snap index afb329cefd9..53d4bd4b423 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_init/init_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_init/init_help.snap @@ -7,6 +7,7 @@ expression: content ```block Bootstraps a new rome project. Creates a configuration file with some defaults. +Usage: no parameters expected Available options: -h, --help Prints help information diff --git a/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap b/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap index 9c97de71891..5301d7bd8a9 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap @@ -7,10 +7,11 @@ expression: content ```block Acts as a server for the Language Server Protocol over stdin/stdout -Usage: [--colors off|force] [[--use-server]] [[--verbose]] [--config-path PATH] [--max-diagnostics +Usage: [--colors off|force] [--use-server] [--verbose] [--config-path PATH] [--max-diagnostics NUMBER] [--skip-errors] Available options: + Global options applied to all commands --colors Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible @@ -22,6 +23,7 @@ Available options: --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --json Reports information using the JSON format + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap b/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap index 2e6c2190344..21f74f270f6 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap @@ -10,6 +10,7 @@ It updates the configuration when there are breaking changes Usage: [--write] Available options: + Global options applied to all commands --colors Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible @@ -21,6 +22,7 @@ Available options: --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --json Reports information using the JSON format + --write Writes the new configuration file to disk -h, --help Prints help information diff --git a/crates/rome_service/src/configuration/formatter.rs b/crates/rome_service/src/configuration/formatter.rs index c1cacedef27..8a000d063db 100644 --- a/crates/rome_service/src/configuration/formatter.rs +++ b/crates/rome_service/src/configuration/formatter.rs @@ -7,6 +7,7 @@ use rome_formatter::{IndentStyle, LineWidth}; use serde::{Deserialize, Serialize}; use std::str::FromStr; +/// Options applied to the formatter #[derive(Deserialize, Serialize, Debug, Eq, PartialEq, Clone, Bpaf)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] diff --git a/crates/rome_service/src/configuration/mod.rs b/crates/rome_service/src/configuration/mod.rs index f6e08ba828a..1b85c0e475e 100644 --- a/crates/rome_service/src/configuration/mod.rs +++ b/crates/rome_service/src/configuration/mod.rs @@ -51,7 +51,7 @@ pub struct Configuration { #[bpaf(hide)] pub schema: Option, - /// The configuration of the filesystem + /// The configuration of the VCS integration #[serde(skip_serializing_if = "Option::is_none")] #[bpaf(external(vcs_configuration), optional, hide_usage)] pub vcs: Option, diff --git a/editors/vscode/configuration_schema.json b/editors/vscode/configuration_schema.json index a38e16a1ccd..f2f85cfb21a 100644 --- a/editors/vscode/configuration_schema.json +++ b/editors/vscode/configuration_schema.json @@ -41,7 +41,7 @@ "anyOf": [{ "$ref": "#/definitions/OrganizeImports" }, { "type": "null" }] }, "vcs": { - "description": "The configuration of the filesystem", + "description": "The configuration of the VCS integration", "anyOf": [ { "$ref": "#/definitions/VcsConfiguration" }, { "type": "null" } @@ -531,6 +531,7 @@ "additionalProperties": false }, "FormatterConfiguration": { + "description": "Options applied to the formatter", "type": "object", "properties": { "enabled": { "default": true, "type": ["boolean", "null"] }, diff --git a/npm/backend-jsonrpc/src/workspace.ts b/npm/backend-jsonrpc/src/workspace.ts index 00fdb640d8b..1bab966b30e 100644 --- a/npm/backend-jsonrpc/src/workspace.ts +++ b/npm/backend-jsonrpc/src/workspace.ts @@ -48,7 +48,7 @@ export interface Configuration { */ organizeImports?: OrganizeImports; /** - * The configuration of the filesystem + * The configuration of the VCS integration */ vcs?: VcsConfiguration; } @@ -65,6 +65,9 @@ export interface FilesConfiguration { */ maxSize?: number; } +/** + * Options applied to the formatter + */ export interface FormatterConfiguration { enabled?: boolean; /** diff --git a/npm/rome/configuration_schema.json b/npm/rome/configuration_schema.json index a38e16a1ccd..f2f85cfb21a 100644 --- a/npm/rome/configuration_schema.json +++ b/npm/rome/configuration_schema.json @@ -41,7 +41,7 @@ "anyOf": [{ "$ref": "#/definitions/OrganizeImports" }, { "type": "null" }] }, "vcs": { - "description": "The configuration of the filesystem", + "description": "The configuration of the VCS integration", "anyOf": [ { "$ref": "#/definitions/VcsConfiguration" }, { "type": "null" } @@ -531,6 +531,7 @@ "additionalProperties": false }, "FormatterConfiguration": { + "description": "Options applied to the formatter", "type": "object", "properties": { "enabled": { "default": true, "type": ["boolean", "null"] },