[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode d155a4b623 063/222: Revert indent of compl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode d155a4b623 063/222: Revert indent of complex parameters. |
Date: |
Sun, 6 Feb 2022 16:59:16 -0500 (EST) |
branch: elpa/typescript-mode
commit d155a4b6238d40400acbbd84c6cc7fd3c5e21b16
Author: Louis-Dominique Dubeau <ldd@lddubeau.com>
Commit: Louis-Dominique Dubeau <ldd@lddubeau.com>
Revert indent of complex parameters.
This reverts a change that was introduced by previous commits in how
functions (arrow or regular), objects and arrays appearing as
parameters are indented.
---
test-files/indentation-reference-document.ts | 48 ++++++++++++++++------------
typescript-mode.el | 34 +-------------------
2 files changed, 29 insertions(+), 53 deletions(-)
diff --git a/test-files/indentation-reference-document.ts
b/test-files/indentation-reference-document.ts
index 7a6ee48680..d6e3124f0f 100644
--- a/test-files/indentation-reference-document.ts
+++ b/test-files/indentation-reference-document.ts
@@ -312,15 +312,15 @@ function foo7b(a: string,
function foo8(): void {
// Arrow function in first parameter.
foo7((a: string): Array<number> => {
- return [1];
- },
+ return [1];
+ },
1);
// Arrow function in first parameter, line break in parameters.
foo7((a: string,
b: string): Array<number> => {
- return [1];
- },
+ return [1];
+ },
1);
// Arrow function in second parameter.
@@ -350,21 +350,21 @@ const foo10 = (a: string, b: string): Array<number> => {
// Arrow function assignment, parenthesized.
const foo11 = ((a: string, b: string): Array<number> => {
- return [1];
- });
+ return [1];
+});
function foo12(): void {
// Function in first parameter.
foo7(function (a: string): Array<number> {
- return [1];
- },
+ return [1];
+ },
1);
// Function in first parameter, line break in parameters.
foo7(function (a: string,
b: string): Array<number> {
- return [1];
- },
+ return [1];
+ },
1);
// Arrow function in second parameter.
@@ -384,15 +384,15 @@ function foo12(): void {
// Function in first parameter.
foo7(function _mip(a: string): Array<number> {
- return [1];
- },
+ return [1];
+ },
1);
// Function in first parameter, line break in parameters.
foo7(function _mip(a: string,
b: string): Array<number> {
- return [1];
- },
+ return [1];
+ },
1);
// Arrow function in second parameter.
@@ -412,15 +412,15 @@ function foo12(): void {
// Function in first parameter.
foo7(function *(a: string): Array<number> {
- return [1];
- },
+ return [1];
+ },
1);
// Function in first parameter, line break in parameters.
foo7(function *(a: string,
b: string): Array<number> {
- return [1];
- },
+ return [1];
+ },
1);
// Arrow function in second parameter.
@@ -440,7 +440,15 @@ function foo12(): void {
// in the 1st or subsequent position of a call.
function smurf(a: {}, b: {}) {}
smurf({
- },
+ a: {},
+ },
{
- });
+ a: {},
+ });
+
+ smurf({
+ a: {},
+ }, {
+ a: {},
+ });
}
diff --git a/typescript-mode.el b/typescript-mode.el
index e69a3db45b..4b091fa64d 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -1863,36 +1863,6 @@ moved on success."
(when location
(goto-char location))))
-(defun typescript--backward-to-function-start ()
- "Search backward for the start of a function and move to it.
-
-This function moves the point to the start of the function and
-returns the point.
-
-The point must already be at the start of the parameter list.
-See `typescript--backward-to-parameter-list' for a function that
-does this. If the point is not at the start of the parameter
-list, this function may return an incorrect result."
- (goto-char
- (or (condition-case nil
- (save-excursion
- (skip-syntax-backward " ")
- (backward-sexp)
- ;; First, check for an anonymous function.
- (or (when (looking-at "function")
- (point))
- ;; Otherwise check if we have a named function.
- (progn
- (skip-syntax-backward " ")
- (backward-sexp)
- (when (looking-at "function")
- (point)))))
- ;; backward-sexp may cause a scan-error if the sexp is
- ;; incomplete.
- (scan-error nil))
- ;; If we get here, what we are looking at is an arrow function.
- (point))))
-
(defun typescript--proper-indentation (parse-status)
"Return the proper indentation for the current line."
(save-excursion
@@ -1919,9 +1889,7 @@ list, this function may return an incorrect result."
;; This allows handling functions in parameter
;; lists. Otherwise, we want to go back to the
;; start of function declaration.
- (when (not (and (typescript--backward-to-function-start)
- (eq (char-before) ?\()))
- (back-to-indentation))
+ (back-to-indentation)
(cond (same-indent-p
(current-column))
(continued-expr-p
- [nongnu] elpa/typescript-mode b44b75dbe1 172/222: Add test case for infinite loop, (continued)
- [nongnu] elpa/typescript-mode b44b75dbe1 172/222: Add test case for infinite loop, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 5bf30fe8d6 175/222: Add member expressions tests involving type parameters., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 1c27fb09ed 220/222: Fix cl deprecation warning, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode dd832751ab 217/222: Merge pull request #156 from zkry/fix-dot-after-exclamation-indentation, ELPA Syncer, 2022/02/06
- [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 <=
- [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, 2022/02/06
- [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