From 93f7f43854e0b8c86d79ed2fb1eb37c3674e4667 Mon Sep 17 00:00:00 2001 From: "Vasquez Alfaro, Juan J" Date: Fri, 18 Jul 2025 13:40:57 -0600 Subject: [PATCH 1/4] Increment for One Indexed reporting of warnings in DFA CLI output --- src/dfa/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dfa/client.rs b/src/dfa/client.rs index c3663ab..eaef13d 100644 --- a/src/dfa/client.rs +++ b/src/dfa/client.rs @@ -39,7 +39,7 @@ pub struct Diagnostic { impl From for Diagnostic { fn from(diag: lsp_types::Diagnostic) -> Diagnostic { Diagnostic { - line: diag.range.start.line, + line: diag.range.start.line + 1, desc: diag.message, } } From dc96f4058ea449b5e839a6e26426ec2d4c67c55f Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 4 Sep 2025 13:37:31 -0600 Subject: [PATCH 2/4] Add zero-indexed config to dfa --- src/dfa/client.rs | 14 ++++++++------ src/dfa/main.rs | 11 ++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/dfa/client.rs b/src/dfa/client.rs index eaef13d..7c0778d 100644 --- a/src/dfa/client.rs +++ b/src/dfa/client.rs @@ -39,7 +39,7 @@ pub struct Diagnostic { impl From for Diagnostic { fn from(diag: lsp_types::Diagnostic) -> Diagnostic { Diagnostic { - line: diag.range.start.line + 1, + line: diag.range.start.line, desc: diag.message, } } @@ -385,13 +385,15 @@ impl ClientInterface { }{} } - pub fn output_errors(&self) { + pub fn output_errors(&self, zero_indexed: bool) { for (path, diagnostics) in &self.diagnostics { for diag in diagnostics { - println!("{} line {}: {}", - path.to_str().unwrap(), - diag.line, - diag.desc); + println!( + "{} line {}: {}", + path.to_str().unwrap(), + diag.line + if zero_indexed { 0 } else { 1 }, + diag.desc + ); } } } diff --git a/src/dfa/main.rs b/src/dfa/main.rs index 9252aec..0096bac 100644 --- a/src/dfa/main.rs +++ b/src/dfa/main.rs @@ -34,6 +34,7 @@ struct Args { workspaces: Vec, compile_info: Option, suppress_imports: Option, + zero_indexed: Option, linting_enabled: Option, lint_cfg_path: Option, test: bool, @@ -78,6 +79,11 @@ fn parse_args() -> Args { .action(ArgAction::Set) .value_parser(clap::value_parser!(bool)) .required(false)) + .arg(Arg::new("zero-indexed").short('z').long("zero-indexed") + .help("Diagnostics reported by the server will be zero-indexed (defaults to false)") + .action(ArgAction::Set) + .value_parser(clap::value_parser!(bool)) + .required(false)) .arg(Arg::new("linting-enabled").short('l').long("linting-enabled") .help("Turns linting on/off (defaults to true)") .action(ArgAction::Set) @@ -106,6 +112,8 @@ fn parse_args() -> Args { .cloned(), suppress_imports: args.get_one::("suppress-imports") .cloned(), + zero_indexed: args.get_one::("zero-indexed") + .cloned(), linting_enabled: args.get_one::("linting-enabled") .cloned(), lint_cfg_path: args.get_one::("lint-cfg-path") @@ -126,6 +134,7 @@ fn main_inner() -> Result<(), i32> { let first_workspace = workspace_rest.next(); let linting_enabled = arg.linting_enabled.unwrap_or(true); + let zero_indexed = arg.zero_indexed.unwrap_or(false); let root = match first_workspace { Some(w) => w, @@ -167,7 +176,7 @@ fn main_inner() -> Result<(), i32> { })?; if !arg.quiet { - dlsclient.output_errors(); + dlsclient.output_errors(zero_indexed); } if arg.test && !dlsclient.no_errors() { exit_code = Err(1); From ee42ff9cfb5123f15e58c645813330048a374bca Mon Sep 17 00:00:00 2001 From: Juan Vasquez Date: Thu, 25 Sep 2025 11:29:24 -0700 Subject: [PATCH 3/4] Add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a762d41..0d00724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ - Fixed issue where statements under top-level in-eachs were not correctly tracked. - Moved storage of reference->symbol mapping to on-demand timing, should significantly speed up device analysises +- CLI tool DFA now uses default one-indexed line count for reporting warnings on analyzed files. +`--zero-indexed` flag can be set to `true` when executing DFA for using zero-indexed counting if required. ## 0.9.12 - Added 'simics\_util\_vect' as a known provisional (with no DLS semantics) From 3db2c404813db4a9f03bf87b5de17f496c83fb33 Mon Sep 17 00:00:00 2001 From: Juan Vasquez Date: Fri, 26 Sep 2025 12:35:14 -0700 Subject: [PATCH 4/4] Address review change request --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d00724..cf70f08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ - Moved storage of reference->symbol mapping to on-demand timing, should significantly speed up device analysises - CLI tool DFA now uses default one-indexed line count for reporting warnings on analyzed files. -`--zero-indexed` flag can be set to `true` when executing DFA for using zero-indexed counting if required. + `--zero-indexed` flag can be set to `true` when executing DFA for using zero-indexed counting if required. ## 0.9.12 - Added 'simics\_util\_vect' as a known provisional (with no DLS semantics)