diff --git a/languages/csharp/brackets.scm b/languages/csharp/brackets.scm index 63395f8..861eaa6 100644 --- a/languages/csharp/brackets.scm +++ b/languages/csharp/brackets.scm @@ -1,5 +1,14 @@ -("(" @open ")" @close) -("[" @open "]" @close) -("{" @open "}" @close) -("<" @open ">" @close) -("\"" @open "\"" @close) +("(" @open + ")" @close) + +("[" @open + "]" @close) + +("{" @open + "}" @close) + +("<" @open + ">" @close) + +("\"" @open + "\"" @close) diff --git a/languages/csharp/highlights.scm b/languages/csharp/highlights.scm index 3b9c117..c47b285 100644 --- a/languages/csharp/highlights.scm +++ b/languages/csharp/highlights.scm @@ -1,42 +1,72 @@ (identifier) @variable -;; Methods +; Methods +(method_declaration + name: (identifier) @function) -(method_declaration name: (identifier) @function) -(_ function: (identifier) @function) -(local_function_statement name: (identifier) @function) +(_ + function: (identifier) @function) -;; Types +(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) -(interface_declaration name: (identifier) @type) -(class_declaration name: (identifier) @type) -(enum_declaration name: (identifier) @type) -(struct_declaration (identifier) @type) -(record_declaration (identifier) @type) ; TODO: Let this be @module again once we support fallbacks -(namespace_declaration name: (identifier) @type) +(namespace_declaration + name: (identifier) @type) -(generic_name (identifier) @type) -(type_parameter (identifier) @property.definition) -(parameter type: (identifier) @type) -(type_argument_list (identifier) @type) -(as_expression right: (identifier) @type) -(is_expression right: (identifier) @type) +(generic_name + (identifier) @type) -(constructor_declaration name: (identifier) @constructor) -(destructor_declaration name: (identifier) @constructor) +(type_parameter + (identifier) @property.definition) -(_ type: (identifier) @type) +(parameter + type: (identifier) @type) -(base_list (identifier) @type) +(type_argument_list + (identifier) @type) -(predefined_type) @type.builtin +(as_expression + right: (identifier) @type) + +(is_expression + right: (identifier) @type) + +(constructor_declaration + name: (identifier) @constructor) + +(destructor_declaration + name: (identifier) @constructor) -;; Enum -(enum_member_declaration (identifier) @property.definition) +(_ + type: (identifier) @type) -;; Literals +(base_list + (identifier) @type) +(predefined_type) @type.builtin + +; Enum +(enum_member_declaration + (identifier) @property.definition) + +; Literals [ (real_literal) (integer_literal) @@ -50,7 +80,7 @@ (interpolated_string_expression) (interpolation_start) (interpolation_quote) - ] @string +] @string (escape_sequence) @string.escape @@ -59,12 +89,10 @@ (null_literal) ] @constant.builtin -;; Comments - +; Comments (comment) @comment -;; Tokens - +; Tokens [ ";" "." @@ -122,10 +150,9 @@ "{" "}" (interpolation_brace) -] @punctuation.bracket - -;; Keywords +] @punctuation.bracket +; Keywords [ (modifier) "this" @@ -196,19 +223,19 @@ "let" ] @keyword -;; Attribute - -(attribute name: (identifier) @attribute) - -;; Parameters +; Attribute +(attribute + name: (identifier) @attribute) +; Parameters (parameter name: (identifier) @variable.parameter) -;; Type constraints - -(type_parameter_constraints_clause (identifier) @property.definition) - -;; Method calls +; Type constraints +(type_parameter_constraints_clause + (identifier) @property.definition) -(invocation_expression (member_access_expression name: (identifier) @function)) +; Method calls +(invocation_expression + (member_access_expression + name: (identifier) @function)) diff --git a/languages/csharp/indents.scm b/languages/csharp/indents.scm index acb44a5..c096b82 100644 --- a/languages/csharp/indents.scm +++ b/languages/csharp/indents.scm @@ -1,3 +1,11 @@ -(_ "{" "}" @end) @indent -(_ "[" "]" @end) @indent -(_ "(" ")" @end) @indent +(_ + "{" + "}" @end) @indent + +(_ + "[" + "]" @end) @indent + +(_ + "(" + ")" @end) @indent diff --git a/languages/csharp/outline.scm b/languages/csharp/outline.scm index aed899b..a5fe02b 100644 --- a/languages/csharp/outline.scm +++ b/languages/csharp/outline.scm @@ -1,38 +1,30 @@ (class_declaration - "class" @context - name: (identifier) @name -) @item + "class" @context + name: (identifier) @name) @item (constructor_declaration - name: (identifier) @name -) @item + name: (identifier) @name) @item (property_declaration - type: (identifier)? @context - type: (predefined_type)? @context - name: (identifier) @name -) @item + type: (identifier)? @context + type: (predefined_type)? @context + name: (identifier) @name) @item (field_declaration - (variable_declaration) @context -) @item + (variable_declaration) @context) @item (method_declaration - name: (identifier) @name - parameters: (parameter_list) @context -) @item + name: (identifier) @name + parameters: (parameter_list) @context) @item (enum_declaration - "enum" @context - name: (identifier) @name -) @item + "enum" @context + name: (identifier) @name) @item (namespace_declaration - "namespace" @context - name: (qualified_name) @name -) @item + "namespace" @context + name: (qualified_name) @name) @item (interface_declaration - "interface" @context - name: (identifier) @name -) @item + "interface" @context + name: (identifier) @name) @item diff --git a/languages/csharp/textobjects.scm b/languages/csharp/textobjects.scm index 2285817..92b9e98 100644 --- a/languages/csharp/textobjects.scm +++ b/languages/csharp/textobjects.scm @@ -1,18 +1,26 @@ -;; Join up all the comments -(comment)+ @comment.around - -;; Standard methods -(method_declaration - body: (_ "{" (_)* @function.inside "}")) @function.around - -;; Standard classes -(class_declaration - body: (_ "{" (_)* @class.inside "}")) @class.around - -;; Interface declarations -(method_declaration) @function.around - -;; Lambda expressions -(lambda_expression - body: (_ "{"? (_)* @function.inside "}"? ) -) @function.around +; Join up all the comments +(comment)+ @comment.around + +; Standard methods +(method_declaration + body: (_ + "{" + (_)* @function.inside + "}")) @function.around + +; Standard classes +(class_declaration + body: (_ + "{" + (_)* @class.inside + "}")) @class.around + +; Interface declarations +(method_declaration) @function.around + +; Lambda expressions +(lambda_expression + body: (_ + "{"? + (_)* @function.inside + "}"?)) @function.around