-
Notifications
You must be signed in to change notification settings - Fork 464
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
maven IDE hook for jj fix
#2424
Comments
Spotless Gradle supports this, but the Maven support is immature. @SapiensAnatis has made some progress here. |
jj fix
I didn’t write the IDE hook to be clear, but it sounds broadly like what you are looking for. If you use these arguments: https://github.com/SapiensAnatis/vscode-spotless-maven/blob/5cb5fa5a1cc444e47aa50e33547b2ffefdf56dec/src/maven/basicMavenExecutor.ts#L28 You will get a process that takes a document on stdin and then returns on stderr IS CLEAN / IS DIRTY and on stdout the formatted document. The only problem is I can’t remember if you get the formatted document on stdout if Spotless returns IS CLEAN. In the vscode extension we just return ‘no changes’ if we get that back. |
Hey @SapiensAnatis @nedtwigg thank you for the feedback, I will do a bit of experimentation with that to see how it behaves and come back here to share my findings! |
I can already share this:
|
Performance wise I think the way forward is to use mvnd which runs as a daemon and is much faster for ad-hoc formatting. However it doesn’t seem to be compatible with the IDE hook at the minute, I’ve raised a few issues over there so hopefully those will be fixed soon! |
I did a few tests with It's taking something like 2.8sec with running |
Oh the IDE hook is really only for a single file (hence IDE). On a single file it takes about 0.4s for me (assuming the daemon is warm) but if you are formatting your entire solution it will probably be slower. |
@SapiensAnatis I meant a single file yes and it was clean and indexed so actually nothing was really done against the file and I let the daemon warm a bit indeed by calling the same command many times. In both cases (see below), most of the time is spent (from my subjective point of view) just after the line "[INFO] --- spotless:2.43.0:apply (default-cli) @ app ---". Using the hook
and not the hook:
|
Ah, my numbers were from running on Java directly. I guess there may be some overhead if you need to invoke npm/prettier. |
something to investigate, maybe in another ticket though ^^ I will try to get a feel of why it happens and create one if I feel like it's a good idea :) |
Hi,
I am trying to setup jujutsu so that it runs spotless (configured using the maven plugin in my repository) when using
jj fix
, see https://jj-vcs.github.io/jj/latest/cli-reference/#jj-fix.The problem is that the requirement from jujutsu is that the tool that does formatting should respect the following rule:
Would that be something that could be added to spotless?
Thanks!
The text was updated successfully, but these errors were encountered: