Language Edition Support in Eclipse IDE with best of breed: Generic Editor, Language Servers and TextMate

The Oxygen release train has introduced new approaches to more efficiently support editing of textual languages in the Eclipse IDE: a Generic and Extensible Text Editor was introduced in Platform to minimize boilerplate, Language Server Protocol for Eclipse (LSP4E) which allows to quickly hook into the IDE the power of Language Servers and TextMate for Eclipse (TM4E) allows to as easily delegate the syntax highlighting in the IDE to a TextMate grammar.

Those components drastically improve the “time to market” of shipping editing support for an existing language in the IDE, while keeping very close to legacy and productive workflows of the Eclipse IDE and encouraging consistency thanks to higher level of factorization.

In this tutorial, we’ll show you how to start from scratch, and build a high quality editing support for an existing programming language, relying on Language Servers and TextMate grammars; we’ll also introduce how the generic editor can be extended easily to add Eclipse-specific behavior, and how we can tweak and compose language servers with LSP4E to enrich the power of the IDE.

 

PREREQUISITES:

  • Pick your favorite language with reusable Language Server and TextMate grammar
    • Language which have LSP support can be found at https://github.com/Microsoft/language-server-protocol/wiki/Protocol-Implementations. Get the language-server for your target language, install it locally and make sure you can work with it (this part is usually requires knowledge of the target language and its ecosystem, it won’t be covered by the tutorial
    • Find a textmate grammar for the target language. You can usually find a “tmLanguage” file under https://github.com/textmate
    • If you didn’t perform those pre-requisites research and setup, you’ll have to follow the “standard” tutorial, which will happen to be about creating an HTML (with embedded CSS and JS) editor using VSCode language server.
  • Prepare an IDE

STEPS

  1. Create an Eclipse plugin
  2. Create a content-type for target file and associate it with Generic Editor -> Target IDE opens file with Generic Editor by default
  3. Create a dummy presentation reconcilier for keywords, and associate it with Generic Editor -> Target IDE shows dummy syntax in Generic Editor
  4. Include textmate grammar in bundle, declare it in plugin.xml, associate it with content-type, replace previous reconciler with TextMate PresentationReconiler in Generic Editor -> Rich syntax highlighting available in the IDE
  5. Define a language server from plugin.xml, implement the connection to LS (by consuming it as external 3rd party app for a 1st iteration) -> Language Server provides rich edition assist for the language
  6. Play with the editor: discover what’s featured by LSP, how LSP4E uses it, what are the limitations and the quality of your language server…
  7. Packaging decision and action: is referencing an external LS OK, or do we want to embed it? How to embed it? -> embedding LS doesn’t require local installation, relying on external SDK guarantees consistency with CLI...

Extras (optional)

  • Completing edition support by adding an Eclipse-specific feature to Generic Editor
  • Migration of existing editor to Generic Editor: Linux Tools case-study, or other existing Eclipse text editor
  • Intro about creating a Language Server in Java with LSP4J and embedding it in the Eclipse IDE
  • Adding another LS for the target file inside the IDE and composing it with main one
  • Showcase of a LS in another IDE
Schedule info
Session Time Slot(s): 
Tuesday, October 24, 2017 - 09:00 to 12:00

Our Sponsors

For information about becoming a sponsor, please visit the EclipseCon Europe 2017 sponsor prospectus page.

Elite Dual ECE/OSGi CE

Premium

Basic

Club ECE Sponsor

IoT Theme Day

Project Quality Day

Smart Home Day

Media

EclipseCon Support Other Events

Our Other Events

Eclipse events are hosted all over the world!

  • Foss4G NA 2018
  • Eclipsecon France 2018