[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode a532ef57cf 046/222: Merge pull request #29
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode a532ef57cf 046/222: Merge pull request #29 from lddubeau/fix/method-generator |
Date: |
Sun, 6 Feb 2022 16:59:10 -0500 (EST) |
branch: elpa/typescript-mode
commit a532ef57cf86365fa7ca628faa6f6b14df3737c0
Merge: c5e7788ce9 d29f31c791
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: GitHub <noreply@github.com>
Merge pull request #29 from lddubeau/fix/method-generator
Fix indentation of methods that are generators.
---
test-files/indentation-reference-document.ts | 73 ++++++++++++++++++++++++++++
typescript-mode.el | 13 ++++-
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/test-files/indentation-reference-document.ts
b/test-files/indentation-reference-document.ts
index a6df0e6dc0..36996c5a73 100644
--- a/test-files/indentation-reference-document.ts
+++ b/test-files/indentation-reference-document.ts
@@ -89,4 +89,77 @@ namespace ts.server {
process.on("uncaughtException", function (err: Error) {
ioSession.logError(err, "unknown");
});
+
+ // Generators as methods.
+ class WithAGeneratorFirst {
+ *blah() {
+ }
+ }
+
+ class WithAGeneratorAfterAProperty {
+ public foo: string = "1";
+
+ *blah() {
+ }
+ }
+
+ class WithAGeneratorAfterAnotherMethod {
+ foo() {
+ }
+
+ *blah() {
+ }
+ }
+
+ class WithSpaceAfterAsterisk {
+ bar() {
+ }
+
+ * oops() {
+ }
+ }
+
+
+ class WithSpaceAfterParens {
+ bar() {
+ }
+
+ *oops () {
+ }
+ }
+
+ class WithArguments {
+ bar() {
+ }
+
+ *oops(foo: number, bar: string) {
+ }
+ }
+
+ // Some continued expressions
+ {
+ const a = 1 *
+ 2 /
+ 3 +
+ 4 -
+ 5 %
+ 6;
+
+ const b = 1 >
+ 2;
+
+ const c = 1 <
+ 2;
+
+ const d = 1 &
+ 2 |
+ 3;
+
+ const e = b ?
+ 2 :
+ 3;
+
+ const f = window
+ .document;
+ }
}
diff --git a/typescript-mode.el b/typescript-mode.el
index ba2919decc..8c5f516d56 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -1655,7 +1655,18 @@ See `font-lock-keywords'.")
(or (not (looking-at ":"))
(save-excursion
(and (typescript--re-search-backward "[?:{]\\|\\_<case\\_>" nil
t)
- (looking-at "?")))))))
+ (looking-at "?"))))
+ (not (and
+ (looking-at "*")
+ ;; Generator method (possibly using computed property).
+ (looking-at (concat "\\* *\\(?:\\[\\|" typescript--name-re
+ " *(\\)"))
+ (save-excursion
+ (typescript--backward-syntactic-ws)
+ ;; We might misindent some expressions that would
+ ;; return NaN anyway. Shouldn't be a problem.
+ (memq (char-before) '(?, ?} ?{ ?\;)))))))
+)
(defun typescript--continued-expression-p ()
- [nongnu] elpa/typescript-mode 3b0ace2a71 037/222: Add GPLv3 license file to repo., (continued)
- [nongnu] elpa/typescript-mode 3b0ace2a71 037/222: Add GPLv3 license file to repo., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 9dde78e730 042/222: Add Travis CI build-status to readme., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 7f4bf6cad9 075/222: Highlight function name for exported or declared functions., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 2573266955 086/222: Fix a bug in handling function return type annotations., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode b62f52a35c 009/222: Add let, const, namespace keywords from 1.5, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 976ae69337 003/222: add url, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 514d6f0416 012/222: Add 'async' and 'await' as keywords, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode d27114244a 014/222: added "abstract" keyword, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 54e0c562d4 020/222: removed keyword "bool" which is deprecated since TypeScript 0.9, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode d81cc72782 013/222: Merge pull request #7 from paulkoerbitz/patch-1, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode a532ef57cf 046/222: Merge pull request #29 from lddubeau/fix/method-generator,
ELPA Syncer <=
- [nongnu] elpa/typescript-mode c1a7d40dd8 005/222: highlight template string, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 8fe879a96d 028/222: Support 'of' keyword., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode ca510ab853 048/222: Merge pull request #30 from lddubeau/fix/keyword-members, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode a2c2ff03e7 024/222: Add support for compilation-mode., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 7526f138a0 032/222: Avoid capturing things we dont need for compilation-mode., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 666052f09f 033/222: Update readme., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 4235b47a38 060/222: Fix indent for lines which starts with tabs., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 52c08d0628 091/222: Add more fontification tests for regular expressions., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode e25c7ddb8a 062/222: Fix indentation of funcs with return annotations., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 536e4da380 087/222: Fix bug with hanling array shorthand in return value types., ELPA Syncer, 2022/02/06