Skip to content

Commit

Permalink
refactor: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Dec 30, 2024
1 parent 45a374d commit 93d92d7
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions lsp/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,16 @@ impl<'a> Placeholders<'a> {
}

pub fn replace(&self, text: &str) -> String {
let mut result = text.to_string();
let filename = self.filename.as_deref().unwrap_or("filename");
let language = self.language.as_deref().unwrap_or("language");

if let Some(filename) = &self.filename {
result = replace_with_capitalization!(result, "filename" => filename.as_str());
}

result = replace_with_capitalization!(result, "workspace" => self.workspace);

if let Some(language) = &self.language {
result = replace_with_capitalization!(result, "language" => language.as_str());
}

result = replace_with_capitalization!(result, "base_icons_url" => self.base_icons_url);

result
replace_with_capitalization!(
text,
"filename" => filename,
"workspace" => self.workspace,
"language" => language,
"base_icons_url" => self.base_icons_url
)
}
}

Expand Down

0 comments on commit 93d92d7

Please sign in to comment.