mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
[Java] Merge logic for placing double dashed and X options in terminal completion
IDEA-359245 IDEA-359244 GitOrigin-RevId: 380aa5580d6ecdf166976fa792be089f2637f2f0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a3c9ca4918
commit
db497809f5
@@ -14,6 +14,7 @@ java.command.terminal.argument.main.class.text=mainclass
|
||||
java.command.terminal.default.argument.text=value
|
||||
java.command.terminal.batch.option.description=Disable background compilation.
|
||||
java.command.terminal.bootclasspath/a.option.description=Append to end of bootstrap class path.
|
||||
java.command.terminal.bootclasspath/a.option.argument.text=path
|
||||
java.command.terminal.check.jni.option.description=Perform additional checks for JNI functions.
|
||||
java.command.terminal.comp.option.description=Forces compilation of methods on first invocation.
|
||||
java.command.terminal.debug.option.description=Does nothing. Provided for backward compatibility.
|
||||
@@ -22,11 +23,16 @@ java.command.terminal.future.option.description=Enable strictest checks, anticip
|
||||
java.command.terminal.int.option.description=Interpreted mode execution only.
|
||||
java.command.terminal.internalversion.option.description=Display more detailed JVM version information than the -version option.
|
||||
java.command.terminal.log.option.description=Configure or enable logging with the Java Virtual Machine (JVM) unified logging framework. Use -Xlog:help for details.
|
||||
java.command.terminal.log.option.argument.text=opts
|
||||
java.command.terminal.loggc.option.description=Log GC status to a file with time stamps. This option is deprecated and may be removed in a future release. It is replaced by -Xlog:gc:<file>.
|
||||
java.command.terminal.loggc.option.argument.text=file
|
||||
java.command.terminal.mixed.option.description=Mixed mode execution (default).
|
||||
java.command.terminal.mn.option.description=Set the initial and maximum size (in bytes) of the heap for the young generation (nursery).
|
||||
java.command.terminal.mn.option.argument.text=size
|
||||
java.command.terminal.ms.option.description=Set the initial Java heap size.
|
||||
java.command.terminal.ms.option.argument.text=size
|
||||
java.command.terminal.mx.option.description=Set maximum Java heap size.
|
||||
java.command.terminal.mx.option.argument.text=size
|
||||
java.command.terminal.noclassgc.option.description=Disable class garbage collection.
|
||||
java.command.terminal.rs.option.description=Reduce use of OS signals by Java/VM (see documentation).
|
||||
java.command.terminal.share.auto.option.description=Use shared class data if possible (default).
|
||||
@@ -39,9 +45,12 @@ java.command.terminal.showSettings.properties.option.description=Show all proper
|
||||
java.command.terminal.showSettings.vm.option.description=Show all vm related settings and continue.
|
||||
java.command.terminal.showSettings.system.option.description=(Linux Only) Show host system or container configuration and continue.
|
||||
java.command.terminal.ss.option.description=Set java thread stack size The actual size may be rounded up to a multiple of the system page size as required by the operating system.
|
||||
java.command.terminal.ss.option.argument.text=size
|
||||
java.command.terminal.verify.option.description=Sets the mode of the bytecode verifier Note that option -Xverify:none is deprecated and may be removed in a future release.
|
||||
java.command.terminal.bootclasspath.option.description=Set the search path for bootstrap classes and resources.
|
||||
java.command.terminal.bootclasspath.option.argument.text=path
|
||||
java.command.terminal.bootclasspath/p.option.description=Prepend in front of the bootstrap class path.
|
||||
java.command.terminal.bootclasspath/p.option.argument.text=path
|
||||
java.command.terminal.incgc.option.description=Enable incremental garbage collection.
|
||||
java.command.terminal.prof.option.description=Output cpu profiling data.
|
||||
java.command.terminal.add.reads.option.description=Updates \\<module\\> to read \\<target-module\\>, regardless of module declaration. \\<target-module\\> can be ALL-UNNAMED to read all unnamed modules.
|
||||
|
||||
@@ -74,41 +74,30 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
|
||||
val jdkOptionsData = withContext(Dispatchers.IO) {
|
||||
VMOptionsService.getInstance().getOrComputeOptionsForJdk(path).get() ?: return@withContext null
|
||||
} ?: return
|
||||
val variantMap = jdkOptionsData.options
|
||||
.filter { (it.kind == VMOptionKind.Standard || it.kind == VMOptionKind.Product) }
|
||||
.groupBy { it.variant }
|
||||
variantMap[VMOptionVariant.X]?.forEach {
|
||||
val presentableName = "${it.variant.prefix()}${it.optionName}"
|
||||
option(presentableName) {
|
||||
repeatTimes = 1
|
||||
|
||||
if (JavaTerminalBundle.isMessageInBundle(getOptionBundleKey(it.optionName))) {
|
||||
description(JavaTerminalBundle.message(getOptionBundleKey(it.optionName)))
|
||||
}
|
||||
else {
|
||||
LOG.warn("Unknown X option: \"${it.optionName}\". Paste following string into the JavaTerminalBundle.properties:\n" +
|
||||
"${getOptionBundleKey(it.optionName)}=${it.doc}")
|
||||
}
|
||||
|
||||
if (!KNOWN_OPTIONS_WITH_EMPTY_SEPARATOR.contains(presentableName)) return@option
|
||||
separator = it.variant.suffix()?.toString() ?: ""
|
||||
argument {
|
||||
displayName(JavaTerminalBundle.message("java.command.terminal.default.argument.text"))
|
||||
}
|
||||
}
|
||||
}
|
||||
variantMap[VMOptionVariant.DASH_DASH]?.forEach {
|
||||
jdkOptionsData.options
|
||||
.filter { (it.kind == VMOptionKind.Standard || it.kind == VMOptionKind.Product) &&
|
||||
(it.variant == VMOptionVariant.X || it.variant == VMOptionVariant.DASH_DASH)}
|
||||
.toList()
|
||||
.forEach {
|
||||
val optionName = it.optionName
|
||||
val presentableName = "${it.variant.prefix()}$optionName"
|
||||
option(presentableName) {
|
||||
if (!JavaTerminalBundle.isMessageInBundle(getOptionBundleKey(optionName))) {
|
||||
LOG.warn("Unknown DashDash option: \"$optionName\". Provide ${getOptionBundleKey(optionName)} and ${getOptionArgumentBundleKey(optionName)}")
|
||||
LOG.warn("Unknown ${it.variant} option: \"$optionName\". Provide ${getOptionBundleKey(optionName)} and [${getOptionArgumentBundleKey(optionName)}]")
|
||||
return@option
|
||||
}
|
||||
description(JavaTerminalBundle.message(getOptionBundleKey(optionName)))
|
||||
|
||||
if (!JavaTerminalBundle.isMessageInBundle(getOptionArgumentBundleKey(optionName))) return@option
|
||||
if (KNOWN_REPETITIVE_OPTIONS.contains(presentableName)) repeatTimes = 0
|
||||
if (KNOWN_OPTIONS_WITH_EMPTY_SEPARATOR.contains(presentableName)) separator = ""
|
||||
|
||||
if(it.variant == VMOptionVariant.DASH_DASH) {
|
||||
if (KNOWN_REPETITIVE_OPTIONS.contains(presentableName)) repeatTimes = 0
|
||||
if (KNOWN_OPTIONS_WITH_EMPTY_SEPARATOR.contains(presentableName)) separator = ""
|
||||
} else if (it.variant == VMOptionVariant.X) {
|
||||
if (!KNOWN_X_OPTIONS_WITH_ARGUMENT.contains(presentableName)) return@option
|
||||
separator = it.variant.suffix()?.toString() ?: ""
|
||||
}
|
||||
|
||||
argument {
|
||||
displayName(JavaTerminalBundle.message(getOptionArgumentBundleKey(optionName)))
|
||||
}
|
||||
@@ -150,7 +139,7 @@ class JavaShellCommandSpecsProvider : ShellCommandSpecsProvider {
|
||||
private fun getCanonicalOptionName(option: String): String = option.replace(Regex("[:|\\-]"), ".").trim('=', '.')
|
||||
}
|
||||
|
||||
private val KNOWN_OPTIONS_WITH_EMPTY_SEPARATOR = setOf(
|
||||
private val KNOWN_X_OPTIONS_WITH_ARGUMENT = setOf(
|
||||
"-Xms",
|
||||
"-Xmx",
|
||||
"-Xmn",
|
||||
@@ -160,6 +149,9 @@ private val KNOWN_OPTIONS_WITH_EMPTY_SEPARATOR = setOf(
|
||||
"-Xbootclasspath/p:",
|
||||
"-Xlog:",
|
||||
"-Xloggc:",
|
||||
)
|
||||
|
||||
private val KNOWN_OPTIONS_WITH_EMPTY_SEPARATOR = setOf(
|
||||
"--finalization=",
|
||||
"--illegal-access="
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user