mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 13:44:08 +00:00
fix(lsp): handle repeating patterns in registry correctly (#13275)
This commit is contained in:
parent
d9b130410b
commit
01ff7a8784
15 changed files with 120 additions and 28 deletions
|
@ -249,7 +249,11 @@ impl StringOrVec {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn to_string(&self, maybe_key: Option<&Key>) -> String {
|
||||
pub fn to_string(
|
||||
&self,
|
||||
maybe_key: Option<&Key>,
|
||||
omit_initial_prefix: bool,
|
||||
) -> String {
|
||||
match self {
|
||||
Self::String(s) => s.clone(),
|
||||
Self::Vec(v) => {
|
||||
|
@ -262,8 +266,12 @@ impl StringOrVec {
|
|||
("/".to_string(), "".to_string())
|
||||
};
|
||||
let mut s = String::new();
|
||||
for segment in v {
|
||||
s.push_str(&format!("{}{}{}", prefix, segment, suffix));
|
||||
for (i, segment) in v.iter().enumerate() {
|
||||
if omit_initial_prefix && i == 0 {
|
||||
s.push_str(&format!("{}{}", segment, suffix));
|
||||
} else {
|
||||
s.push_str(&format!("{}{}{}", prefix, segment, suffix));
|
||||
}
|
||||
}
|
||||
s
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue