[Java] Update parser options so java command options are not treated as posix arguments

IDEA-359564

GitOrigin-RevId: 287249e197bacb2452b44bd0b11286eadd5ba4ee
This commit is contained in:
Georgii Ustinov
2024-09-27 09:13:46 +00:00
committed by intellij-monorepo-bot
parent a00b5d5ce2
commit 44e3345c64
@@ -5,6 +5,7 @@ import com.intellij.execution.vmOptions.VMOptionKind
import com.intellij.execution.vmOptions.VMOptionVariant
import com.intellij.execution.vmOptions.VMOptionsService
import com.intellij.openapi.diagnostic.Logger
import com.intellij.terminal.completion.spec.ShellCommandParserOptions
import com.intellij.terminal.completion.spec.ShellCommandSpec
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@@ -18,6 +19,8 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
}
private fun getSpecs(): ShellCommandSpec = ShellCommandSpec("java") {
parserOptions = ShellCommandParserOptions.create(flagsArePosixNonCompliant = true, optionsMustPrecedeArguments = true)
dynamicOptions { terminalContext ->
val javaContext = JavaShellCommandContext.create(terminalContext)
addOptionsFromVM(javaContext?.getJrePath())