Skip to content

Commit

Permalink
Fix: decode lsp url for workspace_diagnostics_picker
Browse files Browse the repository at this point in the history
  • Loading branch information
erasin committed Feb 16, 2023
1 parent 9368ac7 commit dca658a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions helix-term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ serde = { version = "1.0", features = ["derive"] }
grep-regex = "0.1.10"
grep-searcher = "0.1.10"

# decode url path for lsp diagnostic workspace picker
percent-encoding = "2.2"

[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }

Expand Down
4 changes: 3 additions & 1 deletion helix-term/src/commands/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use helix_lsp::{
util::{diagnostic_to_lsp_diagnostic, lsp_pos_to_pos, lsp_range_to_range, range_to_lsp_range},
OffsetEncoding,
};
use percent_encoding::percent_decode;
use tui::{
text::{Span, Spans},
widgets::Row,
Expand Down Expand Up @@ -145,7 +146,8 @@ impl ui::menu::Item for PickerDiagnostic {
let path = match format {
DiagnosticsFormat::HideSourcePath => String::new(),
DiagnosticsFormat::ShowSourcePath => {
let path = path::get_truncated_path(self.url.path());
let url_decode = percent_decode(self.url.path().as_bytes()).decode_utf8_lossy();
let path = path::get_truncated_path(url_decode.to_string());
format!("{}: ", path.to_string_lossy())
}
};
Expand Down

0 comments on commit dca658a

Please sign in to comment.