@@ -42,7 +42,7 @@ class IntelliJIDE(
4242 private val project : Project ,
4343 private val continuePluginService : ContinuePluginService ,
4444
45- ) : IDE {
45+ ) : IDE {
4646
4747 private val gitService = GitService (project, continuePluginService)
4848
@@ -57,6 +57,19 @@ class IntelliJIDE(
5757 val os = getOS()
5858 ripgrep =
5959 Paths .get(pluginPath.toString(), " ripgrep" , " bin" , " rg" + if (os == OS .WINDOWS ) " .exe" else " " ).toString()
60+
61+ // Make ripgrep executable if on Unix-like systems
62+ try {
63+ if (os == OS .LINUX || os == OS .MAC ) {
64+ val file = File (ripgrep)
65+ if (! file.canExecute()) {
66+ file.setExecutable(true )
67+ }
68+ }
69+ } catch (e: Throwable ) {
70+ e.printStackTrace()
71+ }
72+
6073 }
6174
6275 /* *
@@ -311,7 +324,7 @@ class IntelliJIDE(
311324 val ideInfo = this .getIdeInfo()
312325 if (ideInfo.remoteName == " local" ) {
313326 val command = GeneralCommandLine (
314- ripgrep,
327+ ripgrep,
315328 " --files" ,
316329 " --iglob" ,
317330 pattern,
@@ -320,58 +333,58 @@ class IntelliJIDE(
320333 " --ignore-file" ,
321334 " .gitignore" ,
322335 )
323-
336+
324337 command.setWorkDirectory(project.basePath)
325338 val results = ExecUtil .execAndGetOutput(command).stdout
326339 return results.split(" \n " )
327340 } else {
328- throw NotImplementedError (" Ripgrep not supported, this workspace is remote" )
329-
330- // Leaving in here for ideas
331- // val projectBasePath = project.basePath ?: return emptyList()
332- // val scope = GlobalSearchScope.projectScope(project)
333- //
334- // // Get all ignore patterns from .continueignore files
335- // val ignorePatterns = mutableSetOf<String>()
336- // VirtualFileManager.getInstance().findFileByUrl("file://$projectBasePath")?.let { root ->
337- // VfsUtil.collectChildrenRecursively(root).forEach { file ->
338- // if (file.name == ".continueignore") {
339- // file.inputStream.bufferedReader().useLines { lines ->
340- // ignorePatterns.addAll(lines.filter { it.isNotBlank() && !it.startsWith("#") })
341- // }
342- // }
343- // }
344- // }
345- //
346- // return FilenameIndex.getAllFilesByExt(project, "*", scope)
347- // .filter { file ->
348- // val relativePath = file.path.removePrefix("$projectBasePath/")
349- // // Check if file matches pattern and isn't ignored
350- // PatternUtil.(relativePath, pattern) &&
351- // !ignorePatterns.any { PatternUtil.matchesGlob(relativePath, it) }
352- // }
353- // .map { it.path.removePrefix("$projectBasePath/") }
341+ throw NotImplementedError (" Ripgrep not supported, this workspace is remote" )
342+
343+ // Leaving in here for ideas
344+ // val projectBasePath = project.basePath ?: return emptyList()
345+ // val scope = GlobalSearchScope.projectScope(project)
346+ //
347+ // // Get all ignore patterns from .continueignore files
348+ // val ignorePatterns = mutableSetOf<String>()
349+ // VirtualFileManager.getInstance().findFileByUrl("file://$projectBasePath")?.let { root ->
350+ // VfsUtil.collectChildrenRecursively(root).forEach { file ->
351+ // if (file.name == ".continueignore") {
352+ // file.inputStream.bufferedReader().useLines { lines ->
353+ // ignorePatterns.addAll(lines.filter { it.isNotBlank() && !it.startsWith("#") })
354+ // }
355+ // }
356+ // }
357+ // }
358+ //
359+ // return FilenameIndex.getAllFilesByExt(project, "*", scope)
360+ // .filter { file ->
361+ // val relativePath = file.path.removePrefix("$projectBasePath/")
362+ // // Check if file matches pattern and isn't ignored
363+ // PatternUtil.(relativePath, pattern) &&
364+ // !ignorePatterns.any { PatternUtil.matchesGlob(relativePath, it) }
365+ // }
366+ // .map { it.path.removePrefix("$projectBasePath/") }
354367 }
355368 }
356369
357370 override suspend fun getSearchResults (query : String ): String {
358371 val ideInfo = this .getIdeInfo()
359372 if (ideInfo.remoteName == " local" ) {
360373 val command = GeneralCommandLine (
361- ripgrep,
362- " -i" ,
374+ ripgrep,
375+ " -i" ,
363376 " --ignore-file" ,
364377 " .continueignore" ,
365378 " --ignore-file" ,
366- " .gitignore" ,
367- " -C" ,
368- " 2" ,
369- " --heading" ,
370- " -e" ,
371- query,
379+ " .gitignore" ,
380+ " -C" ,
381+ " 2" ,
382+ " --heading" ,
383+ " -e" ,
384+ query,
372385 " ."
373386 )
374-
387+
375388 command.setWorkDirectory(project.basePath)
376389 return ExecUtil .execAndGetOutput(command).stdout
377390 } else {
@@ -415,7 +428,7 @@ class IntelliJIDE(
415428 // return searchResults.toString()
416429 }
417430 }
418-
431+
419432
420433 override suspend fun subprocess (command : String , cwd : String? ): List <Any > {
421434 val commandList = command.split(" " )
0 commit comments