Skip to content

Commit

Permalink
Add support for rust-ts-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lerouxrgd committed Aug 17, 2023
1 parent 79a338d commit bbfec47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions smartparens-config.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 3 additions & 1 deletion smartparens-rust.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit bbfec47

Please sign in to comment.