summaryrefslogtreecommitdiff
path: root/lisp/progmodes/csharp-mode.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-01-01 05:46:24 -0500
committerEli Zaretskii <eliz@gnu.org>2023-01-01 05:46:24 -0500
commit861d3db6343dcd793c54f79a38e0187b4755ee81 (patch)
tree5b126c19f878df430395e1012f1891a7cf46d0a0 /lisp/progmodes/csharp-mode.el
parent7822fcbebd1edba3654eaf5c1113f9d4049e0462 (diff)
parent72a81e20226d2d0745fd2efdbbc80fdfe92b7cde (diff)
downloademacs-861d3db6343dcd793c54f79a38e0187b4755ee81.tar.gz
emacs-861d3db6343dcd793c54f79a38e0187b4755ee81.tar.bz2
emacs-861d3db6343dcd793c54f79a38e0187b4755ee81.zip
Merge from origin/emacs-29
72a81e2022 ; * lisp/treesit.el (treesit-simple-indent-presets): Fix t... ddfeee3e8a Build recipe interactively in treesit-install-language-gra... 6837469780 ; Add REVISION to treesit-language-source-alist 0dc788aa01 ; Remove GRAMMAR-DIR from treesit-language-source-alist f9aef67c36 Tweak csharp-mode font-lock-settings (bug#60376) 46362c0a3a ; * doc/lispref/tips.texi (Documentation Tips): Add indexing. 9a386b682e Revert a recent change which causes errors 9871ee8b14 ; More fixes for documentation of 'defalias' f309651b67 ; Fix handling of 'not' by 'buffer-match-p' 9292f595a7 ; Fix typos 43c7e05a2a Fix misspelled functions in shortdoc groups 01acecc79c Simplify introduction of use-package manual 2a7e072e53 ; Fix documentation of 'defalias' eee2aeca25 Fix python-shell-buffer-substring when retrieving a single... bfdad6c4e5 ; Fix recent treesit-related changes
Diffstat (limited to 'lisp/progmodes/csharp-mode.el')
-rw-r--r--lisp/progmodes/csharp-mode.el53
1 files changed, 32 insertions, 21 deletions
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 33a5f7046f1..4bd5d15fb1b 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -693,24 +693,46 @@ compilation and evaluation time conflicts."
(defvar csharp-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'c-sharp
+ :feature 'expression
+ '((conditional_expression (identifier) @font-lock-variable-name-face)
+ (postfix_unary_expression (identifier)* @font-lock-variable-name-face)
+ (assignment_expression (identifier) @font-lock-variable-name-face))
+
+ :language 'c-sharp
+ :feature 'bracket
+ '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
+
+ :language 'c-sharp
+ :feature 'delimiter
+ '((["," ":" ";"]) @font-lock-delimiter-face)
+
+ :language 'c-sharp
+ :feature 'error
+ '((ERROR) @font-lock-warning-face)
+
+ :language 'c-sharp
:override t
:feature 'comment
- '((comment) @font-lock-comment-face)
+ '((comment) @font-lock-comment-face)
+
:language 'c-sharp
:override t
:feature 'keyword
`([,@csharp-ts-mode--keywords] @font-lock-keyword-face
(modifier) @font-lock-keyword-face
(this_expression) @font-lock-keyword-face)
+
:language 'c-sharp
:override t
- :feature 'attribute
+ :feature 'property
`((attribute (identifier) @font-lock-property-face (attribute_argument_list))
(attribute (identifier) @font-lock-property-face))
+
:language 'c-sharp
:override t
:feature 'escape-sequence
'((escape_sequence) @font-lock-escape-face)
+
:language 'c-sharp
:override t
:feature 'literal
@@ -718,6 +740,7 @@ compilation and evaluation time conflicts."
(real_literal) @font-lock-number-face
(null_literal) @font-lock-constant-face
(boolean_literal) @font-lock-constant-face)
+
:language 'c-sharp
:override t
:feature 'string
@@ -730,6 +753,7 @@ compilation and evaluation time conflicts."
"$\""
"@$\""
"$@\""] @font-lock-string-face)
+
:language 'c-sharp
:override t
:feature 'type
@@ -750,14 +774,14 @@ compilation and evaluation time conflicts."
target: (identifier) @font-lock-type-face)
(type_of_expression (identifier) @font-lock-type-face)
(object_creation_expression (identifier) @font-lock-type-face))
+
:language 'c-sharp
:feature 'definition
:override t
'((qualified_name (identifier) @font-lock-type-face)
(using_directive (identifier) @font-lock-type-face)
(using_directive (name_equals
- (identifier) @font-lock-type-face
- ["="] @default-face))
+ (identifier) @font-lock-type-face))
(enum_declaration (identifier) @font-lock-type-face)
(enum_member_declaration (identifier) @font-lock-variable-name-face)
@@ -820,24 +844,11 @@ compilation and evaluation time conflicts."
(binary_expression (identifier) @font-lock-variable-name-face)
(argument (identifier) @font-lock-variable-name-face))
- :language 'c-sharp
- :feature 'expression
- '((conditional_expression (identifier) @font-lock-variable-name-face)
- (postfix_unary_expression (identifier)* @font-lock-variable-name-face)
- (assignment_expression (identifier) @font-lock-variable-name-face))
- :language 'c-sharp
- :feature 'bracket
- '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
-
- :language 'c-sharp
- :feature 'delimiter
- '((["," ":" ";"]) @font-lock-delimiter-face)
:language 'c-sharp
:feature 'escape-sequence
:override t
- '((escape_sequence) @font-lock-escape-face
- (ERROR) @font-lock-warning-face)))
+ '((escape_sequence) @font-lock-escape-face)))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
@@ -908,9 +919,9 @@ Key bindings:
(setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'(( comment definition)
- ( keyword string escape-sequence type)
- ( attribute constant expression literal)
- ( bracket delimiter)))
+ ( keyword string type)
+ ( constant escape-sequence expression literal property)
+ ( bracket delimiter error)))
;; Imenu.
(setq-local treesit-simple-imenu-settings