deephaven / vscode-deephaven

Deephaven Visual Studio Code Extension
Apache License 2.0
0 stars 0 forks source link
deephaven vscode-extension

vscode-deephaven

Deephaven in VS Code

Deephaven in VS Code Extension

Installation

This extension is not yet published to the marketplace, but you can install a .vsix directly. To get a .vsix, you can either:

Download one from the releases/ folder.

or

Build a .vsix locally via npm run package

Then install in vscode: Install Deephaven in VS Code

Note: There are some vscode bugs that cause some flakiness with the run button. vscode v90 introduced an optional workbench.editor.alwaysShowEditorActions setting. Setting this to true improves the experience here. Namely the run button will not disappear when running commands or selecting its dropdown. See https://github.com/deephaven/vscode-deephaven/issues/1 for more details.

Connecting to a Server

Core server http://localhost:10000/ is configured by default and doesn't require any additional config. Additional connections can be configured in vscode settings.

e.g. .vscode/settings.json

{
  // Core servers
  "vscode-deephaven.core-servers": [
    "http://localhost:10000/",
    "http://localhost:10001"
  ]
}

To select the active connection that scripts will be run against, click the connection picker in the bottom status bar of vscode.

Note: If you don't select a connection, the first one will be automatically used the first time a script is run.

Pick Connection

Then select one of the servers:

Connection Options

Running Scripts

Scripts will be run against the active connection or default to the first connection if none is selected.

  1. Start a DH core server at http://localhost:1000
  2. Open a DH Python script in vscode
  3. Click the caret on the Run button in the top right of the editor and select Run Deephaven File

    Deephaven: Run

Note that vscode will remember your selection so you can just click the run button (play icon) the next time.

Run a selection

  1. Select text to run
  2. Click the caret on the Run button in the top right of the editor and select Run Deephaven Selected Lines

    Deephaven: Run Selection

Note that vscode will remember your selection so you can just click the run button (play icon) the next time.

Code Snippets

The vscode-deephaven extension comes with some predefined python snippets. These insert pre-defined code snippets into an editor. To use, simply type ui to see available snippets.

Code Snippets

Implementation Notes

Server Connection

DHC

The first time a connection is made to a DHC server, the extension will:

  1. Download the JS API from the server
  2. Check server auth config. If anonymous, connect anonymously. If PSK prompt for PSK.

If auth succeeds and connection was initiated by running a script:

  1. Run the script against the server
  2. Update panels in vscode and deephaven.

On subsequent script runs, the session will be re-used and only steps 4 and 5 will run

Downloading JS API

The extension dynamically downloads and loads the DH JS API from a DH Core server.