Skip to content

Commit

Permalink
Merge pull request #409 from koxudaxi/fix_ruff_executable_detection
Browse files Browse the repository at this point in the history
Fix ruff executable detection
  • Loading branch information
koxudaxi authored Apr 1, 2024
2 parents 9216053 + 9401ffb commit f39ec20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]
- add check args [[#405](https://github.com/koxudaxi/ruff-pycharm-plugin/pull/405)]
- Fix ruff executable detection [[#409](https://github.com/koxudaxi/ruff-pycharm-plugin/pull/409)]

## [0.0.31] - 2024-03-25

Expand Down
12 changes: 6 additions & 6 deletions src/com/koxudaxi/ruff/Ruff.kt
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,21 @@ fun detectRuffExecutable(project: Project, ruffConfigService: RuffConfigService,
findRuffExecutableInSDK(it, lsp)
}.let {
when {
lsp -> ruffConfigService.projectRuffExecutablePath = it?.absolutePath
else -> ruffConfigService.projectRuffLspExecutablePath = it?.absolutePath
lsp -> ruffConfigService.projectRuffLspExecutablePath = it?.absolutePath
else -> ruffConfigService.projectRuffExecutablePath = it?.absolutePath
}
it
}?.let { return it }

when(lsp) {
true -> ruffConfigService.globalRuffExecutablePath
false -> ruffConfigService.globalRuffLspExecutablePath
true -> ruffConfigService.globalRuffLspExecutablePath
false -> ruffConfigService.globalRuffExecutablePath
}?.let { File(it) }?.takeIf { it.exists() }?.let { return it }

return findGlobalRuffExecutable(lsp).let {
when(lsp) {
true -> ruffConfigService.globalRuffExecutablePath = it?.absolutePath
false -> ruffConfigService.globalRuffLspExecutablePath = it?.absolutePath
true -> ruffConfigService.globalRuffLspExecutablePath = it?.absolutePath
false -> ruffConfigService.globalRuffExecutablePath = it?.absolutePath
}
it
}
Expand Down

0 comments on commit f39ec20

Please sign in to comment.