Use Project::search in ProjectFind and show search results

This commit is contained in:
Antonio Scandurra 2022-02-25 10:27:45 +01:00
parent 5644336df3
commit 0bf944e038
12 changed files with 484 additions and 336 deletions

View file

@ -365,6 +365,14 @@ pub(crate) struct DiagnosticEndpoint {
severity: DiagnosticSeverity,
}
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Debug)]
pub enum CharKind {
Newline,
Punctuation,
Whitespace,
Word,
}
impl Buffer {
pub fn new<T: Into<Arc<str>>>(
replica_id: ReplicaId,
@ -2659,3 +2667,15 @@ pub fn contiguous_ranges(
}
})
}
pub fn char_kind(c: char) -> CharKind {
if c == '\n' {
CharKind::Newline
} else if c.is_whitespace() {
CharKind::Whitespace
} else if c.is_alphanumeric() || c == '_' {
CharKind::Word
} else {
CharKind::Punctuation
}
}