Created
July 23, 2025 21:19
-
-
Save DinoChiesa/2bf2a500e46b53a30f17162bb525a4b7 to your computer and use it in GitHub Desktop.
Emacs - Adjust csharp-ts-mode indentation rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(eval-after-load "csharp-mode" | |
'(progn | |
;; Adjustments for indentation. | |
;; This one is for the open curly for the using statement. | |
;; (The using _directive_ (for import at top of file) is different.) | |
(setf (cdr (car csharp-ts-mode--indent-rules)) | |
(cons | |
'((parent-is "using_statement") parent-bol 0) | |
(cdr (car csharp-ts-mode--indent-rules)))) | |
;; This rule is for the opening curly brace on anonymous lambdas, when the | |
;; open curly is on a new line. | |
(setf (cdr (car csharp-ts-mode--indent-rules)) | |
(cons | |
'((parent-is "lambda_expression") parent-bol 0) | |
(cdr (car csharp-ts-mode--indent-rules)))) | |
(setq-local treesit-simple-indent-rules csharp-ts-mode--indent-rules) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment