Skip to content

Commit 9cb8a08

Browse files
jkeuhlen9999years
authored andcommitted
[DUX-1511] Add the ability to track warnings through re-compilation
Closes #148
1 parent 60c762a commit 9cb8a08

8 files changed

Lines changed: 1501 additions & 8 deletions

File tree

docs/cli.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ Don't interrupt reloads when files change.
8989

9090
Depending on your workflow, `ghciwatch` may feel more responsive with this set.
9191

92+
</dd>
93+
<dt><a id="--track-warnings" href="#--track-warnings"><code>--track-warnings</code></a></dt><dd>
94+
95+
Track warnings across recompilations.
96+
97+
When enabled, warnings will be preserved in memory even when files are recompiled due to dependency changes, helping prevent "ephemeral warnings" from being missed.
98+
9299
</dd>
93100
<dt><a id="--completions" href="#--completions"><code>--completions &lt;COMPLETIONS&gt;</code></a></dt><dd>
94101

src/cli.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ pub struct Opts {
8383
#[arg(long, hide = true)]
8484
pub tui: bool,
8585

86+
/// Track warnings across recompilations.
87+
///
88+
/// When enabled, warnings will be preserved in memory even when files are recompiled
89+
/// due to dependency changes, helping prevent "ephemeral warnings" from being missed.
90+
#[arg(long, env = "GHCIWATCH_TRACK_WARNINGS")]
91+
pub track_warnings: bool,
92+
8693
/// Generate Markdown CLI documentation.
8794
#[cfg(feature = "clap-markdown")]
8895
#[arg(long, hide = true)]

src/ghci/compilation_log.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use camino::Utf8Path;
22

33
use crate::ghci::parse::CompilationResult;
44
use crate::ghci::parse::CompilationSummary;
5+
use crate::ghci::parse::CompilingModule;
56
use crate::ghci::parse::GhcDiagnostic;
67
use crate::ghci::parse::GhcMessage;
78
use crate::ghci::parse::Severity;
@@ -13,6 +14,7 @@ use super::parse::ModulesLoaded;
1314
pub struct CompilationLog {
1415
pub summary: Option<CompilationSummary>,
1516
pub diagnostics: Vec<GhcDiagnostic>,
17+
pub compiled_modules: Vec<CompilingModule>,
1618
}
1719

1820
impl CompilationLog {
@@ -69,6 +71,7 @@ impl Extend<GhcMessage> for CompilationLog {
6971
reason = progress.reason.as_deref().unwrap_or(""),
7072
"Compiling",
7173
);
74+
self.compiled_modules.push(progress.module);
7275
}
7376
GhcMessage::Diagnostic(diagnostic) => {
7477
if let GhcDiagnostic {

0 commit comments

Comments
 (0)