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

ktfmt doesn't seem to work in IJ 2024.1.1 #463

Closed
rock3r opened this issue May 3, 2024 · 10 comments
Closed

ktfmt doesn't seem to work in IJ 2024.1.1 #463

rock3r opened this issue May 3, 2024 · 10 comments

Comments

@rock3r
Copy link
Contributor

rock3r commented May 3, 2024

I have the ktfmt plugin installed and enabled in IJC 2024.1.1:

image

When I reformat the file (cmd-shift-l), it looks like it's using IJ's formatter. If I run ktfmt from the command line, the formatting of the file that I just theoretically reformatted in the IDE changes. This shows ktfmt was not used.

@ColtonIdle
Copy link

What if you restart the IDE? Wonder if its this issue that was closed: #229

@rock3r
Copy link
Contributor Author

rock3r commented May 7, 2024

Hi Colton! No, still doesn't seem to work after restarting the IDE.

@greyhairredbear
Copy link
Contributor

Hmmm, that's interesting. I've 2024.1.1 (241.15989.150 build) with ktfmt plugin version 1.1.0.49 and it's working with that configuration for all the available styles... Do you have any other formatting tools running? Or maybe an .editorconfig file, which is being used by IntelliJ?

@rock3r
Copy link
Contributor Author

rock3r commented Jun 6, 2024

Sorry it took me a while to get back to you, I was mostly travelling for work :) No .editorconfig file, and no other formatting plugins.

image

Is it possible that the issue is that I have the reformatting scope set to "Only changes uncommitted to VCS"? If I set it to "whole file" it seems to work fine.

@greyhairredbear
Copy link
Contributor

Oh, that's actually quite possible. I think I know where the issue might be, hopefully I can find the time to look into that soon. Thank you for the hint!

@hovterteryan
Copy link

Any update on this? Issue exists on Android Studio Koala based on IJ 2024.1.1

@rock3r
Copy link
Contributor Author

rock3r commented Aug 15, 2024

The next version will work fine in all IJ versions up to 242. I fixed it in #501

@rock3r rock3r closed this as completed Aug 15, 2024
@greyhairredbear
Copy link
Contributor

Hi @rock3r, nice work on converting the IntelliJ Plugin to Kotlin! 👏

It has been quite a while since I've been able to look into ktfmt, but I have a question on this: Did the update fix the issue with the "Only changes uncommited to VCS"-setting? My guess was that it had something to do with getFeatures() from the KtfmtFormattingService not returning any partial formatting features. And since I saw the return value of the method did not really change after the update, I got curious :)

@rock3r
Copy link
Contributor Author

rock3r commented Aug 23, 2024

@greyhairredbear no, I didn't alter the plugin behaviour. That is still essentially doing nothing. I also think it's due to the features being declared, but don't know how to implement partial reformatting. Maybe @hick209 can help?

@greyhairredbear
Copy link
Contributor

greyhairredbear commented Aug 23, 2024

but don't know how to implement partial reformatting

Yes, me neither. I can't recall if I tried just setting the features, using the existing KtfmtFormattingTask and just see what it does... Seems to me this could work out, but as I said, don't know if I've already tried it 🤷 Maybe I've also refrained from adding that since I didn't have an idea of how to verify it's working as expected, but the VCS-setting might just be a way of testing that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants