Top Banner
The New Generic and Extensible Code Editor Easily-extendable Eclipse Text Editor for quick language support and more Sopot Cela Mickael Istria
20

EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Jan 14, 2017

Download

Software

Mickael Istria
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

The New Generic and Extensible Code Editor

Easily-extendable Eclipse Text Editor for quick language support and more

Sopot Cela Mickael Istria

Page 2: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Why ‘Generic’ ?- One Editor & Multiple per-language extensions versus One Editor per language approach- Instead of creating an editor, ‘smarten up’ the generic editor to sense and support a language

Page 3: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Features

- Extensible autocomplete- Extensible hover (tooltip) information- Extensible syntax highlighting

- Similar concept to the way Notepad++ works

Page 4: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

The editor is an empty shell, it will do as much as content you provide it through extensions

“Extensible”, you said?

Page 5: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Content-type centric

- You want to add features for a given language, not much for an editor.

- Extensions register themselves against content-types, the editor picks the active one according to the content-type of current document.

- You can either create a custom content-type or use a pre-defined one

Page 6: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

And how exactly does it work in practice? 1. Get a new or existing plug-in project

2. Add an extension to e.g. org.eclipse.ui.genericeditor.presentationReconcilersa. Supply a content-type for which this code will work

3. Write the presentation (or autocomplete or hover) logic code

Page 7: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

And how does the code look?

Page 8: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Voila!

Page 9: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Underlying Vision1. Productivity & Time to market: Make possible quick language support with

very little boilerplate

2. Separation of concerns: Abstract out the provider of the ‘smartness’ for a given language a. Opens the road to using language servers

3. Quality, maintenance & DRY: do we need as many text editors as languagesa. More consistencyb. More factorization (less maintenance cost)c. Less memory consumption

Page 10: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Language Server Protocol (LSP)

LSP defines a unified way to get edition assist (completion, hover, rename…) from whatever “blackbox”.

Page 11: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

LSP in Eclipse

Many LSP operations already doable with Eclipse commands and handlers: hook LSP-based handler on commands when supported.

Hooking hover and completion now doable with Eclipse Generic Editor

Page 12: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

LSP in Eclipse (cont’d)

Eclipse IDE user

/ide

Generic and

extensible editor

LSPIntegration

HoverCompletion

OmniSharpLaunch Config

VSCode-CSSLaunch Config

VSCode-JSONLaunch Config

WhateverLaunch Config

Local

Local

?

Protocol over * streams

LSP4J

workspace

Page 13: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

User to manually associate a language server and a content-type. No code, no plugin! Requires user to manually define content types http://bugs.eclipse.org/500892

Move this to Eclipse.org!

Next steps for Eclipse and LSP

Page 14: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Demo schedule1. Sample .gradle syntax highlighting support

2. Language server demo: C# editor

Page 15: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Demo 1

Page 16: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Demo 2

Page 17: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Use it now!1. Try it out!

a. We have a plug-in template wizard for thatb. Try it for your use-case and give feedback

2. Contribute basic support for a languagea. It doesn’t have to be a well-defined languageb. E.g. we have a sample for .project file editor

Page 18: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Future Plans1. Get Generic Editor infrastructure improved

a. improve extensibility areasb. continuous bug fixes as adoption grows

2. Language Server pusha. project proposal (LSP4E, ecLSP…) in progress. Come to be registered as Interested Parties

Page 19: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Many thanks to those who helped with reviewing

Page 20: EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Editor and Language Servers

Questions time