branch: elpa/typescript-mode
commit c9b22f5f338c4efa138a79d551c4cc4a9e9e7826
Merge: 6918f3f6d7 47b7fd239e
Author: Jostein Kjønigsen <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #152 from Rogach/pr/fix-indentation-when-lexical-scoping
fix eval invocation in typescript--re-search-backward to work with lexical
scoping
---
typescript-mode-lexical-binding-tests.el | 25 +++++++++++++++++++++++++
typescript-mode-tests.el | 1 +
typescript-mode.el | 6 +++---
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/typescript-mode-lexical-binding-tests.el
b/typescript-mode-lexical-binding-tests.el
new file mode 100644
index 0000000000..9f217e3caa
--- /dev/null
+++ b/typescript-mode-lexical-binding-tests.el
@@ -0,0 +1,25 @@
+;; -*- lexical-binding: t -*-
+;;; typescript-mode-lexical-binding-tests --- This file contains test for
typescript-mode.el under enabled lexical-binding
+
+;;; Commentary:
+;; To know how to run the tests, see typescript-mode-tests.el
+
+(require 'ert)
+
+;; reload typescript-mode with lexical-binding enabled
+(with-temp-buffer
+ (insert-file-contents "typescript-mode.el")
+ (ignore-errors
+ (while (setq sexp (read (current-buffer)))
+ (eval sexp t))))
+
+(require 'typescript-mode-test-utilities)
+
+(ert-deftest lexical-binding--indentation-does-not-throw-error ()
+ (with-temp-buffer
+ (insert-file-contents "test-files/indentation-reference-document.ts")
+ (typescript-mode)
+ (goto-line 2)
+ (typescript-indent-line)))
+
+(provide 'typescript-mode-lexical-binding-tests)
diff --git a/typescript-mode-tests.el b/typescript-mode-tests.el
index 1c8aa75fa2..7ff8b212fe 100644
--- a/typescript-mode-tests.el
+++ b/typescript-mode-tests.el
@@ -11,6 +11,7 @@
(require 'typescript-mode-test-utilities)
(require 'typescript-mode-general-tests)
(require 'typescript-mode-jsdoc-tests)
+(require 'typescript-mode-lexical-binding-tests)
(provide 'typescript-mode-tests)
diff --git a/typescript-mode.el b/typescript-mode.el
index 8fb2ff41b0..ef4f0e55b9 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -992,11 +992,11 @@ one at the end of the line with \"let a\"."
(let ((saved-point (point))
(search-expr
(cond ((null count)
- '(typescript--re-search-backward-inner regexp bound 1))
+ `(typescript--re-search-backward-inner ,regexp ,bound 1))
((< count 0)
- '(typescript--re-search-forward-inner regexp bound (- count)))
+ `(typescript--re-search-forward-inner ,regexp ,bound (-
,count)))
((> count 0)
- '(typescript--re-search-backward-inner regexp bound count)))))
+ `(typescript--re-search-backward-inner ,regexp ,bound
,count)))))
(condition-case err
(eval search-expr)
(search-failed