Skip to content

Commit

Permalink
feat: provide //Q:CONFIG completion if '//DEPS io.quarkus:quarkus' is…
Browse files Browse the repository at this point in the history
… found

Signed-off-by: Fred Bricon <fbricon@gmail.com>
  • Loading branch information
fbricon committed Oct 30, 2023
1 parent 75b4e51 commit 7cf2a4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/completion/DirectivesCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const KOTLIN = "//KOTLIN ";
const MODULE = "//MODULE ";
const MAIN = "//MAIN ";
const PREVIEW = "//PREVIEW";
const QUARKUS_DEP = "//DEPS io.quarkus:quarkus"; //pretend it's a directive

export class DirectivesCompletion implements CompletionParticipant {

applies(lineText: string, position: Position): boolean {
Expand Down Expand Up @@ -100,6 +102,9 @@ export class DirectivesCompletion implements CompletionParticipant {
if (!scanner.found(PREVIEW)) {
items.push(getCompletion(PREVIEW, "Enable Java preview features", range));
}
if (scanner.found(QUARKUS_DEP)) {
items.push(getCompletion("//Q:CONFIG ", "Quarkus configuration property", range));
}
return new CompletionList(items);
}
}
Expand All @@ -115,7 +120,7 @@ class DirectiveScanner {

scan(document: TextDocument) {
const checkedDirectives = [
JAVA, JAVAC_OPTIONS, COMPILE_OPTIONS, DESCRIPTION, CDS, GAV, JAVAAGENT, MANIFEST, JAVA_OPTIONS, RUNTIME_OPTIONS, NATIVE_OPTIONS, KOTLIN, GROOVY, MAIN, MODULE, PREVIEW
JAVA, JAVAC_OPTIONS, COMPILE_OPTIONS, DESCRIPTION, CDS, GAV, JAVAAGENT, MANIFEST, JAVA_OPTIONS, RUNTIME_OPTIONS, NATIVE_OPTIONS, KOTLIN, GROOVY, MAIN, MODULE, PREVIEW, QUARKUS_DEP
];
const lines = document.getText().split(/\r?\n/);
for (let i = 0; i < lines.length && checkedDirectives.length > 0; i++) {
Expand Down

0 comments on commit 7cf2a4a

Please sign in to comment.