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

AutoCorrect is not working when right clicking the directory #512

Open
mondaylord opened this issue Apr 8, 2024 · 1 comment
Open

AutoCorrect is not working when right clicking the directory #512

mondaylord opened this issue Apr 8, 2024 · 1 comment
Labels
feature New feature or request

Comments

@mondaylord
Copy link

Description

Autocorrect works as expected when I right-click a file or a blank space within the code in the IDE.

However, when I attempt to run autocorrect by right-clicking on the directory itself, it does not work.
This behavior persists even when the directory contains only one kotlin file.

I am not sure if this is a bug or an intentional feature that autocorrect cannot be executed on a directory.

@arturbosch arturbosch added the feature New feature or request label Apr 15, 2024
@arturbosch
Copy link
Member

AutoCorrect was implemented to run just on a single file:

val file: VirtualFile = event.getData(CommonDataKeys.VIRTUAL_FILE) ?: return

detekt core should be able to handle directories and the plugin can be updates to support directories like the RunAnalysionAction

override fun update(event: AnActionEvent) {
val selectedFiles = event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY) ?: return
val isDirectoryOrKotlinFile = selectedFiles.any { it.isDirectory || it.extension in KOTLIN_FILE_EXTENSIONS }
event.presentation.isEnabledAndVisible = isDirectoryOrKotlinFile
}
override fun actionPerformed(e: AnActionEvent) {
val selectedFiles = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY)
if (selectedFiles.isNullOrEmpty()) {
return
}
:

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

No branches or pull requests

2 participants