Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for js-ts-mode and typescript-ts-mode #1174

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion smartparens-config.el
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ID, ACTION, CONTEXT."
(eval-after-load 'tuareg '(require 'smartparens-ml))
(eval-after-load 'fsharp-mode '(require 'smartparens-ml))
(eval-after-load 'unisonlang-mode '(require 'smartparens-unison))
(--each '(js js2-mode)
(--each '(js js2-mode typescript-ts-mode)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably add js-ts-mode here as well then? Since you added it to the config.

Copy link
Contributor Author

@akreisher akreisher Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js-ts-mode is provided in js.el, so I believe just including js here should be sufficient for both js-mode and js-ts-mode (since I believe this form expects package names for eval-after-load, not mode symbols). typescript-ts-mode on the other hand is in its own package (typescript-ts-mode.el) and so needs its own entry here.

I believe the same applies for python. This line:
https://github.com/fuco1/smartparens/blob/96fccc0816093aaad4b904a20802ec306c6da420/smartparens-config.el#L135-L136

could probably just be:

(eval-after-load 'python                   '(require 'smartparens-python))

since both python-mode and python-ts-mode are defined in python.el.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, good catch!

(eval-after-load it '(require 'smartparens-javascript)))
(provide 'smartparens-config)

Expand Down
11 changes: 10 additions & 1 deletion smartparens-javascript.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@

;; (|sys).path.append---the dot should not travel with the closing
;; paren
(--each '(js-mode javascript-mode js2-mode typescript-mode rjsx-mode)
(--each '(
js-mode
javascript-mode
js2-mode
typescript-mode
rjsx-mode
js-ts-mode
typescript-ts-mode
tsx-ts-mode
)
(add-to-list 'sp-sexp-suffix (list it 'regexp "")))

(provide 'smartparens-javascript)
Expand Down
1 change: 1 addition & 0 deletions smartparens.el
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ Symbol is defined as a chunk of text recognized by
js-jsx-mode
js2-jsx-mode
rjsx-mode
tsx-ts-mode
)
"List of HTML modes.")

Expand Down