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
| const index = join(context.extensionPath, 'studio/index.html'); | |
| // Refresh the webview on update from the code | |
| const updateWebview = async () => { | |
| const html = await fs.readFile(index, 'utf-8'); | |
| panel.webview.html = html.replace(matchLinks, toUri); | |
| } | |
| // In dev mode listen on changes from index.html & update the view | |
| if (!environment.production) { |
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 { commands, ExtensionContext, window } from 'vscode'; | |
| // On activation | |
| export function activate(context: ExtensionContext) { | |
| // Register command "start" | |
| commands.registerCommand('start', () => { | |
| window.showInformationMessage('Hello World'); | |
| }) | |
| } |
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 { promises as fs } from 'fs'; // Require @types/node@latest | |
| import { join } from 'path'; | |
| // On activation | |
| export function activate(context: ExtensionContext) { | |
| // Register command "start" | |
| commands.registerCommand('start', async () => { | |
| ... | |
| const indexPath = join(context.extensionPath, 'studio/index.html'); | |
| const html = await fs.readFile(indexPath, 'utf-8'); |
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
| { | |
| "version": "0.2.0", | |
| "configurations": [{ | |
| "name": "Run Extension In Dev Mode", | |
| "type": "extensionHost", | |
| "request": "launch", | |
| "runtimeExecutable": "${execPath}", | |
| "args": [ | |
| "--extensionDevelopmentPath=${workspaceFolder}/dist/apps/vs-code" | |
| ], |
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
| const html = await fs.readFile(join(context.extensionPath, 'studio/index.html'), 'utf-8'); | |
| // 1. Get all link prefixed by href or src | |
| const matchLinks = /(href|src)="([^"]*)"/g; | |
| // 2. Transform the result of the regex into a vscode's URI format | |
| const toUri = (_, prefix: 'href' | 'src', link: string) => { | |
| // For | |
| if (link === '#') { | |
| return `${prefix}="${link}"`; | |
| } |
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
| class Client { | |
| on(message) { | |
| this.call(message) | |
| } | |
| // hooked by "connectClient" | |
| call(message) {} | |
| } | |
| function connectClient(client) { | |
| host.on((msg) => client.on(msg)) | |
| client['call'] = (msg) => host.send(`Modified by realm: ${msg}`) |
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 { Component } from '@angular/core'; | |
| import { FormGroupSchema, createForms } from 'ng-form-factory'; | |
| import { MatTextSchema } from './text-form/text-form.component'; | |
| interface Person { | |
| firstName: string; | |
| lastName: string; | |
| } | |
| const schema: FormGroupSchema<Person> = { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.