Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Links in the error hint should be clickable #13194

Open
budde25 opened this issue Sep 5, 2022 · 4 comments
Open

feature: Links in the error hint should be clickable #13194

budde25 opened this issue Sep 5, 2022 · 4 comments
Labels
A-vscode vscode plugin issues C-enhancement Category: enhancement S-unactionable Issue requires feedback, design decisions or is blocked on other work

Comments

@budde25
Copy link

budde25 commented Sep 5, 2022

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer version: 0.3.1194-standalone (67920f7 2022-09-04)

rustc version: (eg. output of rustc -V)
rustc 1.63.0 (4b91a6ea7 2022-08-08)

Screen Shot 2022-09-05 at 11 55 46 AM

It would be nice if the link to the Github issue was clickable (similar to how clicking the error brings your to the link for that error "rustc(E0658)")

@Veykril Veykril added A-vscode vscode plugin issues S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Sep 5, 2022
@Veykril
Copy link
Member

Veykril commented Sep 5, 2022

This is part of VSCode's diagnostics which we don't have any control over I believe. I don't think the diagnostics accept markdown either so we can't really make it a link.

@budde25
Copy link
Author

budde25 commented Sep 5, 2022

I think this should be possible as in the example above the E0658 is itself a link to the https://doc.rust-lang.org/error-index.html#E0658 so it already does this right? Since the former is straight rustc output it maybe would have to be parsed and converted it whatever vscode seems to like.

I looked into the code and I think this is the code that finds adds those error links?

fn rustc_code_description(code: Option<&str>) -> Option<lsp_types::CodeDescription> {
code.filter(|code| {
let mut chars = code.chars();
chars.next().map_or(false, |c| c == 'E')
&& chars.by_ref().take(4).all(|c| c.is_ascii_digit())
&& chars.next().is_none()
})
.and_then(|code| {
lsp_types::Url::parse(&format!("https://doc.rust-lang.org/error-index.html#{}", code))
.ok()
.map(|href| lsp_types::CodeDescription { href })
})
}

@Veykril
Copy link
Member

Veykril commented Sep 5, 2022

that part is the error code part of diagnostics which supports links, its not the same as the rest of the diagnostics message

@budde25
Copy link
Author

budde25 commented Sep 5, 2022

Ahh OK thanks for the clarification.

@Veykril Veykril added the C-enhancement Category: enhancement label Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues C-enhancement Category: enhancement S-unactionable Issue requires feedback, design decisions or is blocked on other work
Projects
None yet
Development

No branches or pull requests

2 participants