Skip to content

Commit 165b4fd

Browse files
authored
Support 'off' mode when fill the argument during completion (#3143)
- Change the option of 'java.completion.guessMethodArguments' from boolean to four options: "auto", "off", "insertParameterNames" and "insertBestGuessedArguments". Defaults to "auto", means that for VS Code Insiders, it will use "off", other platforms will use "insertBestGuessedArguments". Signed-off-by: Sheng Chen <[email protected]>
1 parent 9a0b66c commit 165b4fd

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ The following settings are supported:
141141
* `java.autobuild.enabled` : Enable/disable the 'auto build'.
142142
* `java.maxConcurrentBuilds`: Set max simultaneous project builds.
143143
* `java.completion.enabled` : Enable/disable code completion support.
144-
* `java.completion.guessMethodArguments` : When set to true, method arguments are guessed when a method is selected from as list of code assist proposals.
144+
* `java.completion.guessMethodArguments` : Specify how the arguments will be filled during completion. Defaults to `auto`.
145+
- `auto`: Use `off` only when using Visual Studio Code - Insiders, other platform will defaults to `insertBestGuessedArguments`.
146+
- `off`: Method arguments will not be inserted during completion.
147+
- `insertParameterNames`: The parameter names will be inserted during completion.
148+
- `insertBestGuessedArguments`: The best guessed arguments will be inserted during completion according to the code context.
145149
* `java.completion.filteredTypes`: Defines the type filters. All types whose fully qualified name matches the selected filter strings will be ignored in content assist or quick fix proposals and when organizing imports. For example 'java.awt.*' will hide all types from the awt packages.
146150
* `java.completion.favoriteStaticMembers` : Defines a list of static members or types with static members.
147151
* `java.completion.importOrder` : Defines the sorting order of import statements.

package.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,24 @@
548548
"scope": "window"
549549
},
550550
"java.completion.guessMethodArguments": {
551-
"type": "boolean",
552-
"default": true,
553-
"description": "When set to true, method arguments are guessed when a method is selected from as list of code assist proposals.",
551+
"type": [
552+
"boolean",
553+
"string"
554+
],
555+
"enum": [
556+
"auto",
557+
"off",
558+
"insertParameterNames",
559+
"insertBestGuessedArguments"
560+
],
561+
"enumDescriptions": [
562+
"Use 'off' only when using Visual Studio Code - Insiders, other platform will defaults to 'insertBestGuessedArguments'.",
563+
"Method arguments will not be inserted during completion.",
564+
"The parameter names will be inserted during completion.",
565+
"The best guessed arguments will be inserted during completion according to the code context."
566+
],
567+
"default": "auto",
568+
"description": "Specify how the arguments will be filled during completion.",
554569
"scope": "window"
555570
},
556571
"java.completion.favoriteStaticMembers": {

src/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ export function getJavaConfig(javaHome: string) {
209209
javaConfig.completion.matchCase = "firstLetter";
210210
}
211211

212+
const guessMethodArguments = javaConfig.completion.guessMethodArguments;
213+
if (guessMethodArguments === "auto") {
214+
javaConfig.completion.guessMethodArguments = isInsider ? "off" : "insertBestGuessedArguments";
215+
}
216+
212217
javaConfig.telemetry = { enabled: workspace.getConfiguration('redhat.telemetry').get('enabled', false) };
213218
return javaConfig;
214219
}

0 commit comments

Comments
 (0)