-
Notifications
You must be signed in to change notification settings - Fork 15
Fix semantic indentation of quoted functions #49
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
clojure-ts-mode.el
Outdated
@@ -520,6 +520,10 @@ with the markdown_inline grammar." | |||
"Return non-nil if NODE is a Clojure keyword." | |||
(string-equal "kwd_lit" (treesit-node-type node))) | |||
|
|||
(defun clojure-ts--quoted-var-node-p (node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the right terminology here is var-quoted-node
. That's because you can also have the standard quoting with '
.
clojure-ts-mode.el
Outdated
@@ -520,6 +520,10 @@ with the markdown_inline grammar." | |||
"Return non-nil if NODE is a Clojure keyword." | |||
(string-equal "kwd_lit" (treesit-node-type node))) | |||
|
|||
(defun clojure-ts--quoted-var-node-p (node) | |||
"Return non-nil if NODE is a Clojure quoted." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clojure -> var-quoted
@@ -60,6 +60,8 @@ | |||
(clojure.core/filter even? | |||
(range 1 10)) | |||
|
|||
(#'filter even? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I the indentation OK if it was just 'filter
? Also it might be good to change the example to make more sense in the context of quoting being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how 'filter
should indent. Specifically, the reason I think a quoted var
should indent like this, is because it implements 'IFn
(ie. it can be called) while a symbol doesn't. Let me know if you agree with this. On the others, happy to change the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm OK with this.
@bbatsov Upon thinking about this further, I think that the proper name should actually be
I think calling it anything else will be a bit confusing since it is technically a variable... ie: (type #'filter)
;; => clojure.lang.Variable I have updated the PR with these changes, but I am also happy to change it to whatever you want. Let me know! |
@bbatsov just pinging you on this. No rush, just a reminder :) |
@rschmukler Sorry about me dropping the ball on this earlier. You'll need to rebase on |
@bbatsov rebased and ready to go 👍 |
Can you please address the small lint error that's causing the lint check to fail? Also - now that we have some unit tests (see #57), you might want to add one covering your change. |
@bbatsov the PR is updated with listing passing. I tried to make the tests run and added (what I thought was an appropriate case to
However when I run |
Those are the actual tests that we currently run https://github.com/clojure-emacs/clojure-ts-mode/blob/main/test/clojure-ts-mode-indentation-test.el The ones in the other folder need to be ported to the new test suite. |
Got it! Thanks for the explanation and sorry for missing that. Updated the test suite to include a unit test for this. |
Hmm, seems that on Emacs snapshot there's a load error for the test file. |
Fixes an error where quoted functions would not align correctly with semantic indentation. Adds an example test and updates the changelog
Sorry about that, should be good now |
Thanks! |
Fixes an error where quoted functions would not align correctly with semantic indentation. Adds an example to the test sample.
Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):
M-x checkdoc
and fixed any warnings in the code you've written.Thanks!