diff --git a/build.gradle.kts b/build.gradle.kts index 15941c93..a91f4df4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile // Use the same version and group for the jar and the plugin -val currentVersion = "2.0.0" +val currentVersion = "2.0.1" val myGroup = "com.mituuz" version = currentVersion group = myGroup @@ -39,6 +39,21 @@ intellijPlatform { changeNotes = """

Version $currentVersion

+ +

Known issues

+ +

Version 2.0.0

This version contains larger refactors and multiple new actions enabled by them.

I'm updating the existing package structure to keep things nicer and not supporting the old actions to avoid possible problems in the future.

diff --git a/changelog.md b/changelog.md index 2f90f7f7..1ba754e5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,17 @@ # Changelog +## Version 2.0.1 + +- Fix incorrect `grep` command +- Partially fix `findstr` command +- Re-add the backend name to the popup title + +**Known issues** + +- `findstr` does not work with currently open tabs + - To reduce the maintenance burden, I may remove support later + - Performance is poor enough that I thought that the command wasn't returning any results + ## Version 2.0.0 This version contains larger refactors and multiple new actions enabled by them. diff --git a/src/main/kotlin/com/mituuz/fuzzier/entities/GrepConfig.kt b/src/main/kotlin/com/mituuz/fuzzier/entities/GrepConfig.kt index f5b70b33..481910d5 100644 --- a/src/main/kotlin/com/mituuz/fuzzier/entities/GrepConfig.kt +++ b/src/main/kotlin/com/mituuz/fuzzier/entities/GrepConfig.kt @@ -35,10 +35,10 @@ class GrepConfig( val title: String = "", val supportsSecondaryField: Boolean = true, ) { - fun getPopupTitle(): String { + fun getPopupTitle(backendName: String): String { if (caseMode == CaseMode.INSENSITIVE) { - return "$title (Case Insensitive)" + return "$title (case-insensitive $backendName)" } - return title + return "$title ($backendName)" } } \ No newline at end of file diff --git a/src/main/kotlin/com/mituuz/fuzzier/grep/FuzzyGrep.kt b/src/main/kotlin/com/mituuz/fuzzier/grep/FuzzyGrep.kt index 6b635ecd..88a7ea37 100644 --- a/src/main/kotlin/com/mituuz/fuzzier/grep/FuzzyGrep.kt +++ b/src/main/kotlin/com/mituuz/fuzzier/grep/FuzzyGrep.kt @@ -83,12 +83,12 @@ open class FuzzyGrep : FuzzyAction() { ) { currentLaunchJob?.cancel() grepConfig = getGrepConfig(project) - val popupTitle = grepConfig.getPopupTitle() val projectBasePath = project.basePath.toString() currentLaunchJob = actionScope?.launch(Dispatchers.EDT) { val backendResult: Result = backendResolver.resolveBackend(commandRunner, projectBasePath) backend = backendResult.getOrNull() + val popupTitle = grepConfig.getPopupTitle(backend!!.name) if (backendResult.isFailure) { showNotification( diff --git a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt index 9ec90a95..f8f01570 100644 --- a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt +++ b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendResolver.kt @@ -36,7 +36,7 @@ class BackendResolver(val isWindows: Boolean) { projectBasePath ) -> Result.success(BackendStrategy.Findstr) - !isWindows && isInstalled(commandRunner, "com/mituuz/fuzzier/grep", projectBasePath) -> Result.success( + !isWindows && isInstalled(commandRunner, "grep", projectBasePath) -> Result.success( BackendStrategy.Grep ) diff --git a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt index ba998804..3cf53d48 100644 --- a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt +++ b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt @@ -100,23 +100,23 @@ sealed interface BackendStrategy { "/p", "/s", "/n", - searchString + "/C:$searchString" ) ) - commands.addAll(grepConfig.targets) + commands.addAll(grepConfig.targets.map { if (it == ".") "*" else it }) return commands } } object Grep : BackendStrategy { - override val name = "com/mituuz/fuzzier/grep" + override val name = "grep" override fun buildCommand( grepConfig: GrepConfig, searchString: String, secondarySearchString: String? ): List { - val commands = mutableListOf("com/mituuz/fuzzier/grep") + val commands = mutableListOf("grep") if (grepConfig.caseMode == CaseMode.INSENSITIVE) { commands.add("-i") @@ -126,6 +126,7 @@ sealed interface BackendStrategy { mutableListOf( "--color=none", "-r", + "-H", "-n", searchString ) diff --git a/src/test/kotlin/com/mituuz/fuzzier/search/BackendResolverTest.kt b/src/test/kotlin/com/mituuz/fuzzier/search/BackendResolverTest.kt index 0322158b..c6ff1894 100644 --- a/src/test/kotlin/com/mituuz/fuzzier/search/BackendResolverTest.kt +++ b/src/test/kotlin/com/mituuz/fuzzier/search/BackendResolverTest.kt @@ -93,7 +93,7 @@ class BackendResolverTest { coEvery { commandRunner.runCommandForOutput(listOf("which", "rg"), projectBasePath) } returns "" coEvery { commandRunner.runCommandForOutput( - listOf("which", "com/mituuz/fuzzier/grep"), + listOf("which", "grep"), projectBasePath ) } returns "/usr/bin/grep" @@ -103,7 +103,7 @@ class BackendResolverTest { assertTrue(result.isSuccess) assertEquals(BackendStrategy.Grep, result.getOrNull()) coVerify { commandRunner.runCommandForOutput(listOf("which", "rg"), projectBasePath) } - coVerify { commandRunner.runCommandForOutput(listOf("which", "com/mituuz/fuzzier/grep"), projectBasePath) } + coVerify { commandRunner.runCommandForOutput(listOf("which", "grep"), projectBasePath) } } @Test @@ -128,7 +128,7 @@ class BackendResolverTest { coEvery { commandRunner.runCommandForOutput(listOf("which", "rg"), projectBasePath) } returns " " coEvery { commandRunner.runCommandForOutput( - listOf("which", "com/mituuz/fuzzier/grep"), + listOf("which", "grep"), projectBasePath ) } returns "" diff --git a/src/test/kotlin/com/mituuz/fuzzier/search/BackendStrategyTest.kt b/src/test/kotlin/com/mituuz/fuzzier/search/BackendStrategyTest.kt index b75c0eb1..e75463be 100644 --- a/src/test/kotlin/com/mituuz/fuzzier/search/BackendStrategyTest.kt +++ b/src/test/kotlin/com/mituuz/fuzzier/search/BackendStrategyTest.kt @@ -159,7 +159,7 @@ class BackendStrategyTest { assertTrue(result.contains("/p")) assertTrue(result.contains("/s")) assertTrue(result.contains("/n")) - assertTrue(result.contains("test")) + assertTrue(result.contains("/C:test")) assertTrue(result.contains("C:\\path\\to\\search")) } @@ -204,7 +204,7 @@ class BackendStrategyTest { val result = BackendStrategy.Grep.buildCommand(config, "test", null) - assertTrue(result.contains("com/mituuz/fuzzier/grep")) + assertTrue(result.contains("grep")) assertTrue(result.contains("--color=none")) assertTrue(result.contains("-r")) assertTrue(result.contains("-n")) @@ -238,7 +238,7 @@ class BackendStrategyTest { @Test fun `name should return grep`() { - assertEquals("com/mituuz/fuzzier/grep", BackendStrategy.Grep.name) + assertEquals("grep", BackendStrategy.Grep.name) } } } \ No newline at end of file