From: Jostein Kjønigsen Date: Tue, 14 Feb 2023 19:04:19 +0000 (+0100) Subject: csharp-ts-mode: fontify compiler directives (bug#61512) X-Git-Tag: emacs-29.0.90~426^2~20 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d97a3839967;p=emacs.git csharp-ts-mode: fontify compiler directives (bug#61512) lisp/progmodes/csharp-mode.el: Add tree-sitter-queries for known C# compiler-directives. --- diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 852e893dc25..b6b842d7fd4 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -862,7 +862,30 @@ compilation and evaluation time conflicts." :language 'c-sharp :feature 'escape-sequence :override t - '((escape_sequence) @font-lock-escape-face))) + '((escape_sequence) @font-lock-escape-face) + + :language 'c-sharp + :feature 'directives + :override t + '((if_directive + "if" @font-lock-preprocessor-face + (identifier) @font-lock-variable-name-face) + (elif_directive + "elif" @font-lock-preprocessor-face + (identifier) @font-lock-variable-name-face) + (else_directive) @font-lock-preprocessor-face + (endif_directive) @font-lock-preprocessor-face + (define_directive + "define" @font-lock-preprocessor-face + (identifier) @font-lock-variable-name-face) + (nullable_directive) @font-lock-preprocessor-face + (pragma_directive) @font-lock-preprocessor-face + (region_directive) @font-lock-preprocessor-face + (endregion_directive) @font-lock-preprocessor-face + (region_directive + (preproc_message) @font-lock-variable-name-face) + (endregion_directive + (preproc_message) @font-lock-variable-name-face)))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)) @@ -925,7 +948,7 @@ 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 type) + ( keyword string type directives) ( constant escape-sequence expression literal property) ( function bracket delimiter error)))