Skip to content

Releases: lxz12523/vscode

Custom Menu and Custom browerWindows

18 Jul 13:02
Compare
Choose a tag to compare
add custom command :workbench.action.openBrowserWindow

1)extension devloper can call workbench.action.openBrowserWindow with a html page to
show a BrowerWindow
2)extension devloper can register channel with custom command,
Rendered Windows use ipcRenderer.send('configPage', inputText.value)
to call the command bind with channel

		const extensionPath = vscode.Uri.file(__dirname);//extensionUri
		console.log("__dirname:" + __dirname);
		let url =path.join(__dirname, "..", "ui", "createWindow", "index.html");
		console.log("path of index:" + url);
		let url1 = pathToFileURL(url);
		vscode.commands.executeCommand("workbench.action.openBrowserWindow", [
			{
				winId: "pageConfig",
				height: 200,
				width: 300,
				darkBackgroundColor: "#3E475B",
				lightBackgroundColor: "#FFF",
				// c:\Users\z00356184\.vscode-oss\extensions\someone.vscode-plugin-demo-0.0.1\out\ui\createWindow\index.html
				loadURL: url1.href,
				data: {
					theme: vscode.workspace
						.getConfiguration()
						.get("workbench.colorTheme"),
					overseasFlag: false,
					height: 200,
					width:  300,
				},
				events: [
					{
						channel: "configPage",
						command: "configPage",
					},
				],
			},
		]).then(() => {

		});