mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 10:33:54 +00:00
fix(lsp): decoding percent-encoding(non-ASCII) file path correctly (#22582)
This commit is contained in:
parent
3462248571
commit
feb744cebd
5 changed files with 162 additions and 19 deletions
|
@ -122,6 +122,7 @@ use crate::tools::upgrade::upgrade_check_enabled;
|
|||
use crate::util::fs::remove_dir_all_if_exists;
|
||||
use crate::util::path::is_importable_ext;
|
||||
use crate::util::path::specifier_to_file_path;
|
||||
use crate::util::path::to_percent_decoded_str;
|
||||
use crate::util::progress_bar::ProgressBar;
|
||||
use crate::util::progress_bar::ProgressBarStyle;
|
||||
|
||||
|
@ -1738,16 +1739,21 @@ impl Inner {
|
|||
match resolution {
|
||||
Resolution::Ok(resolved) => {
|
||||
let specifier = &resolved.specifier;
|
||||
let format = |scheme: &str, rest: &str| -> String {
|
||||
format!("{}​{}", scheme, rest).replace('@', "​@")
|
||||
};
|
||||
match specifier.scheme() {
|
||||
"data" => "_(a data url)_".to_string(),
|
||||
"blob" => "_(a blob url)_".to_string(),
|
||||
"file" => format(
|
||||
&specifier[..url::Position::AfterScheme],
|
||||
&to_percent_decoded_str(&specifier[url::Position::AfterScheme..]),
|
||||
),
|
||||
_ => {
|
||||
let mut result = format!(
|
||||
"{}​{}",
|
||||
let mut result = format(
|
||||
&specifier[..url::Position::AfterScheme],
|
||||
&specifier[url::Position::AfterScheme..],
|
||||
)
|
||||
.replace('@', "​@");
|
||||
);
|
||||
if let Ok(jsr_req_ref) =
|
||||
JsrPackageReqReference::from_specifier(specifier)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue