chore: Extract languages from zed crate (#8270)
- Moves languages module from `zed` into a separate crate. That way we have less of a long pole at the end of compilation. - Removes moot dependencies on editor/picker. This is totally harmless and might help in the future if we decide to decouple picker from editor. Before: ``` Number of crates that depend on 'picker' but not on 'editor': 1 Total number of crates that depend on 'picker': 13 Total number of crates that depend on 'editor': 30 ``` After: ``` Number of crates that depend on 'picker' but not on 'editor': 5 Total number of crates that depend on 'picker': 12 Total number of crates that depend on 'editor': 26 ``` The more crates depend on just picker but not editor, the better in that case. Release Notes: - N/A
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
("(" @open ")" @close)
|
||||
("[" @open "]" @close)
|
||||
("{" @open "}" @close)
|
||||
@@ -0,0 +1,11 @@
|
||||
name = "Zig"
|
||||
grammar = "zig"
|
||||
path_suffixes = ["zig"]
|
||||
line_comments = ["// "]
|
||||
autoclose_before = ";:.,=}])>"
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "(", end = ")", close = true, newline = true },
|
||||
{ start = "<", end = ">", close = true, newline = true },
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
[
|
||||
(Block)
|
||||
(ContainerDecl)
|
||||
(SwitchExpr)
|
||||
(InitList)
|
||||
(AsmExpr)
|
||||
(ErrorSetDecl)
|
||||
(LINESTRING)
|
||||
(
|
||||
[
|
||||
(IfPrefix)
|
||||
(WhilePrefix)
|
||||
(ForPrefix)
|
||||
]
|
||||
)
|
||||
] @fold
|
||||
@@ -0,0 +1,230 @@
|
||||
[
|
||||
(container_doc_comment)
|
||||
(doc_comment)
|
||||
(line_comment)
|
||||
] @comment
|
||||
|
||||
[
|
||||
variable: (IDENTIFIER)
|
||||
variable_type_function: (IDENTIFIER)
|
||||
] @variable
|
||||
|
||||
parameter: (IDENTIFIER) @parameter
|
||||
|
||||
[
|
||||
field_member: (IDENTIFIER)
|
||||
field_access: (IDENTIFIER)
|
||||
] @field
|
||||
|
||||
;; assume TitleCase is a type
|
||||
(
|
||||
[
|
||||
variable_type_function: (IDENTIFIER)
|
||||
field_access: (IDENTIFIER)
|
||||
parameter: (IDENTIFIER)
|
||||
] @type
|
||||
(#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$")
|
||||
)
|
||||
|
||||
(
|
||||
(_
|
||||
variable_type_function: (IDENTIFIER) @function
|
||||
(FnCallArguments))
|
||||
)
|
||||
|
||||
;; assume all CAPS_1 is a constant
|
||||
(
|
||||
[
|
||||
variable_type_function: (IDENTIFIER)
|
||||
field_access: (IDENTIFIER)
|
||||
] @constant
|
||||
(#match? @constant "^[A-Z][A-Z_0-9]+$")
|
||||
)
|
||||
|
||||
[
|
||||
function_call: (IDENTIFIER)
|
||||
function: (IDENTIFIER)
|
||||
] @function
|
||||
|
||||
exception: "!" @keyword.exception
|
||||
|
||||
(
|
||||
(IDENTIFIER) @variable.builtin
|
||||
(#eq? @variable.builtin "_")
|
||||
)
|
||||
|
||||
(PtrTypeStart "c" @variable.builtin)
|
||||
|
||||
(
|
||||
(ContainerDeclType
|
||||
[
|
||||
(ErrorUnionExpr)
|
||||
"enum"
|
||||
]
|
||||
)
|
||||
(ContainerField (IDENTIFIER) @constant)
|
||||
)
|
||||
|
||||
field_constant: (IDENTIFIER) @constant
|
||||
|
||||
(BUILTINIDENTIFIER) @keyword
|
||||
|
||||
((BUILTINIDENTIFIER) @keyword.import
|
||||
(#any-of? @keyword.import "@import" "@cImport"))
|
||||
|
||||
(INTEGER) @number
|
||||
|
||||
(FLOAT) @number.float
|
||||
|
||||
[
|
||||
"true"
|
||||
"false"
|
||||
] @boolean
|
||||
|
||||
[
|
||||
(LINESTRING)
|
||||
(STRINGLITERALSINGLE)
|
||||
] @string
|
||||
|
||||
(CHAR_LITERAL) @character
|
||||
(EscapeSequence) @string.escape
|
||||
(FormatSequence) @string.special
|
||||
|
||||
(BreakLabel (IDENTIFIER) @label)
|
||||
(BlockLabel (IDENTIFIER) @label)
|
||||
|
||||
[
|
||||
"asm"
|
||||
"defer"
|
||||
"errdefer"
|
||||
"test"
|
||||
"struct"
|
||||
"union"
|
||||
"enum"
|
||||
"opaque"
|
||||
"error"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
"suspend"
|
||||
"nosuspend"
|
||||
"resume"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"fn"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"and"
|
||||
"or"
|
||||
"orelse"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"break"
|
||||
"continue"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"usingnamespace"
|
||||
] @keyword.import
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"anytype"
|
||||
(BuildinTypeExpr)
|
||||
] @type.builtin
|
||||
|
||||
[
|
||||
"const"
|
||||
"var"
|
||||
"volatile"
|
||||
"allowzero"
|
||||
"noalias"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"addrspace"
|
||||
"align"
|
||||
"callconv"
|
||||
"linksection"
|
||||
] @keyword.storage
|
||||
|
||||
[
|
||||
"comptime"
|
||||
"export"
|
||||
"extern"
|
||||
"inline"
|
||||
"noinline"
|
||||
"packed"
|
||||
"pub"
|
||||
"threadlocal"
|
||||
] @attribute
|
||||
|
||||
[
|
||||
"null"
|
||||
"unreachable"
|
||||
"undefined"
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
(CompareOp)
|
||||
(BitwiseOp)
|
||||
(BitShiftOp)
|
||||
(AdditionOp)
|
||||
(AssignOp)
|
||||
(MultiplyOp)
|
||||
(PrefixOp)
|
||||
"*"
|
||||
"**"
|
||||
"->"
|
||||
".?"
|
||||
".*"
|
||||
"?"
|
||||
] @operator
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
".."
|
||||
"..."
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
(Payload "|")
|
||||
(PtrPayload "|")
|
||||
(PtrIndexPayload "|")
|
||||
] @punctuation.bracket
|
||||
|
||||
; Error
|
||||
(ERROR) @error
|
||||
@@ -0,0 +1,22 @@
|
||||
[
|
||||
(Block)
|
||||
(ContainerDecl)
|
||||
(SwitchExpr)
|
||||
(InitList)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(container_doc_comment)
|
||||
(doc_comment)
|
||||
(LINESTRING)
|
||||
] @indent.ignore
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
(container_doc_comment)
|
||||
(doc_comment)
|
||||
(line_comment)
|
||||
] @comment
|
||||
Reference in New Issue
Block a user