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 = "Lua"
|
||||
grammar = "lua"
|
||||
path_suffixes = ["lua"]
|
||||
line_comments = ["-- "]
|
||||
autoclose_before = ",]}"
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] },
|
||||
]
|
||||
collapsed_placeholder = "--[ ... ]--"
|
||||
@@ -0,0 +1,10 @@
|
||||
(
|
||||
(comment)* @context
|
||||
.
|
||||
(function_declaration
|
||||
"function" @name
|
||||
name: (_) @name
|
||||
(comment)* @collapse
|
||||
body: (block) @collapse
|
||||
) @item
|
||||
)
|
||||
@@ -0,0 +1,198 @@
|
||||
;; Keywords
|
||||
|
||||
"return" @keyword
|
||||
|
||||
[
|
||||
"goto"
|
||||
"in"
|
||||
"local"
|
||||
] @keyword
|
||||
|
||||
(break_statement) @keyword
|
||||
|
||||
(do_statement
|
||||
[
|
||||
"do"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(while_statement
|
||||
[
|
||||
"while"
|
||||
"do"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(repeat_statement
|
||||
[
|
||||
"repeat"
|
||||
"until"
|
||||
] @keyword)
|
||||
|
||||
(if_statement
|
||||
[
|
||||
"if"
|
||||
"elseif"
|
||||
"else"
|
||||
"then"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(elseif_statement
|
||||
[
|
||||
"elseif"
|
||||
"then"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(else_statement
|
||||
[
|
||||
"else"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(for_statement
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(function_declaration
|
||||
[
|
||||
"function"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(function_definition
|
||||
[
|
||||
"function"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
;; Operators
|
||||
|
||||
[
|
||||
"and"
|
||||
"not"
|
||||
"or"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"^"
|
||||
"#"
|
||||
"=="
|
||||
"~="
|
||||
"<="
|
||||
">="
|
||||
"<"
|
||||
">"
|
||||
"="
|
||||
"&"
|
||||
"~"
|
||||
"|"
|
||||
"<<"
|
||||
">>"
|
||||
"//"
|
||||
".."
|
||||
] @operator
|
||||
|
||||
;; Punctuations
|
||||
|
||||
[
|
||||
";"
|
||||
":"
|
||||
","
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
;; Brackets
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
;; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @variable.special
|
||||
(#eq? @variable.special "self"))
|
||||
|
||||
(variable_list
|
||||
attribute: (attribute
|
||||
(["<" ">"] @punctuation.bracket
|
||||
(identifier) @attribute)))
|
||||
|
||||
;; Constants
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
(vararg_expression) @constant
|
||||
|
||||
(nil) @constant.builtin
|
||||
|
||||
[
|
||||
(false)
|
||||
(true)
|
||||
] @boolean
|
||||
|
||||
;; Tables
|
||||
|
||||
(field name: (identifier) @field)
|
||||
|
||||
(dot_index_expression field: (identifier) @field)
|
||||
|
||||
(table_constructor
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @constructor)
|
||||
|
||||
;; Functions
|
||||
|
||||
(parameters (identifier) @parameter)
|
||||
|
||||
(function_call
|
||||
name: [
|
||||
(identifier) @function
|
||||
(dot_index_expression field: (identifier) @function)
|
||||
])
|
||||
|
||||
(function_declaration
|
||||
name: [
|
||||
(identifier) @function.definition
|
||||
(dot_index_expression field: (identifier) @function.definition)
|
||||
])
|
||||
|
||||
(method_index_expression method: (identifier) @method)
|
||||
|
||||
(function_call
|
||||
(identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
;; built-in functions in Lua 5.1
|
||||
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
|
||||
"load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
|
||||
"rawequal" "rawget" "rawset" "require" "select" "setfenv" "setmetatable"
|
||||
"tonumber" "tostring" "type" "unpack" "xpcall"))
|
||||
|
||||
;; Others
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(hash_bang_line) @preproc
|
||||
|
||||
(number) @number
|
||||
|
||||
(string) @string
|
||||
@@ -0,0 +1,10 @@
|
||||
(if_statement "end" @end) @indent
|
||||
(do_statement "end" @end) @indent
|
||||
(while_statement "end" @end) @indent
|
||||
(for_statement "end" @end) @indent
|
||||
(repeat_statement "until" @end) @indent
|
||||
(function_declaration "end" @end) @indent
|
||||
|
||||
(_ "[" "]" @end) @indent
|
||||
(_ "{" "}" @end) @indent
|
||||
(_ "(" ")" @end) @indent
|
||||
@@ -0,0 +1,3 @@
|
||||
(function_declaration
|
||||
"function" @context
|
||||
name: (_) @name) @item
|
||||
Reference in New Issue
Block a user