@remixproject/engine-vscode
The **vscode engine** provides a list of connectors & plugins for a **plugin engine** that is built inside vscode. ``` npm install @remixproject/engine-vscode ```
Last updated 11 days ago by grandschtroumpf .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @remixproject/engine-vscode 
SYNC missed versions from official npm registry.

Engine vscode

The vscode engine provides a list of connectors & plugins for a plugin engine that is built inside vscode.

npm install @remixproject/engine-vscode

Setup

You can use the remixproject engine to create a plugin system on top of a vscode extension. For that you need to create an engine and start registering your plugins.

checkout @remixproject/engine documentation for more details.

import { Engine, Manager } from '@remixproject/engine';

export async function activate(context: ExtensionContext) {
  const manager = new Manager();
  const engine = new Engine();
}

Build-in plugins

@remixproject/engine-vscode comes with build-in plugins for vscode.

webview

The webview plugin opens a webview in the workspace and connects to it. The plugin must use @remixproject/plugin-webview to be able to establish connection.

import { WebviewPlugin } from '@remixproject/engine-vscode'
import { Engine, Manager } from '@remixproject/engine';

export async function activate(context: ExtensionContext) {
  const manager = new Manager();
  const engine = new Engine();
  const webview = new WebviewPlugin({
    name: 'webview-plugin',
    url: 'https://my-plugin-path.com',
    methods: ['getData']
  }, { context }) // We need to pass the context as scond parameter
  engine.register([manager, webview]);
  // This will create the webview and inject the code inside
  await manager.activatePlugin('webview-plugin');
  const data = manager.call('webview-plugin', 'getData');
}

The url can be :

  • remote
  • absolute
  • relative to the extension file (option.relativeTo === 'extension')
  • relative to the open workspace (option.relativeTo === 'workspace')

The url can also be local. In this case you must provide an absolute path.

Options

  • context: The context of the vscode extension.
  • column: The ViewColumn in which run the webview.
  • relativeTo: If url is relative, is it relative to 'workspace' or 'extension' (default to 'extension')

terminal

The terminal plugin gives access to the current terminal in vscode.

import { TerminalPlugin } from '@remixproject/engine-vscode'
import { Engine, Manager } from '@remixproject/engine';

export async function activate(context: ExtensionContext) {
  const manager = new Manager();
  const engine = new Engine();
  const terminal = new TerminalPlugin()

  engine.register([manager, terminal]);
  await manager.activatePlugin('terminal');
  // Execute "npm run build" in the terminal
  manager.call('terminal', 'exec', 'npm run build');
}

Window

Provides access to the native window of vscode.

import { WindowPlugin } from '@remixproject/engine-vscode'
import { Engine, Manager } from '@remixproject/engine';

export async function activate(context: ExtensionContext) {
  const manager = new Manager();
  const engine = new Engine();
  const window = new WindowPlugin()

  engine.register([manager, window]);
  await manager.activatePlugin('window');
  // Open a prompt to the user
  const fortyTwo = await manager.call('window', 'prompt', 'What is The Answer to the Ultimate Question of Life, the Universe, and Everything');
}

File Manager

Provides access to the file system through vscode api.

import { FileManagerPlugin } from '@remixproject/engine-vscode'
import { Engine, Manager } from '@remixproject/engine';

export async function activate(context: ExtensionContext) {
  const manager = new Manager();
  const engine = new Engine();
  const fs = new FileManagerPlugin()

  engine.register([manager, fs]);
  await manager.activatePlugin('filemanager');
  // Open a file into vscode
  // If path is relative it will look at the root of the open folder in vscode
  await manager.call('filemanager', 'open', 'package.json');
}

Theme

Remix's standard theme wrapper for vscode. Use this plugin to take advantage of the Remix's standard themes for your plugins. Otherwise, consider using vscode's color api directly in your webview.

import { ThemePlugin } from '@remixproject/engine-vscode'
import { Engine, Manager } from '@remixproject/engine';

export async function activate(context: ExtensionContext) {
  const manager = new Manager();
  const engine = new Engine();
  const theme = new ThemePlugin();

  engine.register([manager, fs]);
  await manager.activatePlugin('theme');
  // Now your webview can listen on themeChanged event from the theme plugin
}

Current Tags

  • 0.3.3                                ...           latest (11 days ago)
  • 0.3.3-alpha                                ...           next (11 days ago)

21 Versions

  • 0.3.3                                ...           11 days ago
  • 0.3.3-alpha                                ...           11 days ago
  • 0.3.2                                ...           18 days ago
  • 0.3.1                                ...           25 days ago
  • 0.3.0                                ...           a month ago
  • 0.3.0-beta.14                                ...           a month ago
  • 0.3.0-beta.13                                ...           2 months ago
  • 0.3.0-beta.12                                ...           2 months ago
  • 0.3.0-beta.11                                ...           2 months ago
  • 0.3.0-beta.10                                ...           2 months ago
  • 0.3.0-beta.9                                ...           2 months ago
  • 0.3.0-beta.8                                ...           2 months ago
  • 0.3.0-beta.7                                ...           2 months ago
  • 0.3.0-beta.6                                ...           2 months ago
  • 0.3.0-beta.5                                ...           3 months ago
  • 0.3.0-beta.4                                ...           3 months ago
  • 0.3.0-beta.3                                ...           3 months ago
  • 0.3.0-beta.2                                ...           3 months ago
  • 0.3.0-alpha.3                                ...           5 months ago
  • 0.3.0-alpha.2                                ...           6 months ago
  • 0.3.0-alpha.1                                ...           6 months ago
Downloads
Today 0
This Week 0
This Month 33
Last Day 0
Last Week 15
Last Month 53
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |