Closed Jolley71717 closed 6 months ago
It has been removed intentionally. Format with ktlint
reformats the entire file. From a UX perspective the action in this menu did seem to suggest to format the highlighted issue only. I will think about whether, I want to re-add it with a description that makes clear that the entire file is formatted, for example Format file with ktlint
.
Untill then, you can use the Format with ktlint
menu option in the Refactor
menu. Defining a shortcut on that menu option makes it easily accessible.
It's possible to format only a line or selected code, because some times i don't want to format all file, there are a lot of code and is hard to do the code review. My team is using this plugin now and we don't want to format old code, only new changes.
It's possible to format only a line or selected code, because some times i don't want to format all file, there are a lot of code and is hard to do the code review. My team is using this plugin now and we don't want to format old code, only new changes.
Ktlint has never supported partial formatting of file. So the old behavior was that the context menu with name "Format with ktlint" suggested that only the particular violation would be formatted. The real behavior was that the entire file was formatted. See #385 for request to support partial formatting.
It appears that the contextual "Format with ktlint" option has been removed from the list of options. Reviewing the release notes, I don't believe this was intentional.
I can reproduce this by opening up a scratch file and adding something like the following with any sort of formatting issue, e.g. ex
The plugin is enabled and set to![image](https://github.com/nbadal/ktlint-intellij-plugin/assets/16094602/4ec5bbcc-8deb-4850-aa17-4f450e3d6eb0)
Manual
mode