Skip to content

mkeller/language-server-protocol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language Server Protocol

Note: A blog covering the background and mechanics of the protocol has been added to the Visual Studio Code site. Additionally today Red Hat, Eclipse Che and others announced support for the protocol.

The Language Server protocol is used between a tool (the client) and a language smartness provider (the server) to integrate features like auto complete, goto definition, find all references and alike into the tool. The following diagram illustrates the communication between a tool and the language server.

Interaction diagram

The Language server maintains the semantic information about a program implemented in a particular language.

  • When the user opens a document in the tool then it notifies the language server that the document did open and that the truth of the document is now maintained by the tool in an memory buffer.
  • When the user edits the document the server is notified about the changes and the semantic information of program is updated by the language server.
  • As the user makes changes the language server analyses the document and notifies the tool with the errors and warnings (diagnostics) that are found,
  • When the user requests to go to the definition of a symbol, then it sends a definition request to the server. The server responds with a uri of the document that holds the definition and the range inside the document. Based on this information the tool opens the corresponding document at the position where the symbol is defined.
  • When the user closes the document, the a didClose notification is sent, informing the language server that the truth of the file is now on the file system.

The communication between the Editor/IDE host and the Language Server uses JSON RPC v2.0. The protocol supports servers with different capabilities. The first request sent from the Editor/IDE to the language server informs the server about the supported language features.

The first version of the protocol is based on experiences we gained while integrating OmniSharp and the TypeScript Server into VS Code. See the history section for a brief history on how the protocol evolved.

Contributing

If you are interested in fixing issues like typos or contributing directly to the protocol specification you can either file an issue or provide a pull request containing the changes to the protocol.md file.

When proposing an extension to the specification, then please refer to an implementation of the proposed changes in a language server. This will help us in understanding the particular use case.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

The Language Server Protocol

The file protocol.md specifies the language server protocol.

License

Creative Commons Attribution / MIT

About

Defines a common protocol for language servers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published