From f75b65c812b0ad444dd1648289966b46c0e24a0a Mon Sep 17 00:00:00 2001 From: Mitja Date: Fri, 19 Dec 2025 08:28:30 +0200 Subject: [PATCH 1/5] Fix grep variation --- build.gradle.kts | 2 +- changelog.md | 5 +++++ src/main/kotlin/com/mituuz/fuzzier/entities/GrepConfig.kt | 6 +++--- src/main/kotlin/com/mituuz/fuzzier/grep/FuzzyGrep.kt | 2 +- .../com/mituuz/fuzzier/grep/backend/BackendResolver.kt | 2 +- .../com/mituuz/fuzzier/grep/backend/BackendStrategy.kt | 5 +++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 15941c93..6baf38f2 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 diff --git a/changelog.md b/changelog.md index 2f90f7f7..4564b56a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## Version 2.0.1 + +- Fix incorrect grep and findstr commands +- Re-add the backend name to the popup title + ## 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..d28a6cfa 100644 --- a/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt +++ b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt @@ -109,14 +109,14 @@ sealed interface BackendStrategy { } 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 ) From 022a763955cdeb6f7867732fee7171323d43797f Mon Sep 17 00:00:00 2001 From: Mitja Date: Fri, 19 Dec 2025 08:33:32 +0200 Subject: [PATCH 2/5] Add change notes --- build.gradle.kts | 5 +++++ changelog.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6baf38f2..e6b85c2e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,11 @@ intellijPlatform { changeNotes = """

Version $currentVersion

+
    +
  • Fix incorrect grep command
  • +
  • Re-add the backend name to the popup title
  • +
+

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 4564b56a..8c82b450 100644 --- a/changelog.md +++ b/changelog.md @@ -2,7 +2,7 @@ ## Version 2.0.1 -- Fix incorrect grep and findstr commands +- Fix incorrect grep command - Re-add the backend name to the popup title ## Version 2.0.0 From 281bebd84bf800a026786d8818b2a964b5a795d3 Mon Sep 17 00:00:00 2001 From: Mitja Date: Fri, 19 Dec 2025 09:06:16 +0200 Subject: [PATCH 3/5] Handle findstr search string correctly and update changelog --- build.gradle.kts | 12 +++++++++++- changelog.md | 9 ++++++++- .../mituuz/fuzzier/grep/backend/BackendStrategy.kt | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e6b85c2e..a91f4df4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,9 +40,19 @@ intellijPlatform { changeNotes = """

Version $currentVersion

    -
  • Fix incorrect grep command
  • +
  • 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.

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 8c82b450..1ba754e5 100644 --- a/changelog.md +++ b/changelog.md @@ -2,9 +2,16 @@ ## Version 2.0.1 -- Fix incorrect grep command +- 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/grep/backend/BackendStrategy.kt b/src/main/kotlin/com/mituuz/fuzzier/grep/backend/BackendStrategy.kt index d28a6cfa..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,10 +100,10 @@ sealed interface BackendStrategy { "/p", "/s", "/n", - searchString + "/C:$searchString" ) ) - commands.addAll(grepConfig.targets) + commands.addAll(grepConfig.targets.map { if (it == ".") "*" else it }) return commands } } From 13f5b8fcce1d4ed87464385b7fb0d71676362bfe Mon Sep 17 00:00:00 2001 From: Mitja Date: Fri, 19 Dec 2025 09:19:47 +0200 Subject: [PATCH 4/5] Fix tests --- .../kotlin/com/mituuz/fuzzier/search/BackendResolverTest.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 "" From 8bb681d03c8fa483ff4c00b6288287d4805bda7b Mon Sep 17 00:00:00 2001 From: Mitja Date: Fri, 19 Dec 2025 09:25:59 +0200 Subject: [PATCH 5/5] Fix tests --- .../kotlin/com/mituuz/fuzzier/search/BackendStrategyTest.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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