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:
Piotr Osiewicz
2024-02-23 15:56:08 +01:00
committed by GitHub
parent 7cf0696c89
commit 0f584cb353
309 changed files with 221 additions and 154 deletions
+3
View File
@@ -0,0 +1,3 @@
("(" @open ")" @close)
("[" @open "]" @close)
("{" @open "}" @close)
+11
View File
@@ -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 },
]
+16
View File
@@ -0,0 +1,16 @@
[
(Block)
(ContainerDecl)
(SwitchExpr)
(InitList)
(AsmExpr)
(ErrorSetDecl)
(LINESTRING)
(
[
(IfPrefix)
(WhilePrefix)
(ForPrefix)
]
)
] @fold
+230
View File
@@ -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
+22
View File
@@ -0,0 +1,22 @@
[
(Block)
(ContainerDecl)
(SwitchExpr)
(InitList)
] @indent.begin
[
"("
")"
"["
"]"
"{"
"}"
] @indent.branch
[
(line_comment)
(container_doc_comment)
(doc_comment)
(LINESTRING)
] @indent.ignore
+5
View File
@@ -0,0 +1,5 @@
[
(container_doc_comment)
(doc_comment)
(line_comment)
] @comment