move your vs code extension into eclipse che · upcoming eclipse che 7.4 : endpoint improvements...

36
1 Move your VS Code extension into Eclipse Che Florent Benoit

Upload: others

Post on 26-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

1

Move your VS Code extension into Eclipse Che

Florent Benoit

Page 2: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

2

Eclipse Che 7

Eclipse Che 7

Page 3: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Devfile to share workspacesDevfile

apiVersion: 1.0.0metadata: generateName: python-projects: - name: python-hello-world source: type: git location: "https://github.com/che-samples/python-hello-world.git"components: - type: chePlugin id: ms-python/python/latest memoryLimit: 512Mi - type: dockerimage alias: python image: quay.io/eclipse/che-python-3.7:nightly memoryLimit: 512Mi mountSources: truecommands: - name: run actions: - type: exec component: python command: "python hello-world.py" workdir: ${CHE_PROJECTS_ROOT}/python-hello-world

Build Env

Runtime Env

Commands

IDE

Tools Plug-ins Dep

Project

Name Repo Branch

Test Env

Build Run Debug

Page 4: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Che 7: swappable editor

4

Page 5: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Che 7: registries

5

Registries in Eclipse Che

plug-in registry devfile registry

workspace

Page 6: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Theia IDE and plug-ins

Manage all plugins including VS

Code extensions6

Page 7: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

This afternoon: 5PMSeminarraum 5

More about che 7

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

7

Page 8: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

8

Develop VS Code extensions

Develop VS Code extensions

Page 9: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

DebugRun inside Eclipse Che IDE

RunRun inside Eclipse Che IDE

VS Code extensions

9

Scaffolding: Yeoman generatoryo code

DevelopIntellisense from Eclipse Che IDE

How to start ?

Page 10: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

VS Code extensions hosted mode

Hosted / development mode

10

Two instances of Theia

● Main instance to write plug-ins

● A new instance to run plug-ins

Browser Che / Theia Container

Main Theia Server

Hosted Theia Server

Theia IDE(plugin source)

Hosted Mode(running plugin)

Serves

Serves

Page 11: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Demo #1 Develop and debug VSCode extensionyoutube

Demo

11

Page 12: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

12

Develop VS Code extensions

Publish VS Code extensions

on Eclipse Che registries

Page 13: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Che 7: registries

13

Registries in Eclipse Che

plug-in registry devfile registry

workspace

Page 14: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Devfile

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

plug-in registrydevfile

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

Page 15: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Devfile and registries

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

che plug-in registry

devfile

my registry15

Page 16: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Create its own registry

16

Build a custom registry based on existing one

● Add / update / remove plug-ins

● Rebuild docker image

Page 17: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Create its own registry on github

17

Or use a simple github project

Page 18: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Demo #2 VSCode extension with custom plugin registryyoutube

Demo

18

Page 19: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

19

VS Code extensions and Eclipse Che

VS Code extensions and

Eclipse Che

Page 20: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Eclipse Che Workspacesplug-ins per workspace

BENEFITS

Cloud ReadyKubernetes / OpenShift

Plug-in RegistryGlobal / per instance

20

Multi-user / authOpenID Connect / LDAP / Keycloak

ECLIPSE CHE

Page 21: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Custom namespace

21

@eclipse-che/plugin namespace

● Interact easily with Eclipse Che APIhttps://github.com/eclipse/che-theia/blob/master/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts

export namespace workspace {

export function getCurrentWorkspace(): Promise<cheApi.workspace.Workspace>;

export function getAll(): Promise<cheApi.workspace.Workspace[]>;

export function getAllByNamespace(namespace: string): Promise<cheApi.workspace.Workspace[]>;

export function getById(workspaceId: string): Promise<cheApi.workspace.Workspace>;

export function create(config: cheApi.workspace.WorkspaceConfig, params: KeyValue): Promise<any>;

export function update(workspaceId: string, workspace: cheApi.workspace.Workspace): Promise<any>;

export function deleteWorkspace(workspaceId: string): Promise<any>;

export function start(workspaceId: string, environmentName: string): Promise<any>;

export function startTemporary(config: cheApi.workspace.WorkspaceConfig): Promise<any>;

export function stop(workspaceId: string): Promise<any>;

export function getSettings(): Promise<KeyValue>;

}

● Simple code to useimport * as che from '@eclipse-che/plugin';

...await che.workspace.getCurrentWorkspace();

Page 22: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

EXTERNAL PLUG-IN DEPENDENCIES

22

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

Native libraries

Tools dependencies$ apt-get install / yum install

Page 23: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

VS Code

Plugin1 PluginN

Standalone VS Code

Java 11container

Plugin 1

Main IDE Container

Plugin 3

JSON RPC

Java 13container

Plugin 2

Eclipse Che with containers

Che IDEEndpoint

Che IDEEndpoint

PLUG-IN RUNTIME

23

ECLIPSE CHE

Java installed on your system

Page 24: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Che Remote Theia endpoint

How sidecar endpoint is working ?

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

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

24

Page 25: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Che Remote Theia endpoint : some limitations

How sidecar endpoint is working ?

25

● 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)

Page 26: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Che Remote Theia endpoint : some limitations

How sidecar endpoint is working ?

26

● 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)

Page 27: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Upcoming Eclipse Che 7.4 : endpoint improvements

How sidecar endpoint is working ?

27

● 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

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

FROM docker.io/openjdk:14-alpine

Page 28: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Custom runtime

28

apiVersion: v2publisher: redhatname: vscode-xmlversion: latesttype: VS Code extensiondisplayName: XMLtitle: XML Language Support by Red Hatdescription: 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.svgrepository: https://github.com/redhat-developer/vscode-xmlcategory: LanguagefirstPublicationDate: '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

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

Page 29: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

Demo #3 VSCode extension with custom runtimeyoutube

Demo

Page 30: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

30

Develop VS Code extensions

Status

Page 31: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

31

VS Code extensions

https://che-incubator.github.io/vscode-theia-comparator/status.html

Page 32: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

32

VS Code extensions

Theia-vscodecov checkerhttps://github.com/theia-ide/theia-vscodecov

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

Page 33: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

33

Develop VS Code extensions

Conclusion

Page 34: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

34

FUTURE

● Improve VS Code API compliance

● Alternate VS Code extension marketplace

Page 35: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

35

Getting started with Eclipse Che

Sources github.com/eclipse/che

Dev List [email protected]

Docs http://eclipse.org/che/docs

Mattermost https://mattermost.eclipse.org

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

Get started with Eclipse Che

Page 36: Move your VS Code extension into Eclipse Che · Upcoming Eclipse Che 7.4 : endpoint improvements How sidecar endpoint is working ? 27 Create a single all-in-one binary for this endpoint

linkedin.com/company/red-hat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHat

Red Hat is the world’s leading provider of

enterprise open source software solutions.

Award-winning support, training, and consulting

services make

Red Hat a trusted adviser to the Fortune 500.

Thank you

36