diff --git a/crates/theme_importer/src/vscode/syntax.rs b/crates/theme_importer/src/vscode/syntax.rs index e6633132c4..7f93925ee8 100644 --- a/crates/theme_importer/src/vscode/syntax.rs +++ b/crates/theme_importer/src/vscode/syntax.rs @@ -35,94 +35,92 @@ pub struct VsCodeTokenColorSettings { #[derive(Debug, PartialEq, Copy, Clone, EnumIter)] pub enum ZedSyntaxToken { - SyntaxAttribute, - SyntaxBoolean, - SyntaxComment, - SyntaxCommentDoc, - SyntaxConstant, - SyntaxConstructor, - SyntaxEmbedded, - SyntaxEmphasis, - SyntaxEmphasisStrong, - SyntaxEnum, - SyntaxFunction, - SyntaxHint, - SyntaxKeyword, - SyntaxLabel, - SyntaxLinkText, - SyntaxLinkUri, - SyntaxNumber, - SyntaxOperator, - SyntaxPredictive, - SyntaxPreproc, - SyntaxPrimary, - SyntaxProperty, - SyntaxPunctuation, - SyntaxPunctuationBracket, - SyntaxPunctuationDelimiter, - SyntaxPunctuationListMarker, - SyntaxPunctuationSpecial, - SyntaxString, - SyntaxStringEscape, - SyntaxStringRegex, - SyntaxStringSpecial, - SyntaxStringSpecialSymbol, - SyntaxTag, - SyntaxTextLiteral, - SyntaxTitle, - SyntaxType, - SyntaxVariable, - SyntaxVariableSpecial, - SyntaxVariant, + Attribute, + Boolean, + Comment, + CommentDoc, + Constant, + Constructor, + Embedded, + Emphasis, + EmphasisStrong, + Enum, + Function, + Hint, + Keyword, + Label, + LinkText, + LinkUri, + Number, + Operator, + Predictive, + Preproc, + Primary, + Property, + Punctuation, + PunctuationBracket, + PunctuationDelimiter, + PunctuationListMarker, + PunctuationSpecial, + String, + StringEscape, + StringRegex, + StringSpecial, + StringSpecialSymbol, + Tag, + TextLiteral, + Title, + Type, + Variable, + VariableSpecial, + Variant, } impl std::fmt::Display for ZedSyntaxToken { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - use ZedSyntaxToken::*; - write!( f, "{}", match self { - SyntaxAttribute => "attribute", - SyntaxBoolean => "boolean", - SyntaxComment => "comment", - SyntaxCommentDoc => "comment.doc", - SyntaxConstant => "constant", - SyntaxConstructor => "constructor", - SyntaxEmbedded => "embedded", - SyntaxEmphasis => "emphasis", - SyntaxEmphasisStrong => "emphasis.strong", - SyntaxEnum => "enum", - SyntaxFunction => "function", - SyntaxHint => "hint", - SyntaxKeyword => "keyword", - SyntaxLabel => "label", - SyntaxLinkText => "link_text", - SyntaxLinkUri => "link_uri", - SyntaxNumber => "number", - SyntaxOperator => "operator", - SyntaxPredictive => "predictive", - SyntaxPreproc => "preproc", - SyntaxPrimary => "primary", - SyntaxProperty => "property", - SyntaxPunctuation => "punctuation", - SyntaxPunctuationBracket => "punctuation.bracket", - SyntaxPunctuationDelimiter => "punctuation.delimiter", - SyntaxPunctuationListMarker => "punctuation.list_marker", - SyntaxPunctuationSpecial => "punctuation.special", - SyntaxString => "string", - SyntaxStringEscape => "string.escape", - SyntaxStringRegex => "string.regex", - SyntaxStringSpecial => "string.special", - SyntaxStringSpecialSymbol => "string.special.symbol", - SyntaxTag => "tag", - SyntaxTextLiteral => "text.literal", - SyntaxTitle => "title", - SyntaxType => "type", - SyntaxVariable => "variable", - SyntaxVariableSpecial => "variable.special", - SyntaxVariant => "variant", + ZedSyntaxToken::Attribute => "attribute", + ZedSyntaxToken::Boolean => "boolean", + ZedSyntaxToken::Comment => "comment", + ZedSyntaxToken::CommentDoc => "comment.doc", + ZedSyntaxToken::Constant => "constant", + ZedSyntaxToken::Constructor => "constructor", + ZedSyntaxToken::Embedded => "embedded", + ZedSyntaxToken::Emphasis => "emphasis", + ZedSyntaxToken::EmphasisStrong => "emphasis.strong", + ZedSyntaxToken::Enum => "enum", + ZedSyntaxToken::Function => "function", + ZedSyntaxToken::Hint => "hint", + ZedSyntaxToken::Keyword => "keyword", + ZedSyntaxToken::Label => "label", + ZedSyntaxToken::LinkText => "link_text", + ZedSyntaxToken::LinkUri => "link_uri", + ZedSyntaxToken::Number => "number", + ZedSyntaxToken::Operator => "operator", + ZedSyntaxToken::Predictive => "predictive", + ZedSyntaxToken::Preproc => "preproc", + ZedSyntaxToken::Primary => "primary", + ZedSyntaxToken::Property => "property", + ZedSyntaxToken::Punctuation => "punctuation", + ZedSyntaxToken::PunctuationBracket => "punctuation.bracket", + ZedSyntaxToken::PunctuationDelimiter => "punctuation.delimiter", + ZedSyntaxToken::PunctuationListMarker => "punctuation.list_marker", + ZedSyntaxToken::PunctuationSpecial => "punctuation.special", + ZedSyntaxToken::String => "string", + ZedSyntaxToken::StringEscape => "string.escape", + ZedSyntaxToken::StringRegex => "string.regex", + ZedSyntaxToken::StringSpecial => "string.special", + ZedSyntaxToken::StringSpecialSymbol => "string.special.symbol", + ZedSyntaxToken::Tag => "tag", + ZedSyntaxToken::TextLiteral => "text.literal", + ZedSyntaxToken::Title => "title", + ZedSyntaxToken::Type => "type", + ZedSyntaxToken::Variable => "variable", + ZedSyntaxToken::VariableSpecial => "variable.special", + ZedSyntaxToken::Variant => "variant", } ) } @@ -130,47 +128,47 @@ impl std::fmt::Display for ZedSyntaxToken { impl ZedSyntaxToken { pub fn to_vscode(&self) -> Vec<&'static str> { - use ZedSyntaxToken::*; - match self { - SyntaxAttribute => vec!["entity.other.attribute-name"], - SyntaxBoolean => vec!["constant.language"], - SyntaxComment => vec!["comment"], - SyntaxCommentDoc => vec!["comment.block.documentation"], - SyntaxConstant => vec!["constant.character"], - SyntaxConstructor => vec!["entity.name.function.definition.special.constructor"], - SyntaxEmbedded => vec!["meta.embedded"], - SyntaxEmphasis => vec!["markup.italic"], - SyntaxEmphasisStrong => vec![ + ZedSyntaxToken::Attribute => vec!["entity.other.attribute-name"], + ZedSyntaxToken::Boolean => vec!["constant.language"], + ZedSyntaxToken::Comment => vec!["comment"], + ZedSyntaxToken::CommentDoc => vec!["comment.block.documentation"], + ZedSyntaxToken::Constant => vec!["constant.character"], + ZedSyntaxToken::Constructor => { + vec!["entity.name.function.definition.special.constructor"] + } + ZedSyntaxToken::Embedded => vec!["meta.embedded"], + ZedSyntaxToken::Emphasis => vec!["markup.italic"], + ZedSyntaxToken::EmphasisStrong => vec![ "markup.bold", "markup.italic markup.bold", "markup.bold markup.italic", ], - SyntaxEnum => vec!["support.type.enum"], - SyntaxFunction => vec![ + ZedSyntaxToken::Enum => vec!["support.type.enum"], + ZedSyntaxToken::Function => vec![ "entity.name.function", "variable.function", "support.function", ], - SyntaxKeyword => vec!["keyword"], - SyntaxLabel => vec![ + ZedSyntaxToken::Keyword => vec!["keyword"], + ZedSyntaxToken::Label => vec![ "label", "entity.name", "entity.name.import", "entity.name.package", ], - SyntaxLinkText => vec!["markup.underline.link", "string.other.link"], - SyntaxLinkUri => vec!["markup.underline.link", "string.other.link"], - SyntaxNumber => vec!["constant.numeric", "number"], - SyntaxOperator => vec!["operator", "keyword.operator"], - SyntaxPreproc => vec!["preproc"], - SyntaxProperty => vec![ + ZedSyntaxToken::LinkText => vec!["markup.underline.link", "string.other.link"], + ZedSyntaxToken::LinkUri => vec!["markup.underline.link", "string.other.link"], + ZedSyntaxToken::Number => vec!["constant.numeric", "number"], + ZedSyntaxToken::Operator => vec!["operator", "keyword.operator"], + ZedSyntaxToken::Preproc => vec!["preproc"], + ZedSyntaxToken::Property => vec![ "variable.member", "support.type.property-name", "variable.object.property", "variable.other.field", ], - SyntaxPunctuation => vec![ + ZedSyntaxToken::Punctuation => vec![ "punctuation", "punctuation.section", "punctuation.accessor", @@ -178,40 +176,46 @@ impl ZedSyntaxToken { "punctuation.terminator", "punctuation.definition.tag", ], - SyntaxPunctuationBracket => vec![ + ZedSyntaxToken::PunctuationBracket => vec![ "punctuation.bracket", "punctuation.definition.tag.begin", "punctuation.definition.tag.end", ], - SyntaxPunctuationDelimiter => vec![ + ZedSyntaxToken::PunctuationDelimiter => vec![ "punctuation.delimiter", "punctuation.separator", "punctuation.terminator", ], - SyntaxPunctuationListMarker => vec!["markup.list punctuation.definition.list.begin"], - SyntaxPunctuationSpecial => vec!["punctuation.special"], - SyntaxString => vec!["string"], - SyntaxStringEscape => vec!["string.escape", "constant.character", "constant.other"], - SyntaxStringRegex => vec!["string.regex"], - SyntaxStringSpecial => vec!["string.special", "constant.other.symbol"], - SyntaxStringSpecialSymbol => vec!["string.special.symbol", "constant.other.symbol"], - SyntaxTag => vec!["tag", "entity.name.tag", "meta.tag.sgml"], - SyntaxTextLiteral => vec!["text.literal", "string"], - SyntaxTitle => vec!["title", "entity.name"], - SyntaxType => vec!["entity.name.type", "support.type", "support.class"], - SyntaxVariable => vec![ + ZedSyntaxToken::PunctuationListMarker => { + vec!["markup.list punctuation.definition.list.begin"] + } + ZedSyntaxToken::PunctuationSpecial => vec!["punctuation.special"], + ZedSyntaxToken::String => vec!["string"], + ZedSyntaxToken::StringEscape => { + vec!["string.escape", "constant.character", "constant.other"] + } + ZedSyntaxToken::StringRegex => vec!["string.regex"], + ZedSyntaxToken::StringSpecial => vec!["string.special", "constant.other.symbol"], + ZedSyntaxToken::StringSpecialSymbol => { + vec!["string.special.symbol", "constant.other.symbol"] + } + ZedSyntaxToken::Tag => vec!["tag", "entity.name.tag", "meta.tag.sgml"], + ZedSyntaxToken::TextLiteral => vec!["text.literal", "string"], + ZedSyntaxToken::Title => vec!["title", "entity.name"], + ZedSyntaxToken::Type => vec!["entity.name.type", "support.type", "support.class"], + ZedSyntaxToken::Variable => vec![ "variable", "variable.language", "variable.member", "variable.parameter.function-call", ], - SyntaxVariableSpecial => vec![ + ZedSyntaxToken::VariableSpecial => vec![ "variable.special", "variable.member", "variable.annotation", "variable.language", ], - SyntaxVariant => vec!["variant"], + ZedSyntaxToken::Variant => vec!["variant"], _ => vec![], } }