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,13 @@
|
||||
name = "CSharp"
|
||||
grammar = "c_sharp"
|
||||
path_suffixes = ["cs"]
|
||||
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 = false, not_in = ["string"] },
|
||||
{ start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
|
||||
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
|
||||
]
|
||||
@@ -0,0 +1,254 @@
|
||||
;; Methods
|
||||
(method_declaration name: (identifier) @function)
|
||||
(local_function_statement name: (identifier) @function)
|
||||
|
||||
;; Types
|
||||
(interface_declaration name: (identifier) @type)
|
||||
(class_declaration name: (identifier) @type)
|
||||
(enum_declaration name: (identifier) @type)
|
||||
(struct_declaration (identifier) @type)
|
||||
(record_declaration (identifier) @type)
|
||||
(record_struct_declaration (identifier) @type)
|
||||
(namespace_declaration name: (identifier) @type)
|
||||
|
||||
(constructor_declaration name: (identifier) @constructor)
|
||||
(destructor_declaration name: (identifier) @constructor)
|
||||
|
||||
[
|
||||
(implicit_type)
|
||||
(predefined_type)
|
||||
] @type.builtin
|
||||
|
||||
(_ type: (identifier) @type)
|
||||
|
||||
;; Enum
|
||||
(enum_member_declaration (identifier) @property)
|
||||
|
||||
;; Literals
|
||||
[
|
||||
(real_literal)
|
||||
(integer_literal)
|
||||
] @number
|
||||
|
||||
[
|
||||
(character_literal)
|
||||
(string_literal)
|
||||
(verbatim_string_literal)
|
||||
(interpolated_string_text)
|
||||
(interpolated_verbatim_string_text)
|
||||
"\""
|
||||
"$\""
|
||||
"@$\""
|
||||
"$@\""
|
||||
] @string
|
||||
|
||||
[
|
||||
(boolean_literal)
|
||||
(null_literal)
|
||||
] @constant
|
||||
|
||||
;; Comments
|
||||
(comment) @comment
|
||||
|
||||
;; Tokens
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"--"
|
||||
"-"
|
||||
"-="
|
||||
"&"
|
||||
"&="
|
||||
"&&"
|
||||
"+"
|
||||
"++"
|
||||
"+="
|
||||
"<"
|
||||
"<="
|
||||
"<<"
|
||||
"<<="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"=>"
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
">>>"
|
||||
">>>="
|
||||
"|"
|
||||
"|="
|
||||
"||"
|
||||
"?"
|
||||
"??"
|
||||
"??="
|
||||
"^"
|
||||
"^="
|
||||
"~"
|
||||
"*"
|
||||
"*="
|
||||
"/"
|
||||
"/="
|
||||
"%"
|
||||
"%="
|
||||
":"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
;; Keywords
|
||||
(modifier) @keyword
|
||||
(this_expression) @keyword
|
||||
(escape_sequence) @keyword
|
||||
|
||||
[
|
||||
"add"
|
||||
"alias"
|
||||
"as"
|
||||
"base"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"checked"
|
||||
"class"
|
||||
"continue"
|
||||
"default"
|
||||
"delegate"
|
||||
"do"
|
||||
"else"
|
||||
"enum"
|
||||
"event"
|
||||
"explicit"
|
||||
"extern"
|
||||
"finally"
|
||||
"for"
|
||||
"foreach"
|
||||
"global"
|
||||
"goto"
|
||||
"if"
|
||||
"implicit"
|
||||
"interface"
|
||||
"is"
|
||||
"lock"
|
||||
"namespace"
|
||||
"notnull"
|
||||
"operator"
|
||||
"params"
|
||||
"return"
|
||||
"remove"
|
||||
"sizeof"
|
||||
"stackalloc"
|
||||
"static"
|
||||
"struct"
|
||||
"switch"
|
||||
"throw"
|
||||
"try"
|
||||
"typeof"
|
||||
"unchecked"
|
||||
"using"
|
||||
"while"
|
||||
"new"
|
||||
"await"
|
||||
"in"
|
||||
"yield"
|
||||
"get"
|
||||
"set"
|
||||
"when"
|
||||
"out"
|
||||
"ref"
|
||||
"from"
|
||||
"where"
|
||||
"select"
|
||||
"record"
|
||||
"init"
|
||||
"with"
|
||||
"let"
|
||||
] @keyword
|
||||
|
||||
|
||||
;; Linq
|
||||
(from_clause (identifier) @variable)
|
||||
(group_clause (identifier) @variable)
|
||||
(order_by_clause (identifier) @variable)
|
||||
(join_clause (identifier) @variable)
|
||||
(select_clause (identifier) @variable)
|
||||
(query_continuation (identifier) @variable) @keyword
|
||||
|
||||
;; Record
|
||||
(with_expression
|
||||
(with_initializer_expression
|
||||
(simple_assignment_expression
|
||||
(identifier) @variable)))
|
||||
|
||||
;; Exprs
|
||||
(binary_expression (identifier) @variable (identifier) @variable)
|
||||
(binary_expression (identifier)* @variable)
|
||||
(conditional_expression (identifier) @variable)
|
||||
(prefix_unary_expression (identifier) @variable)
|
||||
(postfix_unary_expression (identifier)* @variable)
|
||||
(assignment_expression (identifier) @variable)
|
||||
(cast_expression (_) (identifier) @variable)
|
||||
|
||||
;; Class
|
||||
(base_list (identifier) @type) ;; applies to record_base too
|
||||
(property_declaration (generic_name))
|
||||
(property_declaration
|
||||
name: (identifier) @variable)
|
||||
(property_declaration
|
||||
name: (identifier) @variable)
|
||||
(property_declaration
|
||||
name: (identifier) @variable)
|
||||
|
||||
;; Lambda
|
||||
(lambda_expression) @variable
|
||||
|
||||
;; Attribute
|
||||
(attribute) @attribute
|
||||
|
||||
;; Parameter
|
||||
(parameter
|
||||
name: (identifier) @variable)
|
||||
(parameter (identifier) @variable)
|
||||
(parameter_modifier) @keyword
|
||||
|
||||
;; Variable declarations
|
||||
(variable_declarator (identifier) @variable)
|
||||
(for_each_statement left: (identifier) @variable)
|
||||
(catch_declaration (_) (identifier) @variable)
|
||||
|
||||
;; Return
|
||||
(return_statement (identifier) @variable)
|
||||
(yield_statement (identifier) @variable)
|
||||
|
||||
;; Type
|
||||
(generic_name (identifier) @type)
|
||||
(type_parameter (identifier) @property)
|
||||
(type_argument_list (identifier) @type)
|
||||
(as_expression right: (identifier) @type)
|
||||
(is_expression right: (identifier) @type)
|
||||
|
||||
;; Type constraints
|
||||
(type_parameter_constraints_clause (identifier) @property)
|
||||
|
||||
;; Switch
|
||||
(switch_statement (identifier) @variable)
|
||||
(switch_expression (identifier) @variable)
|
||||
|
||||
;; Lock statement
|
||||
(lock_statement (identifier) @variable)
|
||||
|
||||
;; Method calls
|
||||
(invocation_expression (member_access_expression name: (identifier) @function))
|
||||
@@ -0,0 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
@@ -0,0 +1,38 @@
|
||||
(class_declaration
|
||||
"class" @context
|
||||
name: (identifier) @name
|
||||
) @item
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @name
|
||||
) @item
|
||||
|
||||
(property_declaration
|
||||
type: (identifier)? @context
|
||||
type: (predefined_type)? @context
|
||||
name: (identifier) @name
|
||||
) @item
|
||||
|
||||
(field_declaration
|
||||
(variable_declaration) @context
|
||||
) @item
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @name
|
||||
parameters: (parameter_list) @context
|
||||
) @item
|
||||
|
||||
(enum_declaration
|
||||
"enum" @context
|
||||
name: (identifier) @name
|
||||
) @item
|
||||
|
||||
(namespace_declaration
|
||||
"namespace" @context
|
||||
name: (qualified_name) @name
|
||||
) @item
|
||||
|
||||
(interface_declaration
|
||||
"interface" @context
|
||||
name: (identifier) @name
|
||||
) @item
|
||||
Reference in New Issue
Block a user