Vs code, build output, filename links

  1. In IntelliJ, when building / running unit tests, normal output is "black on white", while clickable links (filename + line number) are "dark blue on white"

  2. In vs code, when building / running unit tests, normal output is "black on white", while clickable links (filename + line number) are also "black on white", except when mouse hovers, it's under lined.

Question: is there a way to configure vs code so that clickable links are also "blue on white" ? I just want build / unit test output to make it blatantly obvious what is clickable.

I am not aware of a way to fix this :frowning: Think about this every time I need to debug a panic.

1 Like
  1. Thank you for your work on the vs code / rust-analyzer plugin. It's impressive.

  2. This is unfortunate, as my development is often panic-driven -- get the function type signatures to compile w/ body of todo!()

  3. VS Code is all electron right? Is it possible that (1) there is some CSS class responsible for this "on cursor underline", and (2) we make all those 'blue on white' ?

I can confirm that adding to settings.json

    "workbench.colorCustomizations": {
		"editorLink.activeForeground": "#0000ff",
		"notificationLink.foreground": "#0000ff",
		"textLink.activeForeground": "#0000ff",
		"textLink.foreground": "#0000ff",
    },

does not help.

There are claims that VS Code Terminal is using https://xtermjs.org/

If

$PROJECT_ROOT/blah/test.rs

exists, then

echo -e "\e[31mblah/test.rs\e[0m"

prints out "blah/test.rs" in red, and it is clickable.

One possibility is that we hijack the output of "cargo test" to inject the color at the output level.

    std::panic::set_hook(Box::new(|info| {
        println!("\n\n\n");
        println!("begin **************************************** ");
        println!("custom panic hook: {:?}", info);
        // println!("backtrace: {:?}", backtrace::Backtrace::new());

        let bt = backtrace::Backtrace::new();

        for frame in bt.frames() {
            for s in frame.symbols() {
                match (s.filename(), s.lineno()) {
                    (Some(fname), Some(lineno)) => {
                        println!("\x1b[34m {}:{:?} \x1b[0m", fname.display(), lineno);
                    }
                    _ => {}
                }
            }
        }
        println!("end **************************************** ");
        println!("\n\n\n");
    }));

This almost works. We still need a way to filter out all the stdlib / external crate lines (i.e. only show files from current workspace).

Is there a way in Rust, at runtime, to extract "what is the root of the workspace we're running from" ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.