Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Filter files
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaminus committed Jan 5, 2018
1 parent 21541ea commit 95563de
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function activate(context: vscode.ExtensionContext) {

//context.subscriptions.push(disposable1);

let previewUri = vscode.Uri.parse("js-preview://authority/js-preview");
let liveURI = vscode.Uri.parse("flowmaker://authority/flowmaker");

class TextDocumentContentProvider
implements vscode.TextDocumentContentProvider {
Expand Down Expand Up @@ -59,24 +59,26 @@ export function activate(context: vscode.ExtensionContext) {
return `<body>${svg}</body>`;
}
}

let provider = new TextDocumentContentProvider();

let registration = vscode.workspace.registerTextDocumentContentProvider(
"js-preview",
"flowmaker",
provider
);

vscode.workspace.onDidChangeTextDocument(
(e: vscode.TextDocumentChangeEvent) => {
if (e.document === vscode.window.activeTextEditor.document) {
provider.update(previewUri);
(caught: vscode.TextDocumentChangeEvent) => {
if (caught.document === vscode.window.activeTextEditor.document) {
provider.update(liveURI);
}
}
);

vscode.window.onDidChangeTextEditorSelection(
(e: vscode.TextEditorSelectionChangeEvent) => {
if (e.textEditor === vscode.window.activeTextEditor) {
provider.update(previewUri);
(caught: vscode.TextEditorSelectionChangeEvent) => {
if (caught.textEditor === vscode.window.activeTextEditor) {
provider.update(liveURI);
}
}
);
Expand All @@ -87,7 +89,7 @@ export function activate(context: vscode.ExtensionContext) {
return vscode.commands
.executeCommand(
"vscode.previewHtml",
previewUri,
liveURI,
vscode.ViewColumn.Two,
"flowmaker"
)
Expand Down

0 comments on commit 95563de

Please sign in to comment.