SlideShare ist ein Scribd-Unternehmen logo
1 von 72
Downloaden Sie, um offline zu lesen
The Language Server Protocol:
Why the Hype?
Mikael Barbero

Eclipse Foundation

Eclipse Summit India 2017
Dear IDE, please
support this new trendy
language!
Dear IDE, please
support this new trendy
language!
Dear language, please
provide integration with
my favorite IDE!
Dear IDE, please
support this new trendy
language!
Dear language, please
provide integration with
my favorite IDE!
Dear IDE, please
support this new trendy
language!
Dear language, please
provide integration with
my favorite IDE!
Language Server Protocol helps building language support!
Implementing language support for an IDE is hard
Expert of the tool Expert of the language
Parser
Semantic analysis
Type system
UI Workflows
APIs
Integration
Java Javascript C/C++ Go Json Rust CSS ...
Eclipse
Eclipse Che
Eclipse Orion
Atom
VisualStudio
Code
...
What is the so-called
Language Server Protocol (LSP)?
–Phil Karlton
“There are only two hard things in Computer Science:
cache invalidation and naming things.”
–Phil Karlton
“There are only two hard things in Computer Science:
cache invalidation and naming things.”
What is the so-called
Language Server Protocol (LSP)?
“A bad name for a Remote Procedure Call (RPC) API that is
used between by a tool and a language smartness provider to
integrate features like auto complete, goto definition, find all
references and alike into the tool”
“A bad name for a Remote Procedure Call (RPC) API that is
used between by a tool and a language smartness provider to
integrate features like auto complete, goto definition, find all
references and alike into the tool”
https://github.com/Microsoft/language-server-protocol
LSP
(RPC API)
Program A
LSP
(RPC API)
Program A Program B
LSP
(RPC API)
Tool
Program A Program B
LSP
(RPC API)
Language
Smartness
Provider
Tool
Program A Program B
LSP
(RPC API)
Language
Smartness
Provider
Tool
Program A Program B
LSP
(RPC API)
Language
Smartness
Provider
Tool
Program A Program B
LSP
(Client)
(RPC API)
Language
Smartness
Provider
Tool
Program A Program B
LSP
(Client) (Server)
(RPC API)
Language
Smartness
Provider
Tool
Program A Program B
LSP
Language
Smartness
Provider
Tool
Program A Program B
LSP
Tool
Tool
Tool
Language
Smartness Provider
Tool
Tool
Tool
Language
Smartness Provider
N
o
m
ultitenancy
Implementing language support for an IDE is easier
Expert of the tool Expert of the language
Parser
Semantic analysis
Type system
UI Workflows
APIs
Integration
LSP
Eclipse
Eclipse Che
Eclipse Orion
Atom
VisualStudio
Code
...
Java
Javascript
C/C++
Go
Json
Rust
CSS
...
LSP
DRY
(don't repeat yourself)
Current Status - Clients Support
Eclipse CheEclipse (LSP4e) NeoVim
Visual Studio
Code
Sublime TextEmacs VimAtom
Work in Progress
Eclipse Orion
Current Status - Languages Support
Current Status - LSP SDKs
node.js MS vscode-languageserver-node
C# MS work in progress by David Wilson
Java Eclipse, TypeFox Eclipse LSP4J
Haxe @nadako language-server-protocol-haxe
PHP Felix Becker php-language-server
Rust Bruno Medeiros RustLSP
Haskell Alan Zimmerman Haskell-LSP
C# OmniSharp C#-LSP
C# Inomata Kentaro LanguageServerProtocol
SDK/libraries support implementing the protocol in a particular language.
LSP in depth
JSON-RPC based API
)]}'
JSON-RPC
Stateless RPC
protocol
(use "id" used by client to
track responses)
JSON as data
format of request
and responses
Agnostic of
transport layer
(can be Sockets, Shared
Memory, PIPE, HTTP, ...)
JSON-RPC
Program A Program B
JSON-RPC
{
"jsonrpc": "2.0",
"method": "subtract",
"params": [42, 23],
"id": 1
}
Program A Program B
JSON-RPC
{
"jsonrpc": "2.0",
"result": 19,
"id": 1
}
{
"jsonrpc": "2.0",
"method": "subtract",
"params": [42, 23],
"id": 1
}
Program A Program B
Agnostic of
transport layer
(can be Sockets, Shared
Memory, PIPE, HTTP, ...)
Clients can only communicate with servers if they
talk on the same transport channel.
e.g., if a server only supports pipes (stdin / stdout),
a client that uses sockets won’t be able to use it.
LSP in a nutshell
A set of JSON-RPC requests,
responses and notifications to integrate
tools (clients) and language smartness
providers (servers)
LSP: Client Requests
Completion
Requests a list of completion
items from a document
position. Resolution can be
done in two steps
Hover
Requests hover information at a
given text document position.
Result is a markdown string or
a pair of a language and a code
block value
Signature Help
Requests signature
information at a given cursor
position (e.g. used to display a
tooltip with signature when
typing a method call)
References
Requests to resolve project-
wide references for the
symbol denoted by the given
text document position
Workspace Symbols
Requests to list project-wide
symbols matching the query
string (usually the name /
name prefix of the symbol)
Document Symbols
Requests to list all symbols
found in a given text
document
LSP: Client Requests (cont'd)
Formatting
Requests to format a whole
document
Range Formatting
Requests to format a given
range in a document
On Type Formatting
Requests to format parts of
the document during typing.
Trigger characters are
configured at registration time
Go to Definition
Requests to resolve the
definition location of a symbol
at a given text document
position
Code Action
Requests to compute
commands for a given text
document and range. Can be
used for instance to get the
list of quick fixes for a given
problem
Code Lens
Request to compute code
lenses for a given text
document. It returns a list of
commands to be executed for
some text ranges (e.g.
number of references)
LSP: Client Requests (cont'd again)
Rename
Requests to perform a
workspace-wide rename of a
symbol
Document Links
Requests the location of links
in a document. Resolution can
be done in two steps
Document Highlight
Requests to resolve a
document highlights for a
given text document position
(e.g., to mark all occurrences
of the variable for a given
position)
Typical lifecycle (startup)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Client Tool
(e.g., Eclipse, VSCode)
Typical lifecycle (startup)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Start
Client Tool
(e.g., Eclipse, VSCode)
(not defined by LSP)
Can be child process, daemon, run image in
container, HEAD http://server/status, …
Typical lifecycle (startup)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Start
Initialize
Params: rootUri, the root URI of the workspace + client
capabilities
The protocol does not define how the rootUri parameter should be used by the servers. Most servers expect file: URIs. JDT-LS uses
this URI to provision an Eclipse Workspace (i.e. imports all Eclipse, Gradle and Maven projects it can find in the rootUri hierarchy).
Client Tool
(e.g., Eclipse, VSCode)
(not defined by LSP)
Can be child process, daemon, run image in
container, HEAD http://server/status, …
Typical lifecycle (startup)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Start
Initialize
Params: rootUri, the root URI of the workspace + client
capabilities
Returns server capabilities (like how text documents are
synced)
The protocol does not define how the rootUri parameter should be used by the servers. Most servers expect file: URIs. JDT-LS uses
this URI to provision an Eclipse Workspace (i.e. imports all Eclipse, Gradle and Maven projects it can find in the rootUri hierarchy).
Client Tool
(e.g., Eclipse, VSCode)
(not defined by LSP)
Can be child process, daemon, run image in
container, HEAD http://server/status, …
Typical lifecycle (editing)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Client Tool
(e.g., Eclipse, VSCode)
Typical lifecycle (editing)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
didOpen
Client Tool
(e.g., Eclipse, VSCode)
Notifies the server that 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
Typical lifecycle (editing)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
didOpen
didChange
Signals changes to a text document (the granularity of the
reported changes are defined by server capabilities)
Client Tool
(e.g., Eclipse, VSCode)
Notifies the server that 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
Typical lifecycle (editing)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
didOpen
didChange
Signals changes to a text document (the granularity of the
reported changes are defined by server capabilities)
Usually will notify about new diagnostics, some time later
Client Tool
(e.g., Eclipse, VSCode)
Notifies the server that 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
Typical lifecycle (editing)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
didOpen
didChange
Signals changes to a text document (the granularity of the
reported changes are defined by server capabilities)
Usually will notify about new diagnostics, some time later
The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not
need to be notified about these events.
Client Tool
(e.g., Eclipse, VSCode)
Notifies the server that 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
Typical lifecycle (saving)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Client Tool
(e.g., Eclipse, VSCode)
The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not
need to be notified about these events.
Typical lifecycle (saving)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
willSave | willSaveWaitUntil
Client Tool
(e.g., Eclipse, VSCode)
+ Reason of the save (manual, after delay, focus out). "Wait until" is a way to
get all the edits that should be apply before saving (e.g. if a refactoring has
been requested before and it still being computed on the server side)
The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not
need to be notified about these events.
Typical lifecycle (saving)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
willSave | willSaveWaitUntil
didSave
Can include the whole text document if server capabilities
require it
Client Tool
(e.g., Eclipse, VSCode)
+ Reason of the save (manual, after delay, focus out). "Wait until" is a way to
get all the edits that should be apply before saving (e.g. if a refactoring has
been requested before and it still being computed on the server side)
The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not
need to be notified about these events.
Typical lifecycle (saving)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
willSave | willSaveWaitUntil
didSave
Can include the whole text document if server capabilities
require it
The document's truth now exists where the document's uri
points to.
Client Tool
(e.g., Eclipse, VSCode)
+ Reason of the save (manual, after delay, focus out). "Wait until" is a way to
get all the edits that should be apply before saving (e.g. if a refactoring has
been requested before and it still being computed on the server side)
didClose
The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not
need to be notified about these events.
Typical lifecycle (shutdown)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
Client Tool
(e.g., Eclipse, VSCode)
Typical lifecycle (shutdown)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
shutdown
Client Tool
(e.g., Eclipse, VSCode)
Asks the server to shut down, but to not exit (otherwise the
response might not be delivered correctly to the client)
Typical lifecycle (shutdown)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
shutdown
May return errors
Client Tool
(e.g., Eclipse, VSCode)
Asks the server to shut down, but to not exit (otherwise the
response might not be delivered correctly to the client)
Typical lifecycle (shutdown)
Client
(e.g., VSCode, Eclipse)
Language Server
(e.g., JDT-LS, PHP-LS)
shutdown
exit
May return errors
Asks the server to exit its process. The server should exit
with success code 0 if the shutdown request has been
received before; otherwise with error code 1.
The specification explicitly talk about exiting a process on the ‘exit’ notification. Of course, some clients that will interact with daemons,
containers or HTTP servers will use this notification differently.
Client Tool
(e.g., Eclipse, VSCode)
Asks the server to shut down, but to not exit (otherwise the
response might not be delivered correctly to the client)
Server does no editing
All editing is done on the client side
• The server can read files, but all file modifications
are sent to the clients in the form of a
WorkspaceEdit.
• The client applies the edits and notifies the server
about the changes so he can refresh changed
files.
• To execute a command (e.g. quick fix or a
rename), the client send a request that the server
acknowledge or not. If it does, then the server
compute the changes and send a request to the
client for him to apply the modifications
LSP Limitations
Text Editing Only
No support for running, testing or debugging
Ongoing work for debug
https://github.com/Microsoft/vscode-debugadapter-node
No Advanced Tooling
Types hierarchy Advanced refactoring
Syntax Highlighting, Bracket Matchings and Code Folding
Deferred to the client's editor
Requires tokenizer and / or grammar in addition to the language server
No Communication between Language Servers
No cross-languages go to
definition or refactoring
No Packaging Standard
• Currently: specific to each editor
• Language servers can have a lot
of native dependencies
• Possible solution: use docker to
package and run LS
No standard transport or transport negotiation
Potential solutions:
• Force transport negotiation via a
specific transport during startup
phase
• Store metadata about the language
servers in a registry / marketplace
??
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
Key Takeaways: why the hype?
Mikaël Barbero
mikael.barbero@eclipse-foundation.org
@mikbarbero
https://eclipse.org/community/eclipse_newsletter/2017/may/
Key Takeaways: why the hype?
Promising and
powerful
abstraction for
language tooling
development
Mikaël Barbero
mikael.barbero@eclipse-foundation.org
@mikbarbero
https://eclipse.org/community/eclipse_newsletter/2017/may/
Key Takeaways: why the hype?
Promising and
powerful
abstraction for
language tooling
development
Still young and has
shortcomings
Mikaël Barbero
mikael.barbero@eclipse-foundation.org
@mikbarbero
https://eclipse.org/community/eclipse_newsletter/2017/may/
Key Takeaways: why the hype?
Promising and
powerful
abstraction for
language tooling
development
Still young and has
shortcomings
Paradigm shift in
tooling
development:
microservices
Mikaël Barbero
mikael.barbero@eclipse-foundation.org
@mikbarbero
https://eclipse.org/community/eclipse_newsletter/2017/may/

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

HDFS: Optimization, Stabilization and Supportability
HDFS: Optimization, Stabilization and SupportabilityHDFS: Optimization, Stabilization and Supportability
HDFS: Optimization, Stabilization and Supportability
 
Handling eventual consistency in a transactional world with Matteo Cimini and...
Handling eventual consistency in a transactional world with Matteo Cimini and...Handling eventual consistency in a transactional world with Matteo Cimini and...
Handling eventual consistency in a transactional world with Matteo Cimini and...
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
Data Structures used in Linux kernel
Data Structures used in Linux kernel Data Structures used in Linux kernel
Data Structures used in Linux kernel
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 
Transactions and Concurrency Control Patterns
Transactions and Concurrency Control PatternsTransactions and Concurrency Control Patterns
Transactions and Concurrency Control Patterns
 
Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17Jakarta EE 8 on JDK17
Jakarta EE 8 on JDK17
 
Everything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native ImageEverything you need to know about GraalVM Native Image
Everything you need to know about GraalVM Native Image
 
Everything We Learned About In-Memory Data Layout While Building VoltDB
Everything We Learned About In-Memory Data Layout While Building VoltDBEverything We Learned About In-Memory Data Layout While Building VoltDB
Everything We Learned About In-Memory Data Layout While Building VoltDB
 
Implementing Microservices Security Patterns & Protocols with Spring
Implementing Microservices Security Patterns & Protocols with SpringImplementing Microservices Security Patterns & Protocols with Spring
Implementing Microservices Security Patterns & Protocols with Spring
 
Arm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportArm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler support
 
Camel Day Italia 2021 - Camel K
Camel Day Italia 2021 - Camel KCamel Day Italia 2021 - Camel K
Camel Day Italia 2021 - Camel K
 
Why Micro Focus Chose Pulsar for Data Ingestion - Pulsar Summit NA 2021
Why Micro Focus Chose Pulsar for Data Ingestion - Pulsar Summit NA 2021Why Micro Focus Chose Pulsar for Data Ingestion - Pulsar Summit NA 2021
Why Micro Focus Chose Pulsar for Data Ingestion - Pulsar Summit NA 2021
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
Kafka internals
Kafka internalsKafka internals
Kafka internals
 
ARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- OverviewARM and SoC Traning Part I -- Overview
ARM and SoC Traning Part I -- Overview
 
micro-ROS: bringing ROS 2 to MCUs
micro-ROS: bringing ROS 2 to MCUsmicro-ROS: bringing ROS 2 to MCUs
micro-ROS: bringing ROS 2 to MCUs
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Embedded Hypervisor for ARM
Embedded Hypervisor for ARMEmbedded Hypervisor for ARM
Embedded Hypervisor for ARM
 

Ähnlich wie Language Server Protocol - Why the Hype?

Ähnlich wie Language Server Protocol - Why the Hype? (20)

Integrating Xtext Language Server support in Visual Studio Code
Integrating Xtext Language Server support in Visual Studio CodeIntegrating Xtext Language Server support in Visual Studio Code
Integrating Xtext Language Server support in Visual Studio Code
 
Avro
AvroAvro
Avro
 
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
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
[EclipseCon France 2017] Language Server Protocol in action
[EclipseCon France 2017] Language Server Protocol in action[EclipseCon France 2017] Language Server Protocol in action
[EclipseCon France 2017] Language Server Protocol in action
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 
Visual studio
Visual studioVisual studio
Visual studio
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Learn about Java framework for pen-based computing and the Livescribe Platfor...
Learn about Java framework for pen-based computing and the Livescribe Platfor...Learn about Java framework for pen-based computing and the Livescribe Platfor...
Learn about Java framework for pen-based computing and the Livescribe Platfor...
 
DSL explained _
DSL explained _DSL explained _
DSL explained _
 
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San JoseTypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
 
EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...
EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...
EclipseCon Europe 2016, S. Cela, M.Istria: Eclipse Generic and Extensible Edi...
 
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
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languages
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
 
Networked APIs with swift
Networked APIs with swiftNetworked APIs with swift
Networked APIs with swift
 
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
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler Construction
 
Crystal internals (part 1)
Crystal internals (part 1)Crystal internals (part 1)
Crystal internals (part 1)
 

Mehr von mikaelbarbero

Diff and Merge with Ease: EMF Compare
Diff and Merge with Ease: EMF CompareDiff and Merge with Ease: EMF Compare
Diff and Merge with Ease: EMF Compare
mikaelbarbero
 
OSGi: Don't let me be Misunderstood
OSGi: Don't let me be MisunderstoodOSGi: Don't let me be Misunderstood
OSGi: Don't let me be Misunderstood
mikaelbarbero
 
EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!
mikaelbarbero
 
Google Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantes
mikaelbarbero
 
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
mikaelbarbero
 

Mehr von mikaelbarbero (19)

Kubernetes 101 - A Cluster Operating System
Kubernetes 101 - A Cluster Operating SystemKubernetes 101 - A Cluster Operating System
Kubernetes 101 - A Cluster Operating System
 
What's new in Eclipse Oxygen (Devoxx France 2017)
What's new in Eclipse Oxygen (Devoxx France 2017)What's new in Eclipse Oxygen (Devoxx France 2017)
What's new in Eclipse Oxygen (Devoxx France 2017)
 
The Eclipse IDE: What's new in the 2017 release?
The Eclipse IDE: What's new in the 2017 release?The Eclipse IDE: What's new in the 2017 release?
The Eclipse IDE: What's new in the 2017 release?
 
What every Eclipse developer should know about progress reporting and job can...
What every Eclipse developer should know about progress reporting and job can...What every Eclipse developer should know about progress reporting and job can...
What every Eclipse developer should know about progress reporting and job can...
 
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
The Eclipse IDE - The Force Awakens (Devoxx France 2016)The Eclipse IDE - The Force Awakens (Devoxx France 2016)
The Eclipse IDE - The Force Awakens (Devoxx France 2016)
 
Sirius: Graphical Editors for your DSLs
Sirius: Graphical Editors for your DSLsSirius: Graphical Editors for your DSLs
Sirius: Graphical Editors for your DSLs
 
Modeling in a Team Environment with EMF Compare and EGit
Modeling in a Team Environment with EMF Compare and EGitModeling in a Team Environment with EMF Compare and EGit
Modeling in a Team Environment with EMF Compare and EGit
 
Diff and Merge with Ease: EMF Compare
Diff and Merge with Ease: EMF CompareDiff and Merge with Ease: EMF Compare
Diff and Merge with Ease: EMF Compare
 
Eclipse simultaneous release in a nutshell
Eclipse simultaneous release in a nutshellEclipse simultaneous release in a nutshell
Eclipse simultaneous release in a nutshell
 
OSGi: Don't let me be Misunderstood
OSGi: Don't let me be MisunderstoodOSGi: Don't let me be Misunderstood
OSGi: Don't let me be Misunderstood
 
EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!
 
EMF Compare 2.0: Scaling to Millions (updated)
EMF Compare 2.0: Scaling to Millions (updated)EMF Compare 2.0: Scaling to Millions (updated)
EMF Compare 2.0: Scaling to Millions (updated)
 
EMFCompare 2.0: Scaling to Millions
EMFCompare 2.0: Scaling to MillionsEMFCompare 2.0: Scaling to Millions
EMFCompare 2.0: Scaling to Millions
 
3mf infinity-and-beyond
3mf infinity-and-beyond3mf infinity-and-beyond
3mf infinity-and-beyond
 
Eclipseconeurope 2011 - EMFCompare Improvements
Eclipseconeurope 2011 - EMFCompare ImprovementsEclipseconeurope 2011 - EMFCompare Improvements
Eclipseconeurope 2011 - EMFCompare Improvements
 
Google Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantes
 
5M lines of code migration
5M lines of code migration5M lines of code migration
5M lines of code migration
 
EMFPath
EMFPathEMFPath
EMFPath
 
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
 

Kürzlich hochgeladen

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Kürzlich hochgeladen (20)

%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 

Language Server Protocol - Why the Hype?

  • 1. The Language Server Protocol: Why the Hype? Mikael Barbero Eclipse Foundation Eclipse Summit India 2017
  • 2. Dear IDE, please support this new trendy language!
  • 3. Dear IDE, please support this new trendy language! Dear language, please provide integration with my favorite IDE!
  • 4. Dear IDE, please support this new trendy language! Dear language, please provide integration with my favorite IDE!
  • 5. Dear IDE, please support this new trendy language! Dear language, please provide integration with my favorite IDE! Language Server Protocol helps building language support!
  • 6. Implementing language support for an IDE is hard Expert of the tool Expert of the language Parser Semantic analysis Type system UI Workflows APIs Integration
  • 7. Java Javascript C/C++ Go Json Rust CSS ... Eclipse Eclipse Che Eclipse Orion Atom VisualStudio Code ...
  • 8. What is the so-called Language Server Protocol (LSP)?
  • 9. –Phil Karlton “There are only two hard things in Computer Science: cache invalidation and naming things.”
  • 10. –Phil Karlton “There are only two hard things in Computer Science: cache invalidation and naming things.”
  • 11. What is the so-called Language Server Protocol (LSP)?
  • 12. “A bad name for a Remote Procedure Call (RPC) API that is used between by a tool and a language smartness provider to integrate features like auto complete, goto definition, find all references and alike into the tool”
  • 13. “A bad name for a Remote Procedure Call (RPC) API that is used between by a tool and a language smartness provider to integrate features like auto complete, goto definition, find all references and alike into the tool”
  • 17. Program A Program B LSP (RPC API)
  • 18. Tool Program A Program B LSP (RPC API)
  • 22. Language Smartness Provider Tool Program A Program B LSP (Client) (Server) (RPC API)
  • 27. Implementing language support for an IDE is easier Expert of the tool Expert of the language Parser Semantic analysis Type system UI Workflows APIs Integration LSP
  • 29. Current Status - Clients Support Eclipse CheEclipse (LSP4e) NeoVim Visual Studio Code Sublime TextEmacs VimAtom Work in Progress Eclipse Orion
  • 30. Current Status - Languages Support
  • 31. Current Status - LSP SDKs node.js MS vscode-languageserver-node C# MS work in progress by David Wilson Java Eclipse, TypeFox Eclipse LSP4J Haxe @nadako language-server-protocol-haxe PHP Felix Becker php-language-server Rust Bruno Medeiros RustLSP Haskell Alan Zimmerman Haskell-LSP C# OmniSharp C#-LSP C# Inomata Kentaro LanguageServerProtocol SDK/libraries support implementing the protocol in a particular language.
  • 34. JSON-RPC Stateless RPC protocol (use "id" used by client to track responses) JSON as data format of request and responses Agnostic of transport layer (can be Sockets, Shared Memory, PIPE, HTTP, ...)
  • 36. JSON-RPC { "jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1 } Program A Program B
  • 37. JSON-RPC { "jsonrpc": "2.0", "result": 19, "id": 1 } { "jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1 } Program A Program B
  • 38. Agnostic of transport layer (can be Sockets, Shared Memory, PIPE, HTTP, ...) Clients can only communicate with servers if they talk on the same transport channel. e.g., if a server only supports pipes (stdin / stdout), a client that uses sockets won’t be able to use it.
  • 39. LSP in a nutshell A set of JSON-RPC requests, responses and notifications to integrate tools (clients) and language smartness providers (servers)
  • 40. LSP: Client Requests Completion Requests a list of completion items from a document position. Resolution can be done in two steps Hover Requests hover information at a given text document position. Result is a markdown string or a pair of a language and a code block value Signature Help Requests signature information at a given cursor position (e.g. used to display a tooltip with signature when typing a method call) References Requests to resolve project- wide references for the symbol denoted by the given text document position Workspace Symbols Requests to list project-wide symbols matching the query string (usually the name / name prefix of the symbol) Document Symbols Requests to list all symbols found in a given text document
  • 41. LSP: Client Requests (cont'd) Formatting Requests to format a whole document Range Formatting Requests to format a given range in a document On Type Formatting Requests to format parts of the document during typing. Trigger characters are configured at registration time Go to Definition Requests to resolve the definition location of a symbol at a given text document position Code Action Requests to compute commands for a given text document and range. Can be used for instance to get the list of quick fixes for a given problem Code Lens Request to compute code lenses for a given text document. It returns a list of commands to be executed for some text ranges (e.g. number of references)
  • 42. LSP: Client Requests (cont'd again) Rename Requests to perform a workspace-wide rename of a symbol Document Links Requests the location of links in a document. Resolution can be done in two steps Document Highlight Requests to resolve a document highlights for a given text document position (e.g., to mark all occurrences of the variable for a given position)
  • 43. Typical lifecycle (startup) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Client Tool (e.g., Eclipse, VSCode)
  • 44. Typical lifecycle (startup) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Start Client Tool (e.g., Eclipse, VSCode) (not defined by LSP) Can be child process, daemon, run image in container, HEAD http://server/status, …
  • 45. Typical lifecycle (startup) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Start Initialize Params: rootUri, the root URI of the workspace + client capabilities The protocol does not define how the rootUri parameter should be used by the servers. Most servers expect file: URIs. JDT-LS uses this URI to provision an Eclipse Workspace (i.e. imports all Eclipse, Gradle and Maven projects it can find in the rootUri hierarchy). Client Tool (e.g., Eclipse, VSCode) (not defined by LSP) Can be child process, daemon, run image in container, HEAD http://server/status, …
  • 46. Typical lifecycle (startup) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Start Initialize Params: rootUri, the root URI of the workspace + client capabilities Returns server capabilities (like how text documents are synced) The protocol does not define how the rootUri parameter should be used by the servers. Most servers expect file: URIs. JDT-LS uses this URI to provision an Eclipse Workspace (i.e. imports all Eclipse, Gradle and Maven projects it can find in the rootUri hierarchy). Client Tool (e.g., Eclipse, VSCode) (not defined by LSP) Can be child process, daemon, run image in container, HEAD http://server/status, …
  • 47. Typical lifecycle (editing) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Client Tool (e.g., Eclipse, VSCode)
  • 48. Typical lifecycle (editing) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) didOpen Client Tool (e.g., Eclipse, VSCode) Notifies the server that 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
  • 49. Typical lifecycle (editing) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) didOpen didChange Signals changes to a text document (the granularity of the reported changes are defined by server capabilities) Client Tool (e.g., Eclipse, VSCode) Notifies the server that 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
  • 50. Typical lifecycle (editing) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) didOpen didChange Signals changes to a text document (the granularity of the reported changes are defined by server capabilities) Usually will notify about new diagnostics, some time later Client Tool (e.g., Eclipse, VSCode) Notifies the server that 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
  • 51. Typical lifecycle (editing) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) didOpen didChange Signals changes to a text document (the granularity of the reported changes are defined by server capabilities) Usually will notify about new diagnostics, some time later The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not need to be notified about these events. Client Tool (e.g., Eclipse, VSCode) Notifies the server that 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
  • 52. Typical lifecycle (saving) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Client Tool (e.g., Eclipse, VSCode) The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not need to be notified about these events.
  • 53. Typical lifecycle (saving) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) willSave | willSaveWaitUntil Client Tool (e.g., Eclipse, VSCode) + Reason of the save (manual, after delay, focus out). "Wait until" is a way to get all the edits that should be apply before saving (e.g. if a refactoring has been requested before and it still being computed on the server side) The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not need to be notified about these events.
  • 54. Typical lifecycle (saving) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) willSave | willSaveWaitUntil didSave Can include the whole text document if server capabilities require it Client Tool (e.g., Eclipse, VSCode) + Reason of the save (manual, after delay, focus out). "Wait until" is a way to get all the edits that should be apply before saving (e.g. if a refactoring has been requested before and it still being computed on the server side) The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not need to be notified about these events.
  • 55. Typical lifecycle (saving) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) willSave | willSaveWaitUntil didSave Can include the whole text document if server capabilities require it The document's truth now exists where the document's uri points to. Client Tool (e.g., Eclipse, VSCode) + Reason of the save (manual, after delay, focus out). "Wait until" is a way to get all the edits that should be apply before saving (e.g. if a refactoring has been requested before and it still being computed on the server side) didClose The didOpen, didChange (and willSave, save, didClose) are not mandatory. Some servers expose via their capabilities that they do not need to be notified about these events.
  • 56. Typical lifecycle (shutdown) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) Client Tool (e.g., Eclipse, VSCode)
  • 57. Typical lifecycle (shutdown) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) shutdown Client Tool (e.g., Eclipse, VSCode) Asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client)
  • 58. Typical lifecycle (shutdown) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) shutdown May return errors Client Tool (e.g., Eclipse, VSCode) Asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client)
  • 59. Typical lifecycle (shutdown) Client (e.g., VSCode, Eclipse) Language Server (e.g., JDT-LS, PHP-LS) shutdown exit May return errors Asks the server to exit its process. The server should exit with success code 0 if the shutdown request has been received before; otherwise with error code 1. The specification explicitly talk about exiting a process on the ‘exit’ notification. Of course, some clients that will interact with daemons, containers or HTTP servers will use this notification differently. Client Tool (e.g., Eclipse, VSCode) Asks the server to shut down, but to not exit (otherwise the response might not be delivered correctly to the client)
  • 60. Server does no editing All editing is done on the client side • The server can read files, but all file modifications are sent to the clients in the form of a WorkspaceEdit. • The client applies the edits and notifies the server about the changes so he can refresh changed files. • To execute a command (e.g. quick fix or a rename), the client send a request that the server acknowledge or not. If it does, then the server compute the changes and send a request to the client for him to apply the modifications
  • 62. Text Editing Only No support for running, testing or debugging Ongoing work for debug https://github.com/Microsoft/vscode-debugadapter-node
  • 63. No Advanced Tooling Types hierarchy Advanced refactoring
  • 64. Syntax Highlighting, Bracket Matchings and Code Folding Deferred to the client's editor Requires tokenizer and / or grammar in addition to the language server
  • 65. No Communication between Language Servers No cross-languages go to definition or refactoring
  • 66. No Packaging Standard • Currently: specific to each editor • Language servers can have a lot of native dependencies • Possible solution: use docker to package and run LS
  • 67. No standard transport or transport negotiation Potential solutions: • Force transport negotiation via a specific transport during startup phase • Store metadata about the language servers in a registry / marketplace
  • 69. Key Takeaways: why the hype? Mikaël Barbero mikael.barbero@eclipse-foundation.org @mikbarbero https://eclipse.org/community/eclipse_newsletter/2017/may/
  • 70. Key Takeaways: why the hype? Promising and powerful abstraction for language tooling development Mikaël Barbero mikael.barbero@eclipse-foundation.org @mikbarbero https://eclipse.org/community/eclipse_newsletter/2017/may/
  • 71. Key Takeaways: why the hype? Promising and powerful abstraction for language tooling development Still young and has shortcomings Mikaël Barbero mikael.barbero@eclipse-foundation.org @mikbarbero https://eclipse.org/community/eclipse_newsletter/2017/may/
  • 72. Key Takeaways: why the hype? Promising and powerful abstraction for language tooling development Still young and has shortcomings Paradigm shift in tooling development: microservices Mikaël Barbero mikael.barbero@eclipse-foundation.org @mikbarbero https://eclipse.org/community/eclipse_newsletter/2017/may/