Teach the highlight meta about emacs face names
This commit is contained in:
parent
676ddedbaf
commit
501c2e3fbe
1 changed files with 34 additions and 0 deletions
|
|
@ -2374,14 +2374,20 @@ class SyntaxMeta:
|
||||||
|
|
||||||
class HighlightMeta(SyntaxMeta):
|
class HighlightMeta(SyntaxMeta):
|
||||||
scope: str
|
scope: str
|
||||||
|
font_lock_face: str | None
|
||||||
|
font_lock_feature: str | None
|
||||||
|
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
self.scope = ".".join(scope)
|
self.scope = ".".join(scope)
|
||||||
|
self.font_lock_face = None
|
||||||
|
self.font_lock_feature = None
|
||||||
|
|
||||||
|
|
||||||
class CommentHighlight(HighlightMeta):
|
class CommentHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("comment", *scope)
|
super().__init__("comment", *scope)
|
||||||
|
self.font_lock_face = "font-lock-comment-face"
|
||||||
|
self.font_lock_feature = "comment"
|
||||||
|
|
||||||
|
|
||||||
class BlockCommentHighlight(CommentHighlight):
|
class BlockCommentHighlight(CommentHighlight):
|
||||||
|
|
@ -2397,6 +2403,8 @@ class LineCommentHighlight(CommentHighlight):
|
||||||
class ConstantHighlight(HighlightMeta):
|
class ConstantHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("constant", *scope)
|
super().__init__("constant", *scope)
|
||||||
|
self.font_lock_face = "font-lock-constant-face"
|
||||||
|
self.font_lock_feature = "constant"
|
||||||
|
|
||||||
|
|
||||||
class LanguageConstantHighlight(ConstantHighlight):
|
class LanguageConstantHighlight(ConstantHighlight):
|
||||||
|
|
@ -2407,6 +2415,8 @@ class LanguageConstantHighlight(ConstantHighlight):
|
||||||
class NumericConstantHighlight(ConstantHighlight):
|
class NumericConstantHighlight(ConstantHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("numeric", *scope)
|
super().__init__("numeric", *scope)
|
||||||
|
self.font_lock_feature = "number"
|
||||||
|
self.font_lock_face = "font-lock-number-face"
|
||||||
|
|
||||||
|
|
||||||
class EntityHighlight(HighlightMeta):
|
class EntityHighlight(HighlightMeta):
|
||||||
|
|
@ -2417,21 +2427,27 @@ class EntityHighlight(HighlightMeta):
|
||||||
class NameEntityHighlight(EntityHighlight):
|
class NameEntityHighlight(EntityHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("name", *scope)
|
super().__init__("name", *scope)
|
||||||
|
self.font_lock_face = "font-lock-variable-name-face"
|
||||||
|
self.font_lock_feature = "definition"
|
||||||
|
|
||||||
|
|
||||||
class FunctionNameEntityHighlight(NameEntityHighlight):
|
class FunctionNameEntityHighlight(NameEntityHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("function", *scope)
|
super().__init__("function", *scope)
|
||||||
|
self.font_lock_face = "font-lock-function-name-face"
|
||||||
|
|
||||||
|
|
||||||
class TypeNameEntityHighlight(NameEntityHighlight):
|
class TypeNameEntityHighlight(NameEntityHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("type", *scope)
|
super().__init__("type", *scope)
|
||||||
|
self.font_lock_feature = "type"
|
||||||
|
|
||||||
|
|
||||||
class KeywordHighlight(HighlightMeta):
|
class KeywordHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("keyword", *scope)
|
super().__init__("keyword", *scope)
|
||||||
|
self.font_lock_feature = "keyword"
|
||||||
|
self.font_lock_face = "font-lock-keyword-face"
|
||||||
|
|
||||||
|
|
||||||
class ControlKeywordHighlight(KeywordHighlight):
|
class ControlKeywordHighlight(KeywordHighlight):
|
||||||
|
|
@ -2447,6 +2463,8 @@ class ConditionalControlKeywordHighlight(ControlKeywordHighlight):
|
||||||
class OperatorKeywordHighlight(KeywordHighlight):
|
class OperatorKeywordHighlight(KeywordHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("operator", *scope)
|
super().__init__("operator", *scope)
|
||||||
|
self.font_lock_feature = "operator"
|
||||||
|
self.font_lock_face = "font-lock-operator-face"
|
||||||
|
|
||||||
|
|
||||||
class ExpressionOperatorKeywordHighlight(OperatorKeywordHighlight):
|
class ExpressionOperatorKeywordHighlight(OperatorKeywordHighlight):
|
||||||
|
|
@ -2462,6 +2480,8 @@ class OtherKeywordHighlight(KeywordHighlight):
|
||||||
class PunctuationHighlight(HighlightMeta):
|
class PunctuationHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("punctuation", *scope)
|
super().__init__("punctuation", *scope)
|
||||||
|
self.font_lock_feature = "delimiter"
|
||||||
|
self.font_lock_face = "font-lock-punctuation-face"
|
||||||
|
|
||||||
|
|
||||||
class SeparatorPunctuationHighlight(PunctuationHighlight):
|
class SeparatorPunctuationHighlight(PunctuationHighlight):
|
||||||
|
|
@ -2472,6 +2492,8 @@ class SeparatorPunctuationHighlight(PunctuationHighlight):
|
||||||
class ParenthesisPunctuationHighlight(PunctuationHighlight):
|
class ParenthesisPunctuationHighlight(PunctuationHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("parenthesis", *scope)
|
super().__init__("parenthesis", *scope)
|
||||||
|
self.font_lock_feature = "bracket"
|
||||||
|
self.font_lock_face = "font-lock-bracket-face"
|
||||||
|
|
||||||
|
|
||||||
class OpenParenthesisPunctuationHighlight(ParenthesisPunctuationHighlight):
|
class OpenParenthesisPunctuationHighlight(ParenthesisPunctuationHighlight):
|
||||||
|
|
@ -2487,6 +2509,8 @@ class CloseParenthesisPunctuationHighlight(ParenthesisPunctuationHighlight):
|
||||||
class CurlyBracePunctuationHighlight(PunctuationHighlight):
|
class CurlyBracePunctuationHighlight(PunctuationHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("curlybrace", *scope)
|
super().__init__("curlybrace", *scope)
|
||||||
|
self.font_lock_feature = "bracket"
|
||||||
|
self.font_lock_face = "font-lock-bracket-face"
|
||||||
|
|
||||||
|
|
||||||
class OpenCurlyBracePunctuationHighlight(CurlyBracePunctuationHighlight):
|
class OpenCurlyBracePunctuationHighlight(CurlyBracePunctuationHighlight):
|
||||||
|
|
@ -2502,6 +2526,8 @@ class CloseCurlyBracePunctuationHighlight(CurlyBracePunctuationHighlight):
|
||||||
class SquareBracketPunctuationHighlight(PunctuationHighlight):
|
class SquareBracketPunctuationHighlight(PunctuationHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("squarebracket", *scope)
|
super().__init__("squarebracket", *scope)
|
||||||
|
self.font_lock_feature = "bracket"
|
||||||
|
self.font_lock_face = "font-lock-bracket-face"
|
||||||
|
|
||||||
|
|
||||||
class OpenSquareBracketPunctuationHighlight(SquareBracketPunctuationHighlight):
|
class OpenSquareBracketPunctuationHighlight(SquareBracketPunctuationHighlight):
|
||||||
|
|
@ -2517,6 +2543,8 @@ class CloseSquareBracketPunctuationHighlight(SquareBracketPunctuationHighlight):
|
||||||
class StorageHighlight(HighlightMeta):
|
class StorageHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("storage", *scope)
|
super().__init__("storage", *scope)
|
||||||
|
self.font_lock_feature = "keyword"
|
||||||
|
self.font_lock_face = "font-lock-keyword-face"
|
||||||
|
|
||||||
|
|
||||||
class TypeStorageHighlight(StorageHighlight):
|
class TypeStorageHighlight(StorageHighlight):
|
||||||
|
|
@ -2542,6 +2570,8 @@ class StructTypeStorageHighlight(TypeStorageHighlight):
|
||||||
class StringHighlight(HighlightMeta):
|
class StringHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("string", *scope)
|
super().__init__("string", *scope)
|
||||||
|
self.font_lock_feature = "string"
|
||||||
|
self.font_lock_face = "font-lock-string-face"
|
||||||
|
|
||||||
|
|
||||||
class QuotedStringHighlight(StringHighlight):
|
class QuotedStringHighlight(StringHighlight):
|
||||||
|
|
@ -2562,11 +2592,15 @@ class DoubleQuotedStringHighlight(QuotedStringHighlight):
|
||||||
class VariableHighlight(HighlightMeta):
|
class VariableHighlight(HighlightMeta):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("variable", *scope)
|
super().__init__("variable", *scope)
|
||||||
|
self.font_lock_feature = "variable"
|
||||||
|
self.font_lock_face = "font-lock-variable-use-face"
|
||||||
|
|
||||||
|
|
||||||
class LanguageVariableHighlight(VariableHighlight):
|
class LanguageVariableHighlight(VariableHighlight):
|
||||||
def __init__(self, *scope: str):
|
def __init__(self, *scope: str):
|
||||||
super().__init__("language", *scope)
|
super().__init__("language", *scope)
|
||||||
|
self.font_lock_feature = "builtin"
|
||||||
|
self.font_lock_face = "font-lock-builtin-face"
|
||||||
|
|
||||||
|
|
||||||
class _Highlight:
|
class _Highlight:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue