Remove CharKind::Newline
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines. /cc @as-cii Co-Authored-By: Keith Simmons <keith@the-simmons.net>
This commit is contained in:
parent
baeb7d27b8
commit
210fa4c443
3 changed files with 13 additions and 16 deletions
|
@ -271,7 +271,6 @@ pub(crate) struct DiagnosticEndpoint {
|
|||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Debug)]
|
||||
pub enum CharKind {
|
||||
Newline,
|
||||
Punctuation,
|
||||
Whitespace,
|
||||
Word,
|
||||
|
@ -2259,9 +2258,7 @@ pub fn contiguous_ranges(
|
|||
}
|
||||
|
||||
pub fn char_kind(c: char) -> CharKind {
|
||||
if c == '\n' {
|
||||
CharKind::Newline
|
||||
} else if c.is_whitespace() {
|
||||
if c.is_whitespace() {
|
||||
CharKind::Whitespace
|
||||
} else if c.is_alphanumeric() || c == '_' {
|
||||
CharKind::Word
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue