eclipsecon europe 2016, s. cela, m.istria: eclipse generic and extensible editor and language...
TRANSCRIPT
The New Generic and Extensible Code Editor
Easily-extendable Eclipse Text Editor for quick language support and more
Sopot Cela Mickael Istria
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
Features
- Extensible autocomplete- Extensible hover (tooltip) information- Extensible syntax highlighting
- Similar concept to the way Notepad++ works
The editor is an empty shell, it will do as much as content you provide it through extensions
“Extensible”, you said?
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
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
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
Language Server Protocol (LSP)
LSP defines a unified way to get edition assist (completion, hover, rename…) from whatever “blackbox”.
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
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
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
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
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