[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master dee4c47 07/22: Merge pull request #491 from felipeochoa/fo
From: |
Dmitry Gutov |
Subject: |
[elpa] master dee4c47 07/22: Merge pull request #491 from felipeochoa/forward-sexp-in-str |
Date: |
Tue, 19 Feb 2019 06:06:45 -0500 (EST) |
branch: master
commit dee4c4786135db93e1712003ef3917f54b42e792
Merge: 4de0e2d 6d160d0
Author: Dmitry Gutov <address@hidden>
Commit: GitHub <address@hidden>
Merge pull request #491 from felipeochoa/forward-sexp-in-str
Use regular forward-sexp when inside strings
---
js2-mode.el | 2 ++
tests/navigation.el | 32 ++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/js2-mode.el b/js2-mode.el
index c1b4877..085a18d 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12405,6 +12405,8 @@ move backward across N balanced expressions."
(let (forward-sexp-function
node (start (point)) pos lp rp child)
(cond
+ ((js2-string-node-p (js2-node-at-point))
+ (forward-sexp arg))
;; backward-sexp
;; could probably make this better for some cases:
;; - if in statement block (e.g. function body), go to parent
diff --git a/tests/navigation.el b/tests/navigation.el
index d7a8314..73737ba 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -58,3 +58,35 @@
(ert-deftest js2-jump-to-property-object-property ()
(js2-navigation-helper "aObject.value = {prop:1};aObject.value.prop" 18))
+
+
+;; forward-sexp
+
+(defun js2-test-forward-sexp (pre-point skipped after-sexp)
+ "Test `js2-mode-forward-sexp'.
+The test buffer's contents are set to the concatenation of
+PRE-POINT, SKIPPED, and AFTER-SEXP. Point is placed after
+PRE-POINT, and `forward-sexp' is called. Then point should be
+after SKIPPED."
+ (with-temp-buffer
+ (insert pre-point skipped after-sexp)
+ (js2-mode)
+ (goto-char (1+ (length pre-point)))
+ (forward-sexp)
+ (should (= (point) (+ 1 (length pre-point) (length skipped))))))
+
+(ert-deftest js2-forward-sexp-skip-semi ()
+ "Ensure expr-stmt-nodes' semicolons are skipped over."
+ (js2-test-forward-sexp "" "const s = 123;" ""))
+
+(ert-deftest js2-forward-sexp-inside-string ()
+ "Test forward sexp inside a string."
+ (js2-test-forward-sexp "const s = 'some " "(string contents)" " xyz';"))
+
+(ert-deftest js2-backward-sexp-inside-string ()
+ "Test backward sexp inside a string."
+ (with-temp-buffer
+ (insert "const s = 'some (string contents) ")
+ (save-excursion (insert "xyz';"))
+ (backward-sexp)
+ (should (= (point) 17))))
- [elpa] master updated (ddd6b22 -> c5cc951), Dmitry Gutov, 2019/02/19
- [elpa] master 243ba59 02/22: Fix typo in test name, namepsace -> namespace, Dmitry Gutov, 2019/02/19
- [elpa] master 6d160d0 06/22: Use regular forward-sexp when inside strings, Dmitry Gutov, 2019/02/19
- [elpa] master 3bea9ab 14/22: Merge pull request #498 from wyuenho/fix-short-name-for-emacs26, Dmitry Gutov, 2019/02/19
- [elpa] master bf61e6f 10/22: Fix #495 Aggressively reparse during imenu-create-index when possible, Dmitry Gutov, 2019/02/19
- [elpa] master 47dee19 03/22: Properly classify imported symbols, Dmitry Gutov, 2019/02/19
- [elpa] master dee4c47 07/22: Merge pull request #491 from felipeochoa/forward-sexp-in-str,
Dmitry Gutov <=
- [elpa] master 40a43b1 13/22: Fix broken js2-node-short-name for Emacs 26, Dmitry Gutov, 2019/02/19
- [elpa] master 8bb1907 01/22: Silence "variable ‘_’ not left unused", Dmitry Gutov, 2019/02/19
- [elpa] master 2ed3cc0 17/22: Merge pull request #501 from thorrr/obj-literal-fix, Dmitry Gutov, 2019/02/19
- [elpa] master 58006df 20/22: Release new version, Dmitry Gutov, 2019/02/19
- [elpa] master 381545b 08/22: Make js2-additional-externs safe as a local variable, Dmitry Gutov, 2019/02/19
- [elpa] master ed955e7 21/22: Update NEWS, Dmitry Gutov, 2019/02/19
- [elpa] master 4125b49a 04/22: Merge pull request #487 from lelit/classify-imported, Dmitry Gutov, 2019/02/19
- [elpa] master 1b0e174 12/22: Don't record js2-xml-ref-node's in js2-recorder-identifiers, Dmitry Gutov, 2019/02/19
- [elpa] master 5165f4d 19/22: Merge pull request #507 from piotr-yuxuan/patch-1, Dmitry Gutov, 2019/02/19
- [elpa] master 4de0e2d 05/22: Don't warn about trailing commas by default, Dmitry Gutov, 2019/02/19