mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
parent
2b210d98b8
commit
61580f3cb8
@ -81,7 +81,7 @@ pub fn highlight(file: &File) -> Vec<HighlightedRange> {
|
||||
let mut res = Vec::new();
|
||||
for node in file.syntax().descendants() {
|
||||
let tag = match node.kind() {
|
||||
COMMENT | DOC_COMMENT => "comment",
|
||||
COMMENT => "comment",
|
||||
STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => "string",
|
||||
ATTR => "attribute",
|
||||
NAME_REF => "text",
|
||||
|
@ -113,7 +113,6 @@ Grammar(
|
||||
"BYTE_STRING",
|
||||
"RAW_BYTE_STRING",
|
||||
"COMMENT",
|
||||
"DOC_COMMENT",
|
||||
"SHEBANG",
|
||||
],
|
||||
nodes: [
|
||||
|
@ -48,7 +48,7 @@ fn reparse_leaf<'node>(
|
||||
) -> Option<(SyntaxNodeRef<'node>, GreenNode, Vec<SyntaxError>)> {
|
||||
let node = algo::find_covering_node(node, edit.delete);
|
||||
match node.kind() {
|
||||
WHITESPACE | COMMENT | DOC_COMMENT | IDENT | STRING | RAW_STRING => {
|
||||
WHITESPACE | COMMENT | IDENT | STRING | RAW_STRING => {
|
||||
let text = get_text_after_edit(node, &edit);
|
||||
let tokens = tokenize(&text);
|
||||
let token = match tokens[..] {
|
||||
|
@ -116,7 +116,6 @@ pub enum SyntaxKind {
|
||||
BYTE_STRING,
|
||||
RAW_BYTE_STRING,
|
||||
COMMENT,
|
||||
DOC_COMMENT,
|
||||
SHEBANG,
|
||||
ROOT,
|
||||
STRUCT_DEF,
|
||||
@ -378,7 +377,6 @@ impl SyntaxKind {
|
||||
BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" },
|
||||
RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" },
|
||||
COMMENT => &SyntaxInfo { name: "COMMENT" },
|
||||
DOC_COMMENT => &SyntaxInfo { name: "DOC_COMMENT" },
|
||||
SHEBANG => &SyntaxInfo { name: "SHEBANG" },
|
||||
ROOT => &SyntaxInfo { name: "ROOT" },
|
||||
STRUCT_DEF => &SyntaxInfo { name: "STRUCT_DEF" },
|
||||
|
@ -19,7 +19,7 @@ pub(crate) struct SyntaxInfo {
|
||||
impl SyntaxKind {
|
||||
pub fn is_trivia(self) -> bool {
|
||||
match self {
|
||||
WHITESPACE | COMMENT | DOC_COMMENT => true,
|
||||
WHITESPACE | COMMENT => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user