Move your VS Code extension into Che

Florent Benoit

1 7

Eclipse Che 7

2 Devfile Devfile to

apiVersion: 1.0.0 : generateName: python- Project projects: - Name Repo Branch name: python-hello-world source: IDE type: location: "https://github.com/che-samples/python-hello-world.git" Tools Plug-ins Dep components: - type: chePlugin Build Env id: ms-python/python/latest memoryLimit: 512Mi - type: dockerimage Runtime Env alias: python image: quay.io/eclipse/che-python-3.7:nightly memoryLimit: 512Mi Test Env mountSources: true commands: - Commands name: run actions: - Build Run Debug type: exec component: python command: "python hello-world.py" workdir: ${CHE_PROJECTS_ROOT}/python-hello-world Che 7: swappable editor

4 Che 7: registries

Registries in Eclipse Che

plug-in registry devfile registry

5 Theia IDE and plug-ins

Manage all plugins including VS Code extensions

6 More about che 7

Eclipse Che 7: The new, the noteworthy and the future plans!

This afternoon: 5PM Seminarraum 5

7 Develop VS Code extensions

Develop VS Code extensions

8 VS Code extensions How to start ?

Scaffolding: Yeoman generator yo code

Develop Intellisense from Eclipse Che IDE

Run Run inside Eclipse Che IDE

Debug Run inside Eclipse Che IDE

9 VS Code extensions hosted mode

Hosted / development mode

Browser Che / Theia Container Two instances of Theia

Theia IDE Serves Main Theia (plugin source) Server ● Main instance to write plug-ins

Hosted Mode Serves Hosted Theia ● A new instance to run plug-ins (running plugin) Server

10 Demo

Demo #1 Develop and debug VSCode extension youtube

11 Develop VS Code extensions

Publish VS Code extensions

on Eclipse Che registries

12 Che 7: registries

Registries in Eclipse Che

plug-in registry devfile registry

workspace

13 Devfile

--- apiVersion: 1.0.0 metadata: name: my-che-workspace components: - type: chePlugin id: redhat/java11/latest

plug-in registry devfile

14 https://che-plugin-registry.openshift.io/v3/plugins/ Devfile and registries

--- apiVersion: 1.0.0 metadata: name: my-che-workspace components: - type: chePlugin che plug-in registry - reference: https://my-registry/plugins/florent/hello/0.1/meta.yaml

devfile

my registry 15 Create its own registry Build a custom registry based on existing one

● Add / update / remove plug-ins

● Rebuild image

16 Create its own registry on Or use a simple github project

17 Demo

Demo #2 VSCode extension with custom plugin registry youtube

18 VS Code extensions and Eclipse Che

VS Code extensions and

Eclipse Che

19 BENEFITS ECLIPSE CHE

Eclipse Che Workspaces Multi-user / auth plug-ins per workspace OpenID Connect / LDAP / Keycloak

Plug-in Registry Cloud Ready Global / per instance Kubernetes / OpenShift

20 Custom namespace

@eclipse-che/plugin namespace ● Interact easily with Eclipse Che API https://github.com/eclipse/che-theia/blob/master/extensions/eclipse-che-theia-plugin/src/che-pr oposed..ts

export namespace workspace { export function getCurrentWorkspace(): Promise; export function getAll(): Promise; export function getAllByNamespace(namespace: string): Promise; export function getById(workspaceId: string): Promise; export function create(config: cheApi.workspace.WorkspaceConfig, params: KeyValue): Promise; export function update(workspaceId: string, workspace: cheApi.workspace.Workspace): Promise; export function deleteWorkspace(workspaceId: string): Promise; export function start(workspaceId: string, environmentName: string): Promise; export function startTemporary(config: cheApi.workspace.WorkspaceConfig): Promise; export function stop(workspaceId: string): Promise; export function getSettings(): Promise; } ● Simple code to use

import * as che from '@eclipse-che/plugin';

21 ... await che.workspace.getCurrentWorkspace(); EXTERNAL PLUG-IN DEPENDENCIES

System Runtime dependencies / Language server protocol LSP needs Java, PHP requires PHP, etc

Tools dependencies $ apt-get install / yum install

Native libraries

22 PLUG-IN RUNTIME ECLIPSE CHE

Standalone VS Code Eclipse Che with containers

Java 11 Java 13 container container Plugin 1 Plugin 2 VS Code Che IDE Che IDE Endpoint Endpoint Plugin1 PluginN JSON RPC

Main IDE Container

Plugin 3 Java installed on your system

23 How sidecar endpoint is working ?

Che Remote Theia endpoint

FROM eclipse/che-theia-endpoint-runtime:next RUN apk --no-cache add openjdk11 -repository=http://dl-cdn.alpinelinux.org/alpine/edge/community ENV JAVA_HOME /usr/lib/jvm/default-jvm/

FROM eclipse/che-theia-endpoint-runtime:next RUN apk --no-cache add fortune

24 How sidecar endpoint is working ?

Che Remote Theia endpoint : some limitations

● Needs to inherit from a dedicated Docker image

● Workaround with multi-staged builds

● Strong link between Theia image and sidecar images

○ (better to use same version of theia on main theia

and sidecars)

25 How sidecar endpoint is working ?

Che Remote Theia endpoint : some limitations

● Needs to inherit from a dedicated Docker image

● Workaround with multi-staged builds

● Strong link between Theia image and sidecar images

○ (better to use same version of theia on main theia

and sidecars)

26 How sidecar endpoint is working ?

Upcoming Eclipse Che 7.4 : endpoint improvements

● Create a single all-in-one binary for this endpoint

○ Using nexe tool on Eclipse Che Theia remote package

● Copy this binary and run it

● Allow to use existing dockers image from docker registries

FROM docker.io/:14-alpine

● ⇒ no need to build images, use image name in plugin’s meta.yaml

27 Custom runtime

Use a custom runtime for a VS Code extension : meta.yaml

apiVersion: v2 publisher: redhat name: vscode- version: latest type: VS Code extension displayName: XML title: XML Language Support by description: This VS Code extension provides support for creating and editing XML documents, based on the LSP4XML language server, running with Java. icon: https://www.eclipse.org/che/images/logo-eclipseche.svg repository: https://github.com/redhat-developer/vscode-xml category: Language firstPublicationDate: '2019-04-19' spec: containers: - image: "docker.io/eclipse/che-remote-plugin-runner-java11:next" name: vscode-xml memoryLimit: "768Mi" extensions: - https://github.com/redhat-developer/vscode-xml/releases/download/0.7.0/vscode-xml-0.7.0-3205.vsix

28 Demo

Demo #3 VSCode extension with custom runtime youtube Develop VS Code extensions

Status

30 VS Code extensions https://che-incubator.github.io/vscode-theia-comparator/status.html

31 VS Code extensions

Theia-vscodecov checker

https://github.com/theia-ide/theia-vscodecov

$ cd my-vscode-extension $ npx theia-vscodecov

32 Develop VS Code extensions

Conclusion

33 FUTURE

● Improve VS Code API compliance

● Alternate VS Code extension marketplace

34 Getting started with Eclipse Che

Get started with Eclipse Che

Sources Dev List [email protected] github.com/eclipse/che

Mattermost Docs https://mattermost.eclipse.org http://eclipse.org/che/docs

Try it out : https://che.openshift.io

35 Thank you linkedin.com/company/red-hat

youtube.com/user/RedHatVideos Red Hat is the world’s leading provider of

enterprise open source software solutions. facebook.com/redhatinc Award-winning support, training, and consulting

services make twitter.com/RedHat Red Hat a trusted adviser to the Fortune 500.

36