Skip to content

Commit 8d7cb38

Browse files
committed
Release 0.0.77
1 parent b81dbd3 commit 8d7cb38

6 files changed

Lines changed: 31 additions & 60 deletions

File tree

client/.vscodeignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ test/**
3232
# Server artifacts (Java project)
3333
../server/**
3434
server/**
35-
# But include the built JAR
36-
!server/language-server-liquidjava.jar
3735

3836
# Misc
3937
.DS_Store

client/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "liquid-java",
33
"displayName": "LiquidJava",
44
"description": "Extending Java with Liquid Types",
5-
"version": "0.0.76",
5+
"version": "0.0.77",
66
"publisher": "AlcidesFonseca",
77
"repository": {
88
"type": "git",

client/src/services/webview.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ export function registerWebview(context: vscode.ExtensionContext) {
1717
// show view command
1818
context.subscriptions.push(
1919
vscode.commands.registerCommand("liquidjava.showView", async (diagnostic?: DiagnosticRevealTarget) => {
20-
if (vscode.env.uiKind === vscode.UIKind.Web) {
21-
extension.webview?.showPanel();
22-
} else {
23-
await vscode.commands.executeCommand("liquidJavaView.focus");
24-
}
20+
await vscode.commands.executeCommand("liquidJavaView.focus");
2521
if (diagnostic) extension.webview?.sendMessage({ type: "revealDiagnostic", diagnostic });
2622
})
2723
);

client/src/webview/provider.ts

Lines changed: 20 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import { highlightRange, openFile } from '../services/editor';
88
*/
99
export class LiquidJavaWebviewProvider implements vscode.WebviewViewProvider {
1010
public static readonly viewType = "liquidJavaView";
11-
public static readonly panelType = "liquidJavaPanel";
1211
private view?: vscode.WebviewView;
13-
private panel?: vscode.WebviewPanel;
1412
private messageEmitter = new vscode.EventEmitter<any>();
1513
public readonly onDidReceiveMessage = this.messageEmitter.event;
1614

@@ -22,7 +20,25 @@ export class LiquidJavaWebviewProvider implements vscode.WebviewViewProvider {
2220
_token: vscode.CancellationToken
2321
) {
2422
this.view = webviewView;
25-
this.initializeWebview(webviewView.webview);
23+
webviewView.webview.options = {
24+
enableScripts: true,
25+
localResourceRoots: [this.extensionUri]
26+
};
27+
webviewView.webview.html = this.getHtml(webviewView.webview);
28+
29+
// listen for messages coming from webview
30+
webviewView.webview.onDidReceiveMessage(message => {
31+
// emit the message to any external listeners
32+
this.messageEmitter.fire(message);
33+
34+
// handle message
35+
if (message.type === "openFile") {
36+
openFile(message.filePath, message.line, message.character, message.highlightRange);
37+
} else if (message.type === "highlight") {
38+
// highlight the specified range in the current editor
39+
highlightRange(vscode.window.activeTextEditor, message.range);
40+
}
41+
});
2642
}
2743

2844
/**
@@ -31,37 +47,14 @@ export class LiquidJavaWebviewProvider implements vscode.WebviewViewProvider {
3147
*/
3248
public sendMessage(message: any) {
3349
this.view?.webview.postMessage(message);
34-
this.panel?.webview.postMessage(message);
3550
}
3651

3752
/**
3853
* Checks if the webview is currently visible
3954
* @returns true if the webview is visible, false otherwise
4055
*/
4156
public isVisible(): boolean {
42-
return (this.view?.visible ?? false) || (this.panel?.visible ?? false);
43-
}
44-
45-
public showPanel() {
46-
if (this.panel) {
47-
this.panel.reveal(vscode.ViewColumn.Beside);
48-
return;
49-
}
50-
51-
this.panel = vscode.window.createWebviewPanel(
52-
LiquidJavaWebviewProvider.panelType,
53-
"LiquidJava",
54-
vscode.ViewColumn.Beside,
55-
{
56-
enableScripts: true,
57-
localResourceRoots: [this.extensionUri]
58-
}
59-
);
60-
61-
this.initializeWebview(this.panel.webview);
62-
this.panel.onDidDispose(() => {
63-
this.panel = undefined;
64-
});
57+
return this.view?.visible ?? false;
6558
}
6659

6760
/**
@@ -72,26 +65,4 @@ export class LiquidJavaWebviewProvider implements vscode.WebviewViewProvider {
7265
private getHtml(webview: vscode.Webview): string {
7366
return getHtml(webview, this.extensionUri);
7467
}
75-
76-
private initializeWebview(webview: vscode.Webview) {
77-
webview.options = {
78-
enableScripts: true,
79-
localResourceRoots: [this.extensionUri]
80-
};
81-
webview.html = this.getHtml(webview);
82-
83-
// listen for messages coming from webview
84-
webview.onDidReceiveMessage(message => {
85-
// emit the message to any external listeners
86-
this.messageEmitter.fire(message);
87-
88-
// handle message
89-
if (message.type === "openFile") {
90-
openFile(message.filePath, message.line, message.character, message.highlightRange);
91-
} else if (message.type === "highlight") {
92-
// highlight the specified range in the current editor
93-
highlightRange(vscode.window.activeTextEditor, message.range);
94-
}
95-
});
96-
}
9768
}

client/src/webview/styles.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
export function getStyles(): string {
77
return /*css*/`
88
html,
9-
body,
9+
body {
10+
width: 100%;
11+
height: 100%;
12+
margin: 0;
13+
box-sizing: border-box;
14+
}
1015
#root {
1116
width: 100%;
1217
min-height: 100%;
@@ -19,6 +24,7 @@ export function getStyles(): string {
1924
box-sizing: inherit;
2025
}
2126
body {
27+
height: 100%;
2228
padding: 1rem;
2329
font-family: var(--vscode-font-family);
2430
overflow: auto;

0 commit comments

Comments
 (0)