[Java] Implement logic for placing separator after option in new terminal completion.

IDEA-359375

GitOrigin-RevId: 90bd91f7ec3f0322ec8dc19ab8e4209266bfaf88
This commit is contained in:
Georgii Ustinov
2024-09-19 12:09:10 +03:00
committed by intellij-monorepo-bot
parent 305b11607a
commit 6e38f27c33

View File

@@ -12,12 +12,16 @@ import javax.swing.Icon
internal object TerminalCompletionUtil {
fun getNextSuggestionsString(suggestion: ShellCompletionSuggestion): String {
var separator: String? = null
val result = when (suggestion) {
is ShellCommandSpec -> getNextOptionsAndArgumentsString(suggestion)
is ShellOptionSpec -> getNextArgumentsString(suggestion.arguments)
is ShellOptionSpec -> {
separator = suggestion.separator
getNextArgumentsString(suggestion.arguments)
}
else -> ""
}
return if (result.isNotEmpty()) " $result" else ""
return if (result.isNotEmpty()) "${separator ?: " "}$result" else ""
}
/** Returns required options and all arguments */