sprotty-vscode
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -31,2 +31,3 @@ /******************************************************************************** | ||
} | ||
export declare function isDiagramIdentifier(object: any): object is SprottyDiagramIdentifier; | ||
export declare const acceptMessageType: NotificationType<ActionMessage, void>; | ||
@@ -33,0 +34,0 @@ export declare const didCloseMessageType: NotificationType<string, void>; |
@@ -27,2 +27,6 @@ "use strict"; | ||
exports.isActionMessage = isActionMessage; | ||
function isDiagramIdentifier(object) { | ||
return object !== undefined && object.hasOwnProperty('clientId') && object.hasOwnProperty('diagramType') && object.hasOwnProperty('uri'); | ||
} | ||
exports.isDiagramIdentifier = isDiagramIdentifier; | ||
///////////////////////////////////// | ||
@@ -29,0 +33,0 @@ // LSP extensions |
@@ -16,4 +16,2 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import * as vscode from 'vscode'; | ||
import { ActionMessage, SprottyDiagramIdentifier } from './protocol'; | ||
import { SprottyVscodeLanguageExtension } from './sprotty-vscode-language-extension'; | ||
@@ -25,8 +23,2 @@ import { SprottyWebview, SprottyWebviewOptions } from './sprotty-webview'; | ||
readonly extension: SprottyVscodeLanguageExtension; | ||
readonly diagramIdentifier: SprottyDiagramIdentifier; | ||
readonly scriptPath: string; | ||
readonly title: any; | ||
readonly diagramPanel: vscode.WebviewPanel; | ||
protected messageQueue: ActionMessage[]; | ||
protected disposables: vscode.Disposable[]; | ||
constructor(options: SprottyWebviewOptions); | ||
@@ -33,0 +25,0 @@ protected connect(): Promise<void>; |
@@ -74,4 +74,2 @@ "use strict"; | ||
_this.options = options; | ||
_this.messageQueue = []; | ||
_this.disposables = []; | ||
if (!(options.extension instanceof sprotty_vscode_language_extension_1.SprottyVscodeLanguageExtension)) | ||
@@ -88,3 +86,3 @@ throw new Error('SprottyLanguageWebview must be initialized with a SprottyVscodeLanguageExtension'); | ||
_this.disposables.push(_this.extension.onAcceptFromLanguageServer(function (message) { return _this.sendToWebview(message); })); | ||
_this.diagramPanel.webview.postMessage(_this.diagramIdentifier); | ||
_this.sendToWebview(_this.diagramIdentifier); | ||
}); | ||
@@ -91,0 +89,0 @@ return [2 /*return*/]; |
@@ -34,3 +34,3 @@ /******************************************************************************** | ||
readonly diagramPanel: vscode.WebviewPanel; | ||
protected messageQueue: ActionMessage[]; | ||
protected messageQueue: (ActionMessage | SprottyDiagramIdentifier)[]; | ||
protected disposables: vscode.Disposable[]; | ||
@@ -37,0 +37,0 @@ constructor(options: SprottyWebviewOptions); |
@@ -115,3 +115,3 @@ "use strict"; | ||
SprottyWebview.prototype.sendToWebview = function (message) { | ||
if (protocol_1.isActionMessage(message)) { | ||
if (protocol_1.isActionMessage(message) || protocol_1.isDiagramIdentifier(message)) { | ||
if (this.diagramPanel.visible) | ||
@@ -118,0 +118,0 @@ this.diagramPanel.webview.postMessage(message); |
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"engines": { | ||
@@ -35,4 +35,5 @@ "vscode": "^1.27.2" | ||
"watch": "tsc -w", | ||
"lint": "tslint -c ./tslint.json --project ./tsconfig.json", | ||
"prepare": "node ./node_modules/vscode/bin/install && yarn build" | ||
} | ||
} |
@@ -48,2 +48,6 @@ /******************************************************************************** | ||
export function isDiagramIdentifier(object: any): object is SprottyDiagramIdentifier { | ||
return object !== undefined && object.hasOwnProperty('clientId') && object.hasOwnProperty('diagramType') && object.hasOwnProperty('uri'); | ||
} | ||
///////////////////////////////////// | ||
@@ -50,0 +54,0 @@ // LSP extensions |
@@ -17,4 +17,3 @@ /******************************************************************************** | ||
import * as vscode from 'vscode'; | ||
import { acceptMessageType, ActionMessage, isActionMessage, SprottyDiagramIdentifier } from './protocol'; | ||
import { acceptMessageType, isActionMessage } from './protocol'; | ||
import { SprottyVscodeLanguageExtension } from './sprotty-vscode-language-extension'; | ||
@@ -28,10 +27,3 @@ import { SprottyWebview, SprottyWebviewOptions } from './sprotty-webview'; | ||
readonly extension: SprottyVscodeLanguageExtension; | ||
readonly diagramIdentifier: SprottyDiagramIdentifier; | ||
readonly scriptPath: string; | ||
readonly title: any; | ||
readonly diagramPanel: vscode.WebviewPanel; | ||
protected messageQueue: ActionMessage[] = []; | ||
protected disposables: vscode.Disposable[] = []; | ||
constructor(protected options: SprottyWebviewOptions) { | ||
@@ -47,3 +39,3 @@ super(options); | ||
this.disposables.push(this.extension.onAcceptFromLanguageServer(message => this.sendToWebview(message))); | ||
this.diagramPanel.webview.postMessage(this.diagramIdentifier); | ||
this.sendToWebview(this.diagramIdentifier); | ||
}); | ||
@@ -50,0 +42,0 @@ } |
@@ -115,4 +115,4 @@ /******************************************************************************** | ||
} | ||
if (vscode.window.activeTextEditor) | ||
return vscode.window.activeTextEditor.document.uri | ||
if (vscode.window.activeTextEditor) | ||
return vscode.window.activeTextEditor.document.uri; | ||
return undefined; | ||
@@ -119,0 +119,0 @@ } |
@@ -18,3 +18,3 @@ /******************************************************************************** | ||
import * as vscode from 'vscode'; | ||
import { ActionMessage, isActionMessage, SprottyDiagramIdentifier, Action } from './protocol'; | ||
import { ActionMessage, isActionMessage, SprottyDiagramIdentifier, Action, isDiagramIdentifier } from './protocol'; | ||
import { SprottyVscodeExtension } from './sprotty-vscode-extension'; | ||
@@ -40,3 +40,3 @@ | ||
protected messageQueue: ActionMessage[] = []; | ||
protected messageQueue: (ActionMessage | SprottyDiagramIdentifier)[] = []; | ||
protected disposables: vscode.Disposable[] = []; | ||
@@ -119,3 +119,3 @@ | ||
protected sendToWebview(message: any) { | ||
if (isActionMessage(message)) { | ||
if (isActionMessage(message) || isDiagramIdentifier(message)) { | ||
if (this.diagramPanel.visible) | ||
@@ -122,0 +122,0 @@ this.diagramPanel.webview.postMessage(message); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
68072
1130