Skip to content

Minor fix after version 0.11.0 #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions csharp-tree-sitter.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
;;; Code:
(require 'cl-lib)
(require 'seq)

(require 'tree-sitter)
(require 'tree-sitter-hl)
(require 'tree-sitter-indent)

(defvar cshaerp-mode-syntax-table)
(defvar csharp-mode-map)

;;; Tree-sitter

(defvar-local csharp-mode-tree-sitter-patterns
Expand Down Expand Up @@ -109,18 +113,18 @@
(local_function_statement (nullable_type) @type (identifier) @function)
(local_function_statement (void_keyword) @type (identifier) @function)
(local_function_statement (generic_name) (identifier) @function)

;; Parameter
(parameter
type: (identifier) @type
name: (identifier) @variable)
(parameter (identifier) @variable)

;; Array
(array_rank_specifier (identifier) @variable)
(array_rank_specifier (identifier) @variable)
(array_type (identifier) @type)
(array_creation_expression)

;; Attribute
(attribute (identifier) @variable (attribute_argument_list))
(attribute (identifier) @variable)
Expand All @@ -140,7 +144,7 @@
;; Return
(return_statement (identifier) @variable)
(yield_statement (identifier) @variable)

;; Type
(type_parameter
(identifier) @type)
Expand All @@ -162,7 +166,7 @@
(type_of_expression (identifier) @variable)
(assignment_expression (identifier) @variable)
(cast_expression (identifier) @type)

;; Preprocessor
(preprocessor_directive) @constant
(preprocessor_call (identifier) @string)
Expand All @@ -179,10 +183,10 @@
;; Switch
(switch_statement (identifier) @variable)
(switch_expression (identifier) @variable)

;; If
(if_statement (identifier) @variable)

;; Declaration expression
(declaration_expression (implicit_type) (identifier) @variable)

Expand Down Expand Up @@ -284,7 +288,8 @@ Key bindings:
(tree-sitter-hl-mode))

;;;###autoload
(add-to-list 'tree-sitter-major-mode-language-alist '(csharp-tree-sitter-mode . c-sharp))
(with-eval-after-load 'tree-sitter
(add-to-list 'tree-sitter-major-mode-language-alist '(csharp-tree-sitter-mode . c-sharp)))

(provide 'csharp-tree-sitter)

Expand Down