From bbfec47ac29ae93d9bbfe4e1fd1aa0c9e35e8397 Mon Sep 17 00:00:00 2001 From: Romain Leroux Date: Thu, 17 Aug 2023 20:10:17 +0200 Subject: [PATCH] Add support for rust-ts-mode --- smartparens-config.el | 1 + smartparens-rust.el | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/smartparens-config.el b/smartparens-config.el index 7bfcfe08..1b0d2858 100644 --- a/smartparens-config.el +++ b/smartparens-config.el @@ -139,6 +139,7 @@ ID, ACTION, CONTEXT." (eval-after-load 'rst '(require 'smartparens-rst)) (eval-after-load 'ruby-mode '(require 'smartparens-ruby)) (eval-after-load 'rust-mode '(require 'smartparens-rust)) +(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)) diff --git a/smartparens-rust.el b/smartparens-rust.el index 42996d84..f5058610 100644 --- a/smartparens-rust.el +++ b/smartparens-rust.el @@ -45,6 +45,7 @@ (require 'smartparens) (declare-function rust-mode "rust-mode") +(declare-function rust-ts-mode "rust-ts-mode") (declare-function rustic-mode "rustic-mode") (defun sp-in-rust-lifetime-context (&rest _args) @@ -124,7 +125,7 @@ ARGS." ((eq action 'navigate) (and (not on-comparison) (not on-fn-return-type) (not on-match-branch)))))))) -(sp-with-modes '(rust-mode rustic-mode) +(sp-with-modes '(rust-mode rust-ts-mode rustic-mode) (sp-local-pair "'" "'" :unless '(sp-in-comment-p sp-in-string-quotes-p sp-in-rust-lifetime-context) :post-handlers'(:rem sp-escape-quotes-after-insert)) @@ -135,6 +136,7 @@ ARGS." ;; Rust has no sexp suffices. This fixes slurping ;; (|foo).bar -> (foo.bar) (add-to-list 'sp-sexp-suffix (list #'rust-mode 'regexp "")) +(add-to-list 'sp-sexp-suffix (list #'rust-ts-mode 'regexp "")) (add-to-list 'sp-sexp-suffix (list #'rustic-mode 'regexp "")) (provide 'smartparens-rust)