Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 96 additions & 17 deletions 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 @@ -2024,7 +2024,7 @@
"mocha": "^11.1.0",
"request": "^2.88.2",
"sinon": "^14.0.0",
"style-loader": "^3.3.1",
"mini-css-extract-plugin": "^2.9.4",
"ts-loader": "^9.4.2",
"typescript": "^4.6.4",
"webpack": "^5.94.0",
Expand Down
19 changes: 9 additions & 10 deletions src/dashboard/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { getComputedJavaConfig, getWorkspacePath } from '../extension';
import { isLombokSupportEnabled, Lombok } from '../lombokSupport';
import { DashboardState, DiagnosticInfo, JVM, UpdateMessage } from '../webviewProtocol/toDashboard';
import { getNonce, getUri } from '../webviewUtils';
import { Uri } from 'vscode';
import * as path from 'path';

const currentState: DashboardState = {
};
Expand Down Expand Up @@ -110,27 +112,23 @@ class DashboardPanel {
}

private getWebviewContent(): string {
const scriptUri = getUri(this.webView, this.context.extensionUri, [
"dist",
"dashboard.js",
]);

const nonce = getNonce();
const codiconsUri = this.webView.asWebviewUri(vscode.Uri.joinPath(this.context.extensionUri, 'node_modules', '@vscode/codicons', 'dist', 'codicon.css'));
const scriptUri = getUri(this.webView, this.context.extensionUri, "dist", "dashboard.js");
const styleUri = getUri(this.webView, this.context.extensionUri, "dist", "dashboard.css");

return /* html*/ `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src ${this.webView.cspSource}; font-src ${this.webView.cspSource} data:; style-src ${this.webView.cspSource};">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link href="${codiconsUri}" rel="stylesheet" />
<title>Dashboard</title>
<link href="${styleUri}" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script nonce="${nonce}" src="${scriptUri}"></script>
<script src="${scriptUri}"></script>
</body>
</html>
`;
Expand Down Expand Up @@ -167,8 +165,9 @@ export namespace Dashboard {
enableScripts: true,
enableCommandUris: true,
retainContextWhenHidden: true,
localResourceRoots: [context.extensionUri]
localResourceRoots: [context.extensionUri],
});
webviewPanel.iconPath = Uri.file(path.join(context.extensionPath, 'icons', 'icon128.png'));
dashboardPanel = new DashboardPanel(webviewPanel.webview, context);

webviewPanel.onDidDispose(() => {
Expand Down
14 changes: 6 additions & 8 deletions src/refactoring/changeSignaturePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,24 @@ export class ChangeSignaturePanel {
}

private getWebviewContent(webview: Webview, extensionUri: Uri) {

const scriptUri = getUri(webview, extensionUri, [
"dist",
"changeSignature.js",
]);

const nonce = getNonce();
const scriptUri = getUri(webview, extensionUri, "dist", "changeSignature.js");
const styleUri = getUri(webview, extensionUri, "dist", "changeSignature.css");

return /* html*/ `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- We need the 'unsafe-inline' because of webview UI toolkit setting style attributes -->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src ${webview.cspSource}; font-src ${webview.cspSource} data:; style-src ${webview.cspSource} 'unsafe-inline';">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<title>Change Signature</title>
<link rel = "stylesheet" href="${styleUri}">
</head>
<body>
<div id="root"></div>
<script nonce="${nonce}" src="${scriptUri}"></script>
<script src="${scriptUri}"></script>
</body>
</html>
`;
Expand Down
2 changes: 2 additions & 0 deletions src/webview/dashboard/dashboard.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../../../node_modules/@vscode/codicons/dist/codicon.css";

.toolbar {
margin: 8px;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/webviewUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Uri, Webview } from "vscode";

export function getUri(webview: Webview, extensionUri: Uri, pathList: string[]) {
export function getUri(webview: Webview, extensionUri: Uri, ...pathList: string[]) {
return webview.asWebviewUri(Uri.joinPath(extensionUri, ...pathList));
}

Expand Down
12 changes: 10 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const config = {
},
}

const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const configChangeSignature = {
name: 'changeSignature',
mode: 'none',
Expand All @@ -70,7 +72,7 @@ const configChangeSignature = {
}, {
test: /\.(css)$/,
use: [{
loader: 'style-loader'
loader: MiniCssExtractPlugin.loader,
}, {
loader: 'css-loader'
}]
Expand All @@ -86,6 +88,9 @@ const configChangeSignature = {
devtoolModuleFilenameTemplate: "../[resource-path]"
},
plugins: [
new MiniCssExtractPlugin({
filename: 'changeSignature.css'
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
Expand Down Expand Up @@ -113,7 +118,7 @@ const configDashboard = {
}, {
test: /\.(css)$/,
use: [{
loader: 'style-loader'
loader: MiniCssExtractPlugin.loader,
}, {
loader: 'css-loader'
}]
Expand All @@ -129,6 +134,9 @@ const configDashboard = {
devtoolModuleFilenameTemplate: "../[resource-path]"
},
plugins: [
new MiniCssExtractPlugin({
filename: 'dashboard.css'
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
Expand Down