[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode e30ed5e 393/459: Indent feature parity with
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode e30ed5e 393/459: Indent feature parity with previous implementation |
Date: |
Sun, 22 Aug 2021 14:00:08 -0400 (EDT) |
branch: externals/csharp-mode
commit e30ed5e8b0ad66701cb30eab0bf796aa9201edc3
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>
Indent feature parity with previous implementation
---
csharp-mode.el | 83 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 42 insertions(+), 41 deletions(-)
diff --git a/csharp-mode.el b/csharp-mode.el
index 93a046d..80bc80e 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -148,7 +148,7 @@
(add-to-list 'compilation-error-regexp-alist-alist regexp)
(add-to-list 'compilation-error-regexp-alist (car regexp)))))
-(defcustom csharp-indent-offset 4
+(defcustom csharp-mode-indent-offset 4
"Indent offset for csharp-mode"
:type 'number
:group 'csharp)
@@ -174,46 +174,47 @@
Key bindings:
\\{csharp-mode-map}"
:group 'csharp
- (setq tree-sitter-indent-csharp-scopes
- '((indent-all . ;; these nodes are always indented
- (anonymous_object_creation_expression
- switch_body
- switch_section))
- (indent-rest . ;; if parent node is one of these and node is not
first → indent
- (namespace_declaration
- using_statement
- class_declaration
- struct_declaration
- method_declaration
- object_creation_expression
- array_creation_expression
- lambda_expression
- local_function_statement
- enum_declaration
- for_each_statement
- if_statement
- try_statement))
- (indent-body . ;; if parent node is one of these and current node is
in middle → indent
- ())
-
- (paren-indent . ;; if parent node is one of these → indent to paren
opener
- ())
- (align-char-to . ;; chaining char → node types we move parentwise to
find the first chaining char
- ())
- (aligned-siblings . ;; siblings (nodes with same parent) should be
aligned to the first child
- (parameter))
-
- (multi-line-text . ;; if node is one of these, then don't modify the
indent
- ;; this is basically a peaceful way out by saying
"this looks like something
- ;; that cannot be indented using AST, so best I
leave it as-is"
- (comment preprocessor_call label_name))
- (outdent . ;; these nodes always outdent (1 shift in opposite
direction)
- ("}"))
- )
- )
- (when (boundp 'electric-indent-inhibit)
- (setq electric-indent-inhibit t))
- (setq-local indent-line-function #'tree-sitter-indent-line-and-debug)
+ (setq-local tree-sitter-indent-offset csharp-mode-indent-offset)
+ (setq-local tree-sitter-indent-current-scopes
+ '((indent-all . ;; these nodes are always indented
+ (accessor_declaration
+ break_statement
+ "."))
+ (indent-rest . ;; if parent node is one of these and node is
not first → indent
+ (
+ switch_section
+ ))
+ (indent-body . ;; if parent node is one of these and current
node is in middle → indent
+ (block
+ anonymous_object_creation_expression
+ enum_member_declaration_list
+ initializer_expression
+ expression_statement
+ declaration_list
+ switch_body))
+
+ (paren-indent . ;; if parent node is one of these → indent to
paren opener
+ ())
+ (align-char-to . ;; chaining char → node types we move
parentwise to find the first chaining char
+ ())
+ (aligned-siblings . ;; siblings (nodes with same parent)
should be aligned to the first child
+ (parameter))
+
+ (multi-line-text . ;; if node is one of these, then don't
modify the indent
+ ;; this is basically a peaceful way out by
saying "this looks like something
+ ;; that cannot be indented using AST, so best
I leave it as-is"
+ (comment
+ preprocessor_call
+ labeled_statement))
+ (outdent . ;; these nodes always outdent (1 shift in opposite
direction)
+ (;; "}"
+ case_switch_label
+ ))
+ )
+ )
+ ;; (when (boundp 'electric-indent-inhibit)
+ ;; (setq electric-indent-inhibit t))
+ (setq-local indent-line-function #'tree-sitter-indent-line)
;; https://github.com/ubolonton/emacs-tree-sitter/issues/84
(unless font-lock-defaults
- [elpa] externals/csharp-mode 9f36ad6 361/459: RIP Travis, (continued)
- [elpa] externals/csharp-mode 9f36ad6 361/459: RIP Travis, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 48b11cf 366/459: Fix issues with non-nested using-statements., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 064a3a3 368/459: Fix detection of xUnit test-failures in compilation-mode, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 4aedd56 372/459: More basic highlighting, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 383f020 375/459: Attributes and more interpolation, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 1bd2d62 377/459: Make attribute-fontification consistent, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0ebd21a 381/459: Remove CC Mode and add tree-sitter-indent :O, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b6b7661 380/459: Add this expression, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5374fe3 382/459: Add some indent rules, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 878c671 390/459: Try add better support for interfaces., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode e30ed5e 393/459: Indent feature parity with previous implementation,
ELPA Syncer <=
- [elpa] externals/csharp-mode 45d1e9f 395/459: These are passing again, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5a3d4a9 396/459: More indentation fixes, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0b1df32 398/459: Add tree-sitter as optional feature, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f0b5efa 403/459: Use code with same arrangement as before rework, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 53fa8f1 404/459: Use dedicated major mode for tree-sitter, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ea1718e 405/459: Use defvar instead of defcustom for indentation rules, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5ddb761 406/459: Fix url and indentation., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 76bbf26 408/459: Merge pull request #206 from jcs-PR/minor, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f937426 409/459: Merge branch 'master' into tree-sitter, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3cff337 411/459: Merge pull request #204 from emacs-csharp/tree-sitter, ELPA Syncer, 2021/08/22