summaryrefslogtreecommitdiff
path: root/src/app_state.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2025-08-21 22:43:46 +0200
committermo8it <mo8it@proton.me>2025-08-21 23:15:48 +0200
commit2d1d531550afaac36dbf4d15c383bc0e1cbf248d (patch)
tree67f030f84414a463e2e7958b1267baa3a14487e6 /src/app_state.rs
parenta712e484d09ce27a622da5e61d26bbb1004f51d2 (diff)
Fix file links in VS Code
Diffstat (limited to 'src/app_state.rs')
-rw-r--r--src/app_state.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/app_state.rs b/src/app_state.rs
index f3f3481..d654d04 100644
--- a/src/app_state.rs
+++ b/src/app_state.rs
@@ -60,8 +60,7 @@ pub struct AppState {
file_buf: Vec<u8>,
official_exercises: bool,
cmd_runner: CmdRunner,
- // Running in VS Code.
- vs_code: bool,
+ emit_file_links: bool,
}
impl AppState {
@@ -181,7 +180,8 @@ impl AppState {
file_buf,
official_exercises: !Path::new("info.toml").exists(),
cmd_runner,
- vs_code: env::var_os("TERM_PROGRAM").is_some_and(|v| v == "vscode"),
+ // VS Code has its own file link handling
+ emit_file_links: env::var_os("TERM_PROGRAM").is_none_or(|v| v != "vscode"),
};
Ok((slf, state_file_status))
@@ -218,8 +218,8 @@ impl AppState {
}
#[inline]
- pub fn vs_code(&self) -> bool {
- self.vs_code
+ pub fn emit_file_links(&self) -> bool {
+ self.emit_file_links
}
// Write the state file.
@@ -621,7 +621,7 @@ mod tests {
file_buf: Vec::new(),
official_exercises: true,
cmd_runner: CmdRunner::build().unwrap(),
- vs_code: false,
+ emit_file_links: true,
};
let mut assert = |done: [bool; 3], expected: [Option<usize>; 3]| {