Skip to content

Commit

Permalink
feat: provide //PREVIEW support
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Jun 23, 2023
1 parent 314d239 commit d93666a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

All notable changes to the **JBang** extension will be documented in this file.

## [0.7.0] TBD
## [0.7.0] 23/06/2023
- Update JBang catalog schema (from jbang-idea)
- Added completion for `//PREVIEW` (requires JBang 0.108.0+)


## [0.6.0] 24/02/2023
- Added autocompletion for [`jbang-catalog.json`](https://www.jbang.dev/documentation/guide/latest/alias_catalogs.html) files.
- Added completion for `//MODULE` and `//MAIN` directives (require JBang 0.104.0+)
- Added completion for `//MODULE` and `//MAIN` directives (requires JBang 0.104.0+)
- Added JBang debug icon
- Fixed hover failing over LATEST versions
- Allowed completion for several `//DESCRIPTION` directives
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jbang-vscode",
"displayName": "JBang",
"description": "JBang support for VS Code Java",
"version": "0.6.1",
"version": "0.7.0",
"icon": "icons/jbang.png",
"publisher": "jbangdev",
"license": "MIT",
Expand Down
6 changes: 5 additions & 1 deletion src/completion/DirectivesCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const GROOVY = "//GROOVY ";
const KOTLIN = "//KOTLIN ";
const MODULE = "//MODULE ";
const MAIN = "//MAIN ";
const PREVIEW = "//PREVIEW";
export class DirectivesCompletion implements CompletionParticipant {

applies(lineText: string, position: Position): boolean {
Expand Down Expand Up @@ -96,6 +97,9 @@ export class DirectivesCompletion implements CompletionParticipant {
if (!scanner.found(NATIVE_OPTIONS)) {
items.push(getCompletion(NATIVE_OPTIONS, "Options passed to the native image builder", range));
}
if (!scanner.found(PREVIEW)) {
items.push(getCompletion(PREVIEW, "Enable Java preview features", range));
}
return items;
}
}
Expand All @@ -111,7 +115,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
JAVA, JAVAC_OPTIONS, COMPILE_OPTIONS, DESCRIPTION, CDS, GAV, JAVAAGENT, MANIFEST, JAVA_OPTIONS, RUNTIME_OPTIONS, NATIVE_OPTIONS, KOTLIN, GROOVY, MAIN, MODULE, PREVIEW
];
const lines = document.getText().split(/\r?\n/);
for (let i = 0; i < lines.length && checkedDirectives.length > 0; i++) {
Expand Down

0 comments on commit d93666a

Please sign in to comment.