-
-
Notifications
You must be signed in to change notification settings - Fork 645
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 preliminary support for clojure-ts-mode #3461
Conversation
Will have a look tomorrow! |
cd1fd9a
to
4cf7f7f
Compare
4cf7f7f
to
589ad40
Compare
Yes, I had some trouble because I use nix and there were some missing dependencies. I think the existing tests are working now. Sometimes they fail locally but that's because they time out (I develop on a pinebook most of the time).
Thank you! |
There's some docs about the tests here https://docs.cider.mx/cider/contributing/hacking.html#testing-the-code Feel free to improve it if something is missing. |
Do those functions work properly in |
Overall the changes look fine to me, I'm mostly concerned what happens when you call out to the clojure-mode functions in a buffer with a different mode. I'm guessing they can't work properly without the locals and the syntax table. |
It's looking good to me as well! |
I've tested There are some other clojure functions to be tested with this. After work I will see about hunting them down and testing them all. This seems like a good candidate for an automated test. |
Perhaps you have played as well with the idea of making clojure-mode's test suite succeed with clojure-ts-mode? It might be not too hard to hack it for accomplishing so. One can always exclude certain tests (our Eldev shows a test selector setup) if some of them don't make sense for clojure-ts. |
I was just about to ask @dannyfreeman about this on the clojure-ts-mode's issue tracker. Now that semantic indentation has been implemented he can just copy the test suite and disable whatever has not been implemented yet. |
If the syntax-table is the same, they should work. |
I am truly at a loss for how I can please the byte compiler with this error on Emacs 28 I have tried wrapping this code https://github.com/clojure-emacs/cider/pull/3461/files#diff-c53d920d1936b521743bbcd39f4f3c479f2122d4d051c30501310f6d6afc01bfR2112-R2115 |
All it takes is one desperate PR comment to find something that actually works they way you want it to. 1858ab4 Is something like this fix acceptable? Supressing free-var warnings specifically for clojure-ts-mode-map? Now that this is in place I'll see about further automated tests. |
@dannyfreeman What's your timeline for this PR? Do you want to get it in time for CIDER 1.8 or for the next release? I'm asking mostly because I hope that we'll finally release CIDER 1.8 in the next few days. (I know I've said this a few times already :D ) |
I think the only thing left is to get tests running against clojure-ts-mode. I can try to get them working Saturday, but won't have much time before then. It would be nice to get it in 1.8, but I don't want to hold up the release either. |
I guess I do have some outstanding things to figure out with the tests to run with clojure-ts-mode. Just to name a few What tests make sense to run? Some do not (extra font locking for example, since that is not implemented). When we run the test in CI/CD we will need to make sure that the tree-sitter-clojure-grammar gets installed so the modes don't error out on startup. Emacs has facilities for automating this, but it also requires a C compiler and an internet connection. That may prove to be troublesome. What is the best way to make sure clojure-ts-mode installs only on Emacs29 on the test machine? Similarly, how should certain tests be run conditionally? When clojure-ts-mode is installed it effectively "hijacks" clojure-mode using the new |
You are free to add extra steps to https://github.com/clojure-emacs/cider/blob/master/.github/workflows/test.yml which similarly, downloads and installs misc stuff. (Note that adding it to GH Actions is enough; CircleCI will likely be dropped due to its erratic performance)
Probably our
By creating a new Eldev group. We have e.g. One can also have conditions at the GH Actions level, see
I didn't get this point. Would it be troublesome for the existing tests, or for end users? Cheers - V |
For tests. This setting is fine for users (as far as I know, no one has complained). If clojure-ts-mode has been installed, any call to |
e5c5ab1
to
e4b1f08
Compare
I did a rebase to get rid of what github thought was a merge conflict (there wasn't one?). That was needed to make the github CI run. |
Nice commit!
This has an upside. Consider, for example the This way we ensure that CIDER stuff works no matter the |
I've been studying how the redirection works. If you manually invoke |
It seems we won't cut CIDER 1.8 before the end of this week, so you still have time. I'm hoping to finally ship something by the middle of next week. |
Before we merge this PR you can squash this to fewer commits - e.g. one for the changes needed in CIDER and a second one for the CI updates. (or something along those lines) |
Understood, I always appreciate some extra time. I'll try not to push it though :)
Yes I planned on doing that eventually. I'll probably need some more iterations running against the CI server before then. |
Hi all, sorry for the late reply. Both the aforementioned tests are expected to fail when run on GitHub CI, even without these changes, due to incidental environment issues. They run fine on circleci. If you happen to remember from some time ago, I've made a suggestion to migrate the circleci jobs to GHA with #3207, though we've decided we are fine with the current setup. Although I did not mention it at the time, I've noticed and corrected these two failures in one of my unpublished branches at master...ikappaki:cider:tech/github-ci-all . The first issue with The second issue, eval, is caused by a hardcoded Are we planning to run the Nevertheless, I can open a PR with just the fixes for these two tests. Thanks |
Thanks much for the accurate analysis @ikappaki ! I think it would be fine to follow the current strategy (i.e. GH being a superset of Circle because it includes integration tests). From my side I don't like CCI as much as I once did, but they stilll have some value (especially after #3500 - now only CCI builds on every commit, which is useful for fast feedback). Looking forward to the PR. |
Fixed the two GHA issues with #3532. |
This does NOT intended to break the dependency from cider to clojure-mode. It is intended to make CIDER work with clojure-ts-mode. Some functionality like clojure-find-ns, clojulore-find-def, etc will still require clojure-mode in order for CIDER to get it's work done. Adds util functions for checking if buffer is managed by a clojure mode
Address cl-flet lint warning ... with a simpler implementation of cider--setup-clojure-major-mode. Can't have cl-flet lint warnings if I don't use cl-flet. Add clojure-ts-mode dependency to Eldev Silence byte-compiler when optional clojure-ts-mode is not available The linter throws a warning when byte-compiling. Eldev doesn't support pulling in dependencies declared with `eldev-add-extra-dependencies` while running the `eldev compile` command. See https://emacs-eldev.github.io/eldev/#additional-dependencies This makes sense. If a user is byte compiling cider and they don't have clojure-ts-mode installed, they shouldn't see a byte compile warning for it. Make clojure-ts-mode dependency optional Tests will fail when using Emacs versions less than 29 because clojure-ts-mode requires Emacs 29 to work properly. That could be why tests fail in CI. This probably won't help with the linting issue
Includes top level "main" tests, plus an additional clojure-ts-mode/* tests. This also tries to install the language grammar in the CI environment. Git and CC are required. This works in github actions
Particularly the caveats page, where we describe some of the things clojure-ts-mode is currently lacking.
Thank you @ikappaki for addressing the windows bugs. I think I have successfully removed the workarounds I put in place and have all my changes rebased on top of master branch. Apologies for the slow response here. I had some things with my family come up that required some traveling, been busy with all that. I'm getting back in the groove of working on this now. Edit: |
@dannyfreeman what's left to do? this looks awesome thanks for doing this great work! |
The test suite from clojure-mode needs to be ported to clojure-ts-mode. I plan to use some upcoming vacation time to tackle this, as I think it's going to be a decent amount of work. |
Looking forward to this PR landing! (Not a useful comment, certainly, but an opportunity to thank @dannyfreeman for clojure-ts-mode and this work, plus those giving feedback on the PR.) |
font-lock got broken for me in But it's annoying having to do the patch after each update. If this PR still takes a while, it would be nice if just this one change can be done first. |
@bitti Well, it's perfectly fine for someone else to try to push the necessary changes faster. As I wrote earlier in the discussion here for me the tests were kind of optional at this point and I don't mind cutting a few corners in the interest of making the lives of end users better faster. I think it's still a good idea to report a bug for whatever went wrong with |
SGTM, please only check that there aren't pending items (other than tests) If there are, please add them as a checklist item in the PR or maybe create an issue in the https://github.com/clojure-emacs/clojure-ts-mode repo? |
Thanks for picking this up. I didn't have any other pending things in this PR other than tests on the clojure-ts-mode side. I have not had enough free time to be able to work on those. |
No worries. Let's just open an issue in the other repo to track this and we'll get it done, when we can. For now it was important to make it easier for people to use CIDER with |
Yeah for sure. we already have an issue open over there clojure-emacs/clojure-ts-mode#25 |
This does NOT intended to break the dependency from cider to clojure-mode. It is intended to make CIDER work with clojure-ts-mode.
Some functionality like clojure-find-ns, clojure-find-def, etc will still require clojure-mode in order for CIDER to get it's work done.
I'm at a loss for how to run the tests for this project locally.If there are any tests I could write that make sense for these changes I am open to suggestions.PR is in draft mode because I still need to see where it makes sense to include references to clojure-ts-mode in the documentation.
eldev test
)eldev lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.Thanks!
If you're just starting out to hack on CIDER you might find this section of its
manual extremely useful.