- Notifications
You must be signed in to change notification settings - Fork8
lsp-and-implementation/language-server
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository contains the source code for the example implementation of a language server referenced in the book \title of the book.This language server implementation is associated with an example client implementation as well. The referenced client implementation is done for theVS Code client.
Nadeeshaan Gunasinghe - Technical Lead, WSO2 Inc (Pvt) Ltd.Contact:Email -nadeeshaangunasinghe@gmail.comLinkedIn -https://www.linkedin.com/in/nadeeshaan/Github:https://github.com/nadeeshaan
Nipuna Marcus - Technical Lead, WSO2 Inc (Pvt) LtdContact:Email -nipunamarcus2@gmail.comLinkedIn - linkedin.com/in/nipuna-marcus-0b721143Github:https://github.com/NipunaMarcus
The Language Server Protocol (LSP) has been one of the most talked about topics during the past few years when it comes to the tooling for programming languages. With the advancement of the developer tools and the programming languages, developers started to rely more and more on advanced tools and enhanced language services. When we consider one of the most focused branches of developer tools which is IDEs and text editors, there are many vendors who have released various editing tools in the past couple of decades. When we consider the number of programming languages along with the number of smart editors nowadays, in order to support language intelligence among the editors, these vendors have to repeat the same thing. The Language Server Protocol was introduced to solve this particular problem, and today it has become the norm of the development tools’ language intelligence provider. By adopting the LSP, tools such as text editors and integrated development environments (IDEs) could expand the capabilities and avoid the users’ burden of switching between the development tools for trying new programming languages and frameworks.This book is for the developers who are passionate about developing programming language tools. In this book, we provide the readers a comprehensive understanding about the Language Server Protocol and how to develop a Language Server from scratch. The readers will be guided with code samples to provide a better understanding about the server implementation by adhering to the user experience best practices as well as the LSP best practices. The readers are expected to use the book along with the example implementation, in order to get a better understanding about the concepts describedin the book. In the example implementation, the book refers to VS Code as the client; however, the readers can use any other client and integrate the server implementation as desired.
- The client implementation is done withTypeScript.
- Language Server implementation is done with Java and Java-11 would be preffered
- Language Server implementation is done for theBallerina programming language. The default implementation is done forBallerina Swan Lake Beta 3. You can read more and learn about Ballerina programming language in theofficial doccumentation
- Gradle is used as the build tool for the server component
- Node JS [v12.20.0 at least] andNPM [6.14.x at least] is used as for the client component
This repository contains two components as the client and the server implementation. You have to build these components individually.
Clone the repo
Set the github access tokenIn order to build the repo, you have the set the github access token in the first place. In order to do so, execute the following command
In Unix
export packageUser='your_github_user_name'export packagePAT='your_github_personal_access_token'In Windows
set packageUser='your_github_user_name'set packagePAT='your_github_personal_access_token'Build the Server ImplementationGo to the repo root and execute the following command to build the server implementation../gradlew clean buildThe server implementation will copy the particular uber-jar artifact toREPO_ROOT/client directory.
Build the Client ImplementationGo to theREPO_ROOT/client/ls-client directory and execute the following command to install the Dependenciesnpm installNow execute the following command to build the client and generate the.vsix VS Code plugin artifactnpm run build
- InstallBallerina SwanLake Beta3
- InstallJava
- InstallVS Code
- Install the built
.vsixextension artifact. The plugin itself will start the language server once a.balfile is opened - Open a Ballerina source file from the VSCode editor.
- Explore the language features such as auto-completions, find references, and etc
- You can explore the trace logs for the messages passed between the language server and the client by adding the following configuration option in the user settings.
"ballerina-lang-client.trace.server": "verbose"
Open theREPO_ROOT/client/ls-client/ directory in VS Code.
Go toREPO_ROOT/client/ls-client/.vscode/launch.json file and set theLSDEBUG config value totrue
Run the extension from VSCode
- If you use windows and cannot get the server implementation up and running due to any errors, please check the following and there is a solution as well.Link:https://discord.com/channels/957996897782616114/966324885720825866/1035241303526613053
About
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.