Skip to content

Commit ac73700

Browse files
authored
Support case matching for code completion (#2834)
Signed-off-by: sheche <[email protected]>
1 parent 042f1ca commit ac73700

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,22 @@
573573
"markdownDescription": "Enable/disable postfix completion support. `#editor.snippetSuggestions#` can be used to customize how postfix snippets are sorted.",
574574
"scope": "window"
575575
},
576+
"java.completion.matchCase": {
577+
"type": "string",
578+
"enum": [
579+
"auto",
580+
"firstLetter",
581+
"off"
582+
],
583+
"enumDescriptions": [
584+
"Only match case for the first letter when using Visual Studio Code - Insiders.",
585+
"Match case for the first letter when doing completion.",
586+
"Do not match case when doing completion."
587+
],
588+
"default": "auto",
589+
"markdownDescription": "Specify whether to match case for code completion.",
590+
"scope": "window"
591+
},
576592
"java.foldingRange.enabled": {
577593
"type": "boolean",
578594
"default": true,

src/utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ export function getJavaConfig(javaHome: string) {
188188
const editorConfig = workspace.getConfiguration('editor');
189189
javaConfig.format.insertSpaces = editorConfig.get('insertSpaces');
190190
javaConfig.format.tabSize = editorConfig.get('tabSize');
191+
const isInsider: boolean = version.includes("insider");
191192
const androidSupport = javaConfig.jdt.ls.androidSupport.enabled;
192193
switch (androidSupport) {
193194
case "auto":
194-
javaConfig.jdt.ls.androidSupport.enabled = version.includes("insider") ? true : false;
195+
javaConfig.jdt.ls.androidSupport.enabled = isInsider;
195196
break;
196197
case "on":
197198
javaConfig.jdt.ls.androidSupport.enabled = true;
@@ -203,5 +204,10 @@ export function getJavaConfig(javaHome: string) {
203204
javaConfig.jdt.ls.androidSupport.enabled = false;
204205
break;
205206
}
207+
208+
const completionCaseMatching = javaConfig.completion.matchCase;
209+
if (completionCaseMatching === "auto") {
210+
javaConfig.completion.matchCase = isInsider ? "firstLetter" : "off";
211+
}
206212
return javaConfig;
207213
}

0 commit comments

Comments
 (0)