SlideShare a Scribd company logo
1 of 38
Download to read offline
I N T E G R AT I N G X T E X T L A N G U A G E
S E R V E R S U P P O R T I N
V I S U A L S T U D I O C O D E
Karsten Thoms Eclipse DemoCamp Bonn / 14. November 2016
XTEXT UI
… for a long time Xtext had only an Eclipse UI
2010
01.April
In 2010 I published a blog post and a video that showed an Xtext editor in a RAP web application. Unfortunately this was just an April’s fool joke. At this time it was not
possible to provide rich text editors in the web.
ECLIPSE NEON 2015
XTEXT 2.9
In 2015 Xtext provided more integration with Web editors and IntelliJ IDEA.

At EclipseCon Europe 2014 a web editor was demonstrated with the XRobots showcase.
Prototypes can be created fast to demonstrate that Xtext is a good match to solve a problem. These prototypes are often shipped too fast to the customer before
becoming mature.

If a DSL is initially developed fast by some experts, they are often handed over to less Xtext experienced people to finish it. The result is a fragile project.
IntelliJ support has some bugs open and it is quite hard to keep pace with the moving API of IDEA.
Something has changed that Microsoft made cool again.
WHAT’S NEXT?
• Repository Split
• Implementation of the Language Server Protocol
• https://github.com/Microsoft/vscode-languageserver-
protocol
• Support other IDEs like Che,VSCode, …
• Reduce maintenance effort on IDE integration
Dem
oCam
p
Neon
June
2016
This was the last slide of my talk at Eclipse DemoCamp Bonn Neon 2016
MSVISUAL STUDIO CODE
A new player is on the market
VS CODE MARKETPLACE
…with many great extensions already
VS CODE EXTENSIONS
LANGUAGE SERVER
PROTOCOL (LSP)
LANGUAGE SERVER PROTOCOL
• Defines a bidirectional protocol between a tool (client) and a „language smartness
provider“ (language server)
• Open de-facto standard from Microsoft (Team around Erich Gamma)
• Used by MicrosoftVisual Studio Code (VS Code), currently work in progress for
Eclipse Che, Eclipse Orion, Eclipse IDE
• Generic integration of language features:

Content Assist, Go to definition,Validation, Find references, etc.
• JSON-RPC used to define requests, responses and notifications
• The client sends messages on interactions: Open document, edit text…
• Server maintains semantics of a program for a certain language
LANGUAGE SERVER
PROTOCOL
https://github.com/Microsoft/language-server-protocol
BASE PROTOCOL
• Message consists of Header and Content Part.
• Header and Content are separated by ‚rn‘.
Header Field Name ValueType Description
Content-Length number
The length of the content part in
bytes.This header is required.
Content-Type string
The mime type of the content part.
Defaults to application/vscode-jsonrpc;
charset=utf8
Content-Length: ...rn
rn
{
"jsonrpc": "2.0",
"id": 1,
"method": "textDocument/didOpen",
"params": {
...
}
}
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
BASIC PROTOCOL STRUCTURES (1/3)
• Abstract Message

A general message as defined by JSON-RPC.The
language server protocol always uses "2.0" as the jsonrpc
version.
• RequestMessage

A request message to describe a request between the
client and the server. Every processed request must send
a response back to the sender of the request.
• Response Message

Response Message sent as a result of a request.
• Notification Message

A notification message.A processed notification message
must not send a response back.They work like events.
• Cancellation Support

The base protocol now offers support for request
cancellation.

interface Message {

jsonrpc: string

}
interface RequestMessage extends Message {

id: number | string;

method: string;

params?: any

}
interface ResponseMessage extends Message {

id: number | string;

result?: any;

error?: ResponseError<any>;

}
interface NotificationMessage extends Message
{

method: string;

params?: any

}
interface CancelParams {

id: number | string;

}
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
BASIC PROTOCOL STRUCTURES (2/3)
• Position

Position in a text document expressed as zero-based line and character offset.
• Range

A range in a text document expressed as (zero-based) start and end positions.
• Location

Represents a location inside a resource, such as a line inside a text file.
• Diagnostic

Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only
valid in the scope of a resource.
• Command

Represents a reference to a command. Provides a title which will be used to represent a
command in the UI and, optionally, an array of arguments which will be passed to the
command handler function when invoked.
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
BASIC PROTOCOL STRUCTURES (3/3)
• TextEdit

A textual edit applicable to a text document.
• WorkspaceEdit

A workspace edit represents changes to many resources managed in the workspace.
• TextDocumentIdentifier

Text documents are identified using a URI. On the protocol level, URIs are passed as strings.
• TextDocumentItem

An item to transfer a text document from the client to the server.
• VersionedTextDocumentIdentifier

An identifier to denote a specific version of a text document.
• TextDocumentPositionParams

A parameter literal used in requests to pass a text document and a position inside that document.

https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (1/7)
• Initialize Request

The initialize request is sent as the first request from the client to the server.
• Shutdown Request

The shutdown request is sent from the client to the server. It asks the server to shut
down, but to not exit (otherwise the response might not be delivered correctly to
the client).There is a separate exit notification that asks the server to exit.

















https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (2/7)
• ShowMessage Notification

The show message notification is sent from a server to a client to ask the client to display a
particular message in the user interface.
• ShowMessage Request

The show message request is sent from a server to a client to ask the client to display a
particular message in the user interface. In addition to the show message notification the
request allows to pass actions and to wait for an answer from the client.
• LogMessage Notification

The log message notification is sent from the server to the client to ask the client to log a
particular message.
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (3/7)
• DidChangeConfiguration Notification

A notification sent from the client to the server to signal the change of configuration settings.
• DidOpenTextDocument Notification

The document open notification is sent from the client to the server to signal newly opened
text documents.The document's truth is now managed by the client and the server must not
try to read the document's truth using the document's uri.
• DidChangeTextDocument Notification

The document change notification is sent from the client to the server to signal changes to a
text document. In 2.0 the shape of the params has changed to include proper version numbers
and language ids.
• DidCloseTextDocument Notification

The document close notification is sent from the client to the server when the document got
closed in the client.The document's truth now exists where the document's uri points to (e.g. if
the document's uri is a file uri the truth now exists on disk).
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (4/7)
• DidSaveTextDocument Notification

The document save notification is sent from the client to the server when the document was saved in the
client.
• DidChangeWatchedFiles Notification

The watched files notification is sent from the client to the server when the client detects changes to files
watched by the language client.
• PublishDiagnostics Notification

Diagnostics notification are sent from the server to the client to signal results of validation runs.
• Completion Request

The Completion request is sent from the client to the server to compute completion items at a given cursor
position. Completion items are presented in the IntelliSense user interface. If computing full completion items
is expensive, servers can additionally provide a handler for the completion item resolve request.This request
is sent when a completion item is selected in the user interface.
• Completion Item Resolve Request

The request is sent from the client to the server to resolve additional information for a given completion
item.
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (5/7)
• Hover

The hover request is sent from the client to the server to request hover information at a given text
document position.
• Signature Help

The signature help request is sent from the client to the server to request signature information at a
given cursor position.
• Goto Definition

The goto definition request is sent from the client to the server to resolve the definition location of a
symbol at a given text document position.
• Find References

The references request is sent from the client to the server to resolve project-wide references for the
symbol denoted by the given text document position.
• Document Highlights

The document highlight request is sent from the client to the server to resolve a document highlights
for a given text document position.
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (6/7)
• Document Symbols

The document symbol request is sent from the client to the server to list all symbols found in a given text
document.
• Workspace Symbols

The workspace symbol request is sent from the client to the server to list project-wide symbols matching
the query string.
• Code Action

The code action request is sent from the client to the server to compute commands for a given text
document and range.The request is triggered when the user moves the cursor into a problem marker in the
editor or presses the lightbulb associated with a marker.
• Code Lens

The code lens request is sent from the client to the server to compute code lenses for a given text
document.
• Code Lens Resolve

The code lens resolve request is sent from the client to the server to resolve the command for a given code
lens item.
https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
ACTUAL PROTOCOL (7/7)
• Document Formatting

The document formatting request is sent from the server to the client to format a whole document.
• Document Range Formatting

The document range formatting request is sent from the client to the server to format a given range in
a document.
• Document on Type Formatting

The document on type formatting request is sent from the client to the server to format parts of the
document during typing.
• Rename

The rename request is sent from the client to the server to perform a workspace-wide rename of a
symbol.







https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
LSP JAVA BINDING
• A Java Binding for the Language Server Protocol lsp4j is
now developed at Eclipse:
• https://projects.eclipse.org/projects/technology.lsp4j
• lsp4j is used by Xtext Core to implement a generic
Language Server for Xtext DSLs
XTEXTVSCODE EXTENSION
• Extension with external Language Server
• Server is running outside of the
extension
• Communication via sockets
• Client initiates the connection and asks
server for capabilities
• Server shuts down when client is closed
• Extension with embedded Language
Server
• Server is packaged and run within the
extension
• Communication via process I/O
• Server lifecycle bound to extension
lifecycle
XTEXTVSCODE EXTENSION
• VS Code Extension with DSL Fat Jar
• Xtext Language Server started as JVM child process
• VSC Extension project files generated by Xtext
Generator Fragment
• https://github.com/itemis/xtext-generator-vscode
• About to be contributed to xtext-core generator
UberJar size ~14 MB for standard DSL
XTEXT CODE GENERATOR FRAGMENT
• Xtext Code Generator Fragment in progress
• https://github.com/itemis/xtext-generator-vscode







• Produces theVS Code Extension package
component = XtextGenerator {

language = StandardLanguage {

...

fragment = com.itemis.xtext.generator.vscode.VSCodeExtensionFragment {}

}

}
WORKFLOW CONFIG
GENERATED ARTIFACTS
UberJar size ~14 MB for standard DSL
GENERATED ARTIFACTS
+
GENERATED ARTIFACTS
Uber-Jar
- DSL Runtime + IDE
- Xtext Dependencies
- ~14 MB
UberJar size ~14 MB for standard DSL
GENERATED ARTIFACTS
GENERATED ARTIFACTS
BUILD
• gradle startCode
• Run Xtext DSL generator
• Package Fat Jar
• PackageVS Code Extension vscode-extension-
self-contained-<version>.vsix
• StartVS Code and deploy extension
XTEXT DSL INVSCODE
XTEXT DSL INVSCODE

More Related Content

What's hot

What's hot (20)

Document Object Model (DOM)
Document Object Model (DOM)Document Object Model (DOM)
Document Object Model (DOM)
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Css3
Css3Css3
Css3
 
Javascript
JavascriptJavascript
Javascript
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 
ASP.NET 07 - Site Navigation
ASP.NET 07 - Site NavigationASP.NET 07 - Site Navigation
ASP.NET 07 - Site Navigation
 
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
 
Python Dictionaries and Sets
Python Dictionaries and SetsPython Dictionaries and Sets
Python Dictionaries and Sets
 
JavaScript and BOM events
JavaScript and BOM eventsJavaScript and BOM events
JavaScript and BOM events
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 

Similar to Integrating Xtext Language Server support in Visual Studio Code

Language Server Protocol - Why the Hype?
Language Server Protocol - Why the Hype?Language Server Protocol - Why the Hype?
Language Server Protocol - Why the Hype?mikaelbarbero
 
What you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyondWhat you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyondJon Galloway
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCTim Burks
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsTim Burks
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - TalkMatthias Noback
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik TambekarPratik Tambekar
 
.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and TomorrowJon Galloway
 
Gib 2021 - Intro to BizTalk Migrator
Gib 2021 - Intro to BizTalk MigratorGib 2021 - Intro to BizTalk Migrator
Gib 2021 - Intro to BizTalk MigratorDaniel Toomey
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at ScaleOracle Developers
 
.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019Marco Parenzan
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NETAlessandro Giorgetti
 
Realizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache BeamRealizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache BeamDataWorks Summit
 
WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...
WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...
WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...Amir Zmora
 
Fundamental Internet Programming.pdf
Fundamental Internet Programming.pdfFundamental Internet Programming.pdf
Fundamental Internet Programming.pdfAshenafi Workie
 
OpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideTim Burks
 

Similar to Integrating Xtext Language Server support in Visual Studio Code (20)

Language Server Protocol - Why the Hype?
Language Server Protocol - Why the Hype?Language Server Protocol - Why the Hype?
Language Server Protocol - Why the Hype?
 
What you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyondWhat you need to know about .NET Core 3.0 and beyond
What you need to know about .NET Core 3.0 and beyond
 
World Wide Web(WWW)
World Wide Web(WWW)World Wide Web(WWW)
World Wide Web(WWW)
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Www and http
Www and httpWww and http
Www and http
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and Tomorrow
 
Gib 2021 - Intro to BizTalk Migrator
Gib 2021 - Intro to BizTalk MigratorGib 2021 - Intro to BizTalk Migrator
Gib 2021 - Intro to BizTalk Migrator
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
 
.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019.NET & C# Updates Fall 2019
.NET & C# Updates Fall 2019
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET
 
Realizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache BeamRealizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache Beam
 
WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...
WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...
WebRTC Live Q&A Session #5 - JavaScript Promises and WebRTC Interoperability ...
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
 
Java script
Java scriptJava script
Java script
 
Fundamental Internet Programming.pdf
Fundamental Internet Programming.pdfFundamental Internet Programming.pdf
Fundamental Internet Programming.pdf
 
Mannu_Kumar_CV
Mannu_Kumar_CVMannu_Kumar_CV
Mannu_Kumar_CV
 
OpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-Side
 

More from Karsten Thoms

EC2022 What Eclipse IDE must learn from other IDEs to survive?.pdf
EC2022 What Eclipse IDE must learn from other IDEs to survive?.pdfEC2022 What Eclipse IDE must learn from other IDEs to survive?.pdf
EC2022 What Eclipse IDE must learn from other IDEs to survive?.pdfKarsten Thoms
 
From Stairway to Heaven onto the Highway to Hell with Xtext
From Stairway to Heaven onto the Highway to Hell with XtextFrom Stairway to Heaven onto the Highway to Hell with Xtext
From Stairway to Heaven onto the Highway to Hell with XtextKarsten Thoms
 
Generating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLsGenerating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLsKarsten Thoms
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendKarsten Thoms
 
Boosting the performance of your Eclipse IDE - EclipseCon France 2016
Boosting the performance of your Eclipse IDE - EclipseCon France 2016Boosting the performance of your Eclipse IDE - EclipseCon France 2016
Boosting the performance of your Eclipse IDE - EclipseCon France 2016Karsten Thoms
 
Boosting the Performance of your Eclipse IDE
Boosting the Performance of your Eclipse IDEBoosting the Performance of your Eclipse IDE
Boosting the Performance of your Eclipse IDEKarsten Thoms
 

More from Karsten Thoms (7)

EC2022 What Eclipse IDE must learn from other IDEs to survive?.pdf
EC2022 What Eclipse IDE must learn from other IDEs to survive?.pdfEC2022 What Eclipse IDE must learn from other IDEs to survive?.pdf
EC2022 What Eclipse IDE must learn from other IDEs to survive?.pdf
 
From Stairway to Heaven onto the Highway to Hell with Xtext
From Stairway to Heaven onto the Highway to Hell with XtextFrom Stairway to Heaven onto the Highway to Hell with Xtext
From Stairway to Heaven onto the Highway to Hell with Xtext
 
Generating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLsGenerating Visual Studio Code Extensions for Xtext DSLs
Generating Visual Studio Code Extensions for Xtext DSLs
 
Recipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with XtendRecipes to build Code Generators for Non-Xtext Models with Xtend
Recipes to build Code Generators for Non-Xtext Models with Xtend
 
Boosting the performance of your Eclipse IDE - EclipseCon France 2016
Boosting the performance of your Eclipse IDE - EclipseCon France 2016Boosting the performance of your Eclipse IDE - EclipseCon France 2016
Boosting the performance of your Eclipse IDE - EclipseCon France 2016
 
Boosting the Performance of your Eclipse IDE
Boosting the Performance of your Eclipse IDEBoosting the Performance of your Eclipse IDE
Boosting the Performance of your Eclipse IDE
 
Maven 3 / Tycho
Maven 3 / TychoMaven 3 / Tycho
Maven 3 / Tycho
 

Recently uploaded

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 

Recently uploaded (20)

Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 

Integrating Xtext Language Server support in Visual Studio Code

  • 1. I N T E G R AT I N G X T E X T L A N G U A G E S E R V E R S U P P O R T I N V I S U A L S T U D I O C O D E Karsten Thoms Eclipse DemoCamp Bonn / 14. November 2016
  • 2. XTEXT UI … for a long time Xtext had only an Eclipse UI
  • 3. 2010 01.April In 2010 I published a blog post and a video that showed an Xtext editor in a RAP web application. Unfortunately this was just an April’s fool joke. At this time it was not possible to provide rich text editors in the web.
  • 4. ECLIPSE NEON 2015 XTEXT 2.9 In 2015 Xtext provided more integration with Web editors and IntelliJ IDEA. At EclipseCon Europe 2014 a web editor was demonstrated with the XRobots showcase.
  • 5. Prototypes can be created fast to demonstrate that Xtext is a good match to solve a problem. These prototypes are often shipped too fast to the customer before becoming mature. If a DSL is initially developed fast by some experts, they are often handed over to less Xtext experienced people to finish it. The result is a fragile project.
  • 6. IntelliJ support has some bugs open and it is quite hard to keep pace with the moving API of IDEA.
  • 7. Something has changed that Microsoft made cool again.
  • 8. WHAT’S NEXT? • Repository Split • Implementation of the Language Server Protocol • https://github.com/Microsoft/vscode-languageserver- protocol • Support other IDEs like Che,VSCode, … • Reduce maintenance effort on IDE integration Dem oCam p Neon June 2016 This was the last slide of my talk at Eclipse DemoCamp Bonn Neon 2016
  • 9. MSVISUAL STUDIO CODE A new player is on the market
  • 10. VS CODE MARKETPLACE …with many great extensions already
  • 13. LANGUAGE SERVER PROTOCOL • Defines a bidirectional protocol between a tool (client) and a „language smartness provider“ (language server) • Open de-facto standard from Microsoft (Team around Erich Gamma) • Used by MicrosoftVisual Studio Code (VS Code), currently work in progress for Eclipse Che, Eclipse Orion, Eclipse IDE • Generic integration of language features:
 Content Assist, Go to definition,Validation, Find references, etc. • JSON-RPC used to define requests, responses and notifications • The client sends messages on interactions: Open document, edit text… • Server maintains semantics of a program for a certain language
  • 15. BASE PROTOCOL • Message consists of Header and Content Part. • Header and Content are separated by ‚rn‘. Header Field Name ValueType Description Content-Length number The length of the content part in bytes.This header is required. Content-Type string The mime type of the content part. Defaults to application/vscode-jsonrpc; charset=utf8 Content-Length: ...rn rn { "jsonrpc": "2.0", "id": 1, "method": "textDocument/didOpen", "params": { ... } } https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 16. BASIC PROTOCOL STRUCTURES (1/3) • Abstract Message
 A general message as defined by JSON-RPC.The language server protocol always uses "2.0" as the jsonrpc version. • RequestMessage
 A request message to describe a request between the client and the server. Every processed request must send a response back to the sender of the request. • Response Message
 Response Message sent as a result of a request. • Notification Message
 A notification message.A processed notification message must not send a response back.They work like events. • Cancellation Support
 The base protocol now offers support for request cancellation.
 interface Message {
 jsonrpc: string
 } interface RequestMessage extends Message {
 id: number | string;
 method: string;
 params?: any
 } interface ResponseMessage extends Message {
 id: number | string;
 result?: any;
 error?: ResponseError<any>;
 } interface NotificationMessage extends Message {
 method: string;
 params?: any
 } interface CancelParams {
 id: number | string;
 } https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 17. BASIC PROTOCOL STRUCTURES (2/3) • Position
 Position in a text document expressed as zero-based line and character offset. • Range
 A range in a text document expressed as (zero-based) start and end positions. • Location
 Represents a location inside a resource, such as a line inside a text file. • Diagnostic
 Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource. • Command
 Represents a reference to a command. Provides a title which will be used to represent a command in the UI and, optionally, an array of arguments which will be passed to the command handler function when invoked. https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 18. BASIC PROTOCOL STRUCTURES (3/3) • TextEdit
 A textual edit applicable to a text document. • WorkspaceEdit
 A workspace edit represents changes to many resources managed in the workspace. • TextDocumentIdentifier
 Text documents are identified using a URI. On the protocol level, URIs are passed as strings. • TextDocumentItem
 An item to transfer a text document from the client to the server. • VersionedTextDocumentIdentifier
 An identifier to denote a specific version of a text document. • TextDocumentPositionParams
 A parameter literal used in requests to pass a text document and a position inside that document.
 https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 19. ACTUAL PROTOCOL (1/7) • Initialize Request
 The initialize request is sent as the first request from the client to the server. • Shutdown Request
 The shutdown request is sent from the client to the server. It asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client).There is a separate exit notification that asks the server to exit.
 
 
 
 
 
 
 
 
 https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 20. ACTUAL PROTOCOL (2/7) • ShowMessage Notification
 The show message notification is sent from a server to a client to ask the client to display a particular message in the user interface. • ShowMessage Request
 The show message request is sent from a server to a client to ask the client to display a particular message in the user interface. In addition to the show message notification the request allows to pass actions and to wait for an answer from the client. • LogMessage Notification
 The log message notification is sent from the server to the client to ask the client to log a particular message. https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 21. ACTUAL PROTOCOL (3/7) • DidChangeConfiguration Notification
 A notification sent from the client to the server to signal the change of configuration settings. • DidOpenTextDocument Notification
 The document open notification is sent from the client to the server to signal newly opened text documents.The document's truth is now managed by the client and the server must not try to read the document's truth using the document's uri. • DidChangeTextDocument Notification
 The document change notification is sent from the client to the server to signal changes to a text document. In 2.0 the shape of the params has changed to include proper version numbers and language ids. • DidCloseTextDocument Notification
 The document close notification is sent from the client to the server when the document got closed in the client.The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri the truth now exists on disk). https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 22. ACTUAL PROTOCOL (4/7) • DidSaveTextDocument Notification
 The document save notification is sent from the client to the server when the document was saved in the client. • DidChangeWatchedFiles Notification
 The watched files notification is sent from the client to the server when the client detects changes to files watched by the language client. • PublishDiagnostics Notification
 Diagnostics notification are sent from the server to the client to signal results of validation runs. • Completion Request
 The Completion request is sent from the client to the server to compute completion items at a given cursor position. Completion items are presented in the IntelliSense user interface. If computing full completion items is expensive, servers can additionally provide a handler for the completion item resolve request.This request is sent when a completion item is selected in the user interface. • Completion Item Resolve Request
 The request is sent from the client to the server to resolve additional information for a given completion item. https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 23. ACTUAL PROTOCOL (5/7) • Hover
 The hover request is sent from the client to the server to request hover information at a given text document position. • Signature Help
 The signature help request is sent from the client to the server to request signature information at a given cursor position. • Goto Definition
 The goto definition request is sent from the client to the server to resolve the definition location of a symbol at a given text document position. • Find References
 The references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position. • Document Highlights
 The document highlight request is sent from the client to the server to resolve a document highlights for a given text document position. https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 24. ACTUAL PROTOCOL (6/7) • Document Symbols
 The document symbol request is sent from the client to the server to list all symbols found in a given text document. • Workspace Symbols
 The workspace symbol request is sent from the client to the server to list project-wide symbols matching the query string. • Code Action
 The code action request is sent from the client to the server to compute commands for a given text document and range.The request is triggered when the user moves the cursor into a problem marker in the editor or presses the lightbulb associated with a marker. • Code Lens
 The code lens request is sent from the client to the server to compute code lenses for a given text document. • Code Lens Resolve
 The code lens resolve request is sent from the client to the server to resolve the command for a given code lens item. https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 25. ACTUAL PROTOCOL (7/7) • Document Formatting
 The document formatting request is sent from the server to the client to format a whole document. • Document Range Formatting
 The document range formatting request is sent from the client to the server to format a given range in a document. • Document on Type Formatting
 The document on type formatting request is sent from the client to the server to format parts of the document during typing. • Rename
 The rename request is sent from the client to the server to perform a workspace-wide rename of a symbol.
 
 
 
 https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
  • 26. LSP JAVA BINDING • A Java Binding for the Language Server Protocol lsp4j is now developed at Eclipse: • https://projects.eclipse.org/projects/technology.lsp4j • lsp4j is used by Xtext Core to implement a generic Language Server for Xtext DSLs
  • 27. XTEXTVSCODE EXTENSION • Extension with external Language Server • Server is running outside of the extension • Communication via sockets • Client initiates the connection and asks server for capabilities • Server shuts down when client is closed • Extension with embedded Language Server • Server is packaged and run within the extension • Communication via process I/O • Server lifecycle bound to extension lifecycle
  • 28. XTEXTVSCODE EXTENSION • VS Code Extension with DSL Fat Jar • Xtext Language Server started as JVM child process • VSC Extension project files generated by Xtext Generator Fragment • https://github.com/itemis/xtext-generator-vscode • About to be contributed to xtext-core generator UberJar size ~14 MB for standard DSL
  • 29. XTEXT CODE GENERATOR FRAGMENT • Xtext Code Generator Fragment in progress • https://github.com/itemis/xtext-generator-vscode
 
 
 
 • Produces theVS Code Extension package component = XtextGenerator {
 language = StandardLanguage {
 ...
 fragment = com.itemis.xtext.generator.vscode.VSCodeExtensionFragment {}
 }
 }
  • 31. GENERATED ARTIFACTS UberJar size ~14 MB for standard DSL
  • 33. GENERATED ARTIFACTS Uber-Jar - DSL Runtime + IDE - Xtext Dependencies - ~14 MB UberJar size ~14 MB for standard DSL
  • 36. BUILD • gradle startCode • Run Xtext DSL generator • Package Fat Jar • PackageVS Code Extension vscode-extension- self-contained-<version>.vsix • StartVS Code and deploy extension