branch: elpa/smartparens commit df74098a011b010a2c78a3f3173c1a9a97a77132 Author: Josh Caswell <j...@woolsweater.net> Commit: Josh Caswell <j...@woolsweater.net>
Add config for 'swift-ts-mode' --- smartparens-config.el | 3 ++- smartparens-swift.el | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/smartparens-config.el b/smartparens-config.el index 981641f5bf..b5ef7b11a0 100644 --- a/smartparens-config.el +++ b/smartparens-config.el @@ -158,7 +158,8 @@ ID, ACTION, CONTEXT." (eval-after-load 'rust-ts-mode '(require 'smartparens-rust)) (eval-after-load 'rustic '(require 'smartparens-rust)) (eval-after-load 'scala-mode '(require 'smartparens-scala)) -(eval-after-load 'swift-mode '(require 'smartparens-swift)) +(--each '(swift-mode swift-ts-mode) + (eval-after-load it '(require 'smartparens-swift))) (eval-after-load 'tex-mode '(require 'smartparens-latex)) (eval-after-load 'text-mode '(require 'smartparens-text)) (eval-after-load 'tuareg '(require 'smartparens-ml)) diff --git a/smartparens-swift.el b/smartparens-swift.el index a1efab109d..fc0166b77d 100644 --- a/smartparens-swift.el +++ b/smartparens-swift.el @@ -28,8 +28,8 @@ ;;; Commentary: -;; This file provides some additional configuration for Swift. To use -;; it, simply add: +;; This file provides some additional configuration for Swift. To use it in +;; conjunction with either `swift-mode' or `swift-ts-mode', simply add: ;; ;; (require 'smartparens-config) ;; @@ -46,6 +46,7 @@ (require 'smartparens) (declare-function swift-mode "swift-mode") +(declare-function swift-ts-mode "swift-ts-mode") (defun sp-swift-skip-match-angle-bracket (_ms _mb me) "Non-nil if we should ignore the bracket as valid delimiter." @@ -102,15 +103,16 @@ ((eq action 'navigate) (and (not on-comparison) (not on-fn-return-type) (not on-range-operator)))))))) -(sp-with-modes '(swift-mode) +(sp-with-modes '(swift-mode swift-ts-mode) (sp-local-pair "<" ">" :when '(sp-swift-filter-angle-brackets) :skip-match 'sp-swift-skip-match-angle-bracket) (sp-local-pair "\"\"\"" "\"\"\"")) -;; Swift has no sexp suffices. This fixes slurping +;; Swift has no sexp suffixes. This fixes slurping ;; (|foo).bar -> (foo.bar) -(add-to-list 'sp-sexp-suffix (list #'swift-mode 'regexp "")) +(dolist (mode '(swift-mode swift-ts-mode)) + (add-to-list 'sp-sexp-suffix (list mode 'regexp ""))) (provide 'smartparens-swift)