[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode d8501770f6 103/222: Fix indentation of mul
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode d8501770f6 103/222: Fix indentation of multiple curly braces in sequence. |
Date: |
Sun, 6 Feb 2022 16:59:22 -0500 (EST) |
branch: elpa/typescript-mode
commit d8501770f6ebd50bbbaada2c65b19c85564c1d1e
Author: Louis-Dominique Dubeau <ldd@lddubeau.com>
Commit: Louis-Dominique Dubeau <ldd@lddubeau.com>
Fix indentation of multiple curly braces in sequence.
---
test-files/indentation-reference-document.ts | 6 ++++++
typescript-mode.el | 22 ++++++++++++++++++----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/test-files/indentation-reference-document.ts
b/test-files/indentation-reference-document.ts
index fe06883a14..07ede0318f 100644
--- a/test-files/indentation-reference-document.ts
+++ b/test-files/indentation-reference-document.ts
@@ -489,3 +489,9 @@ function foo14(something: string,
const a =
1; // Blah
const b = 2;
+
+function blipblop(): void {
+ {
+ const q = 1;
+ }
+}
diff --git a/typescript-mode.el b/typescript-mode.el
index 12bd16e79c..93da60b2c1 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2217,14 +2217,28 @@ moved on success."
((nth 1 parse-status)
(let ((same-indent-p (looking-at "[]})]"))
(switch-keyword-p (looking-at
"\\_<default\\_>\\|\\_<case\\_>[^:]"))
- (continued-expr-p (typescript--continued-expression-p)))
- (goto-char (nth 1 parse-status))
+ (continued-expr-p (typescript--continued-expression-p))
+ (list-start (nth 1 parse-status)))
+ (goto-char list-start)
(if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")
(progn
(skip-syntax-backward " ")
- (when (or (typescript--backward-to-parameter-list)
- (eq (char-before) ?\)))
+ (cond
+ ((or (typescript--backward-to-parameter-list)
+ (eq (char-before) ?\)))
+ ;; Take the curly brace as marking off the body of a
function.
+ ;; In that case, we want the code that follows to see the
indentation
+ ;; that was in effect at the beginning of the function
declaration, and thus
+ ;; we want to move back over the list of function
parameters.
(backward-list))
+ ((looking-back "," nil)
+ ;; If we get here, we have a comma, spaces and an opening
curly brace. (And
+ ;; (point) is just after the comma.) We don't want to
move from the current position
+ ;; so that object literals in parameter lists are
properly indented.
+ nil)
+ (t
+ ;; In all other cases, we don't want to move from the
curly brace.
+ (goto-char list-start)))
(back-to-indentation)
(let* ((in-switch-p (unless same-indent-p
(looking-at "\\_<switch\\_>")))
- [nongnu] elpa/typescript-mode 4249a20d6d 187/222: Added file for indent test case, (continued)
- [nongnu] elpa/typescript-mode 4249a20d6d 187/222: Added file for indent test case, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode c5e7788ce9 044/222: Merge pull request #28 from ananthakumaran/testing, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 99c2b74ac3 059/222: Make current-column function internal., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 89d22c4e18 051/222: Don't interpret forward slash in list as operator., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 393ac6db0f 081/222: add tests for regexp font locking, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 361564c4a9 057/222: typescript-current-column: Dont cause side-effects., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode d155a4b623 063/222: Revert indent of complex parameters., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode e0b4a6cb31 055/222: Merge pull request #36 from lddubeau/feature/improved-tslint-regex, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode bce2e73cf2 107/222: Remove unused dependencies, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 7172a23d86 072/222: Add a custom predicate for flyspell-prog-mode., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode d8501770f6 103/222: Fix indentation of multiple curly braces in sequence.,
ELPA Syncer <=
- [nongnu] elpa/typescript-mode a09e9c78f9 108/222: Highlight class names., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 7c6fd0f4a8 115/222: Document how to handle ANSI codes in error messages., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 9796425fdb 113/222: Add support for new type "unknown"., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 39b7ba9e54 117/222: Distinguish type arguments from lesser/greater than. (Fixes #81), ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 30f8b8feb4 122/222: Merge pull request #87 from Ailrun/add-jsdoc-tags, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 29282a32b7 124/222: add never type, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 8910e12525 129/222: Add autoload cookie with safe-local-var for typescript-indent-level, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode fbaad515c9 132/222: Merge pull request #89 from Ailrun/update-jsdoc-tests, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 32146510b8 147/222: Pin our dist to Trusty., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 706f938aef 155/222: force generic regex to include symbol before it (#119), ELPA Syncer, 2022/02/06