Skip to content

Commit b01a09f

Browse files
alanzmeta-codesync[bot]
authored andcommitted
elp ssr: set info priority when --dump-config is set
Summary: As title. It does not make sense to have at least info severity in the IDE, otherwise the squiggles do not show up. Reviewed By: jcpetruzza Differential Revision: D86774246 fbshipit-source-id: 0db22ecf1b90c7e7a2d2037c0c45cc8619928c44
1 parent 49fb231 commit b01a09f

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

crates/elp/src/bin/args.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,6 @@ pub struct Ssr {
372372
)]
373373
pub format: Option<String>,
374374

375-
/// Report severity as Info instead of WeakWarning
376-
#[bpaf(long("info"))]
377-
pub info_severity: bool,
378-
379375
/// Macro expansion strategy: expand | no-expand | visible-expand (default expand)
380376
#[bpaf(
381377
long("macros"),

crates/elp/src/bin/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,18 @@ mod tests {
21172117
#[test]
21182118
fn lint_ssr_as_cli_dump_config() {
21192119
simple_snapshot(
2120-
args_vec!["ssr", "--dump-config", "--info", "?BAR(_@AA)", "{4}"],
2120+
args_vec!["ssr", "--dump-config", "?BAR(_@AA)", "{4}"],
2121+
"linter",
2122+
expect_file!("../resources/test/linter/ssr_ad_hoc_cli_dump_config.stdout"),
2123+
true,
2124+
None,
2125+
)
2126+
}
2127+
2128+
#[test]
2129+
fn lint_ssr_as_cli_dump_config_without_info() {
2130+
simple_snapshot(
2131+
args_vec!["ssr", "--dump-config", "?BAR(_@AA)", "{4}"],
21212132
"linter",
21222133
expect_file!("../resources/test/linter/ssr_ad_hoc_cli_dump_config.stdout"),
21232134
true,

crates/elp/src/bin/ssr_cli.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ pub fn run_ssr_command(
8686
let mut lint_config = LintConfig::default();
8787
for pattern in &args.ssr_specs {
8888
let normalized_pattern = normalize_ssr_pattern(pattern);
89-
let severity = if args.info_severity {
89+
let severity = if args.dump_config {
90+
// Set the severity so that squiggles are shown in the VS Code UI
9091
Some(diagnostics::Severity::Information)
9192
} else {
9293
None

crates/elp/src/resources/test/ssr_help.stdout

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Usage: [--project PROJECT] [--module MODULE] [--app APP] [--file FILE] [--rebar] [--as PROFILE] [--include-generated] [--include-tests] [[--format FORMAT]] [--info] [[--macros STRATEGY]] [--parens] [--dump-config] [--report-system-stats] <SSR_SPECS>...
1+
Usage: [--project PROJECT] [--module MODULE] [--app APP] [--file FILE] [--rebar] [--as PROFILE] [--include-generated] [--include-tests] [[--format FORMAT]] [[--macros STRATEGY]] [--parens] [--dump-config] [--report-system-stats] <SSR_SPECS>...
22

33
Available positional items:
44
<SSR_SPECS> SSR specs to use
@@ -13,7 +13,6 @@ Available options:
1313
--include-generated Also generate diagnostics for generated files
1414
--include-tests Also generate diagnostics for test files
1515
--format <FORMAT> Show diagnostics in JSON format
16-
--info Report severity as Info instead of WeakWarning
1716
--macros <STRATEGY> Macro expansion strategy: expand | no-expand | visible-expand (default expand)
1817
--parens Explicitly match parentheses. If omitted, they are ignored.
1918
--dump-config Dump a configuration snippet that can be put in .elp_lint.toml to match the given SSR patterns

0 commit comments

Comments
 (0)