orion and the language server protocol, the … · orion and the language server protocol, the ......

17
1 © 2016 IBM Corporation Orion and The Language Server Protocol, The Perfect Couple(ing) Olivier Thomann IBM Canada Eclipsecon Europe 2016 October 26 th 2016

Upload: lekhuong

Post on 05-Oct-2018

258 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

1 © 2016 IBM Corporation

Orion and The Language Server Protocol, The Perfect Couple(ing)

Olivier Thomann

IBM Canada

Eclipsecon Europe 2016

October 26th 2016

Page 2: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

2 © 2016 IBM Corporation

Agenda

What is LSP?

LSP at Eclipse

Orion implementation and adoption

Page 3: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

3 © 2016 IBM Corporation

What is LSP?

LSP stands for Language Server Protocol

It is an open source protocol defined by Microsoft:

https://github.com/Microsoft/language-server-protocol

A server that implements that protocol provides all the semantic

information for a specific language

Tools like IDEs and editors can get support for specific languages

without knowing anything about these languages

Page 4: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

4 © 2016 IBM Corporation

LSP communication

Page 5: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

5 © 2016 IBM Corporation

What about LSP and Eclipse?

A new incubation project has been proposed and created under the

jdt sub-projects: Eclipse JDT Language Server:

– https://projects.eclipse.org/projects/eclipse.jdt.jdtls

This is an incubation project under the lead of RedHat with Gorkem Ercan

and Fred Bricon.

– Initial code contribution is currently under IP review

– They propose an implementation of the Language Server Protocol for the

Java™ Language

– The LSP server is a headless Eclipse application

There is an effort led by Mickael Istria from Red Hat to create a

generic editor in Eclipse that supports the Language Server

Protocol.

Page 6: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

6 © 2016 IBM Corporation

LSP4J

Another incubation project has been proposed and created under

the technology sub-projects:

– https://projects.eclipse.org/projects/technology.lsp4j

LSP4J is a Java™ implementation of the language server protocol intended to

be consumed by tools and language servers implemented in Java™.

So technically speaking, JDT/LS incubation project could consume what this

project provides in order to get a Java™ LSP implementation based on JDT.

This effort is led by the same people that are working on XText.

Eclipse Che should also integrate the Language Server Protocol in

the future to provide support for new languages.

Page 7: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

7 © 2016 IBM Corporation

Orion and LSP

Orion is a modern development environment in the cloud. See:

https://orionhub.org/

This is a work-in-progress that is only a few weeks old

A hackathon took place in Zurich to start investigating the Orion

support for LSP

Right now we do not try to handle multi-user cases. The Node.js

server can only serve one client that is using the LSP server

Page 8: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

8 © 2016 IBM Corporation

Orion editor to LSP communication

Orion

Editor

Orion Node.js

Server

LSP server

headless Eclipse

application

LSP communication over sockets

Send lsp requests (JSON RPC)

Gets lsp response / notifications

JSON/RPC

Socket communication

Parse responses/notifications

And handle them in the editor

By defining orion services

Page 9: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

9 © 2016 IBM Corporation

Orion and JDT-LS

Orion defines a new plugin to be able to have a Java™ tooling inside

the Orion editor

Right now the Orion Node.js server starts the LSP server when a

java file is open

The plugin defines a socket connection between the Orion client

(editor) and the Orion Node.js server

The Node.js server redirects all LSP requests to the LSP server

using a socket connection with the Java™ LSP server

When the LSP server returns a response/notification, it is sent over

a socket to the Node.js server that redirects it to the Orion Java™

plugin where the response/notification is handled and rendered into

the editor based on Orion services implementations

Page 10: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

10 © 2016 IBM Corporation

Complete the LSP integration in Orion

Complete implementations of all LSP requests in the Java™ LSP

server based on JDT

Define new Orion plugins to support LSP servers for other languages

Simple installation in Orion

Lots of technical challenges remain: multi-user, security,…

What’s next?

Page 11: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

11 © 2016 IBM Corporation

IBM® Bluemix®

Bluemix is an open standards, cloud platform for building, running,

and managing apps and services

This work could result in the end as a Java™ editor for IBM®

Bluemix®

Page 12: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

12 © 2016 IBM Corporation

Using a branch in the git repo: https://git.eclipse.org/r/orion/org.eclipse.orion.client branchmrennie/languageServer

Get the lsp server from the git repo: https://github.com/gorkem/java-language-server.Follow the README.md to build it.

Install the lsp server in org.eclipse.orion.client/modules/orionode/server

Start it using:

node --debug server.js -p 8083 –w <workspace_path>

from command prompt where Node.js is installed. This runs the Node.js Orion server on localhost:8083.

The Orion client with the Java™ plugin requires a Node.js Orion server that is enabled for the language server connections. This is why for now I use a local Node.js server instead of the instance running on orion.eclipse.org.

Open the browser on http://local.orion.org:8083

How to contribute?

Page 13: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

13 © 2016 IBM Corporation

Page 14: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

14 © 2016 IBM Corporation

Page 15: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

15 © 2016 IBM Corporation

All links

https://projects.eclipse.org/projects/eclipse.jdt.jdtls

https://projects.eclipse.org/projects/technology.lsp4j

https://github.com/gorkem/java-language-server

https://github.com/redhat-developer/vscode-java

https://github.com/Microsoft/language-server-protocol

http://che.eclipse.org/eclipse-che-now-strategic-platform-red-hat/

https://git.eclipse.org/r/orion/org.eclipse.orion.client branch:

mrennie/languageServer

Page 16: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

16 © 2016 IBM Corporation

Thanks for attending!

Please contact me if you have any questions:

[email protected]

Page 17: Orion and The Language Server Protocol, The … · Orion and The Language Server Protocol, The ... Get the lsp server from the git repo: ... Orion and The Language Server Protocol,

17 © 2016 IBM Corporation

Please provide feedbacks!