Skip to content

perrinjerome/theia-open

Repository files navigation

theia-open

A theia extension to open files from command line.

This exposes a server side API to open/close and editor and query if the editor is still open and a command line interface.

This is intended to use as an $EDITOR environment variable so that opening files from the terminal (for example with git commit) opens in a theia editor.

This is a reimplementation of a gitpod feature.

Usage

Start theia server with a token set as environment variable THEIA_OPEN_EDITOR_TOKEN. Client will need the same token to connect.

Install client:

npm install -g @perrinjerome/theia-open-cli

Set EDITOR environment variable in the shell, something similar to:

export THEIA_URL=http://localhost:3000
export EDITOR="theia-open --wait"

Demo

# install and build everything
yarn install
yarn build # during development use yarn watch instead

# run the example theia app
cd browser-app
yarn demo

This will start theia on http://localhost:3000 , with the necessary environment variables set (see the demo command in browser-app/package.json).

When running git commands from theia's terminal, theia's text editor will be used instead of a default command line text editor. Try for example: git config --edit --global.