chore: fix typos (#19572)

This commit is contained in:
Martin Fischer 2023-06-26 15:10:27 +02:00 committed by GitHub
parent ad3c494b46
commit 801b9ec62d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 169 additions and 168 deletions

View file

@ -1808,7 +1808,7 @@ impl Iterator for PreloadDocumentFinder {
}
}
/// Removes any directorys that are a descendant of another directory in the collection.
/// Removes any directories that are a descendant of another directory in the collection.
fn sort_and_remove_non_leaf_dirs(mut dirs: Vec<PathBuf>) -> Vec<PathBuf> {
if dirs.is_empty() {
return dirs;

View file

@ -1374,7 +1374,7 @@ impl Inner {
}
self.recreate_npm_services_if_necessary().await;
self.assets.intitialize(self.snapshot()).await;
self.assets.initialize(self.snapshot()).await;
self.performance.measure(mark);
Ok(InitializeResult {

View file

@ -626,7 +626,7 @@ pub fn tokens_to_regex(
route.push('$');
}
} else {
let is_end_deliminated = match maybe_end_token {
let is_end_delimited = match maybe_end_token {
Some(Token::String(mut s)) => {
if let Some(c) = s.pop() {
delimiter.contains(c)
@ -642,7 +642,7 @@ pub fn tokens_to_regex(
write!(route, r"(?:{delimiter}(?={ends_with}))?").unwrap();
}
if !is_end_deliminated {
if !is_end_delimited {
write!(route, r"(?={delimiter}|{ends_with})").unwrap();
}
}

View file

@ -74,7 +74,7 @@ fn base_url(url: &Url) -> String {
}
#[derive(Debug)]
enum CompletorType {
enum CompletionType {
Literal(String),
Key {
key: Key,
@ -85,25 +85,25 @@ enum CompletorType {
/// Determine if a completion at a given offset is a string literal or a key/
/// variable.
fn get_completor_type(
fn get_completion_type(
offset: usize,
tokens: &[Token],
match_result: &MatchResult,
) -> Option<CompletorType> {
) -> Option<CompletionType> {
let mut len = 0_usize;
for (index, token) in tokens.iter().enumerate() {
match token {
Token::String(s) => {
len += s.chars().count();
if offset < len {
return Some(CompletorType::Literal(s.clone()));
return Some(CompletionType::Literal(s.clone()));
}
}
Token::Key(k) => {
if let Some(prefix) = &k.prefix {
len += prefix.chars().count();
if offset < len {
return Some(CompletorType::Key {
return Some(CompletionType::Key {
key: k.clone(),
prefix: Some(prefix.clone()),
index,
@ -120,7 +120,7 @@ fn get_completor_type(
.unwrap_or_default();
len += value.chars().count();
if offset <= len {
return Some(CompletorType::Key {
return Some(CompletionType::Key {
key: k.clone(),
prefix: None,
index,
@ -130,7 +130,7 @@ fn get_completor_type(
if let Some(suffix) = &k.suffix {
len += suffix.chars().count();
if offset <= len {
return Some(CompletorType::Literal(suffix.clone()));
return Some(CompletionType::Literal(suffix.clone()));
}
}
}
@ -688,17 +688,17 @@ impl ModuleRegistry {
.ok()?;
if let Some(match_result) = matcher.matches(path) {
did_match = true;
let completor_type =
get_completor_type(path_offset, &tokens, &match_result);
match completor_type {
Some(CompletorType::Literal(s)) => self.complete_literal(
let completion_type =
get_completion_type(path_offset, &tokens, &match_result);
match completion_type {
Some(CompletionType::Literal(s)) => self.complete_literal(
s,
&mut completions,
current_specifier,
offset,
range,
),
Some(CompletorType::Key { key, prefix, index }) => {
Some(CompletionType::Key { key, prefix, index }) => {
let maybe_url = registry.get_url_for_key(&key);
if let Some(url) = maybe_url {
if let Some(items) = self

View file

@ -650,7 +650,7 @@ impl Assets {
}
/// Initializes with the assets in the isolate.
pub async fn intitialize(&self, state_snapshot: Arc<StateSnapshot>) {
pub async fn initialize(&self, state_snapshot: Arc<StateSnapshot>) {
let assets = get_isolate_assets(&self.ts_server, state_snapshot).await;
let mut assets_map = self.assets.lock();
for asset in assets {
@ -4737,7 +4737,7 @@ mod tests {
}
#[test]
fn include_supress_inlay_hit_settings() {
fn include_suppress_inlay_hit_settings() {
let mut settings = WorkspaceSettings::default();
settings
.inlay_hints