mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-12-03 22:59:07 +02:00
Only disable links in VS code in the list
This commit is contained in:
12
src/term.rs
12
src/term.rs
@@ -1,6 +1,5 @@
|
||||
use std::{
|
||||
cell::Cell,
|
||||
env, fmt, fs,
|
||||
fmt, fs,
|
||||
io::{self, BufRead, StdoutLock, Write},
|
||||
};
|
||||
|
||||
@@ -11,10 +10,6 @@ use crossterm::{
|
||||
Command, QueueableCommand,
|
||||
};
|
||||
|
||||
thread_local! {
|
||||
static VS_CODE: Cell<bool> = Cell::new(env::var_os("TERM_PROGRAM").is_some_and(|v| v == "vscode"));
|
||||
}
|
||||
|
||||
pub struct MaxLenWriter<'a, 'b> {
|
||||
pub stdout: &'a mut StdoutLock<'b>,
|
||||
len: usize,
|
||||
@@ -161,11 +156,6 @@ pub fn terminal_file_link<'a>(
|
||||
path: &str,
|
||||
color: Color,
|
||||
) -> io::Result<()> {
|
||||
// VS Code shows its own links. This also avoids some issues, especially on Windows.
|
||||
if VS_CODE.get() {
|
||||
return writer.write_str(path);
|
||||
}
|
||||
|
||||
let canonical_path = fs::canonicalize(path).ok();
|
||||
|
||||
let Some(canonical_path) = canonical_path.as_deref().and_then(|p| p.to_str()) else {
|
||||
|
||||
Reference in New Issue
Block a user