This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"activationEvents": [ | |
"*" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"contributes": { | |
"menus": { | |
"editor/context": [ | |
{ | |
"command": "kogito-tooling-examples.todo-list-view.add-item" | |
} | |
] | |
}, | |
"commands": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"main": "./dist/extension.js", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"engines": { | |
"vscode": "^1.46.0" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"publisher": "kogito-tooling-examples", | |
"name": "todo-list-view-vscode-extension", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public open(pageId: string, opts: { onClose: () => void }) { | |
// ... | |
this.context.subscriptions.push( | |
webviewPanel.webview.onDidReceiveMessage( | |
(msg) => envelopeServer.receive(msg, this.api), | |
webviewPanel.webview, | |
this.context.subscriptions | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public open(pageId: string, opts: { onClose: () => void }) { | |
// ... | |
const scriptSrc = webviewPanel.webview | |
.asWebviewUri(Uri.file(this.context.asAbsolutePath(this.envelopeLocator.envelopePath))) | |
.toString(); | |
webviewPanel.webview.html = `<!DOCTYPE html> | |
<html lang="en"> | |
<head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public open(pageId: string, opts: { onClose: () => void }) { | |
// ... | |
const envelopeServer: EnvelopeServer<TodoListChannelApi, TodoListEnvelopeApi> = new EnvelopeServer( | |
{ postMessage: (message) => webviewPanel.webview.postMessage(message) }, | |
this.envelopeLocator.targetOrigin, | |
() => | |
envelopeServer.manager.clientApi.requests.todoList__init( | |
{ origin: envelopeServer.origin, envelopeServerId: envelopeServer.id }, | |
{ user: "Tiago" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public open(pageId: string, opts: { onClose: () => void }) { | |
const webviewPanel = vscode.window.createWebviewPanel(pageId, this.envelopeLocator.title, ViewColumn.Beside, { | |
retainContextWhenHidden: true, | |
enableCommandUris: true, | |
enableScripts: true, | |
localResourceRoots: [vscode.Uri.file(this.context.extensionPath)], | |
}); | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as vscode from "vscode"; | |
import { TodoListChannelApi } from "../api"; | |
export class TodoListWebview { | |
constructor( | |
private readonly context: vscode.ExtensionContext, | |
private readonly envelopeLocator: { | |
targetOrigin: string; | |
title: string; | |
envelopePath: string; |