This repository contains two main projects: a client written in TypeScript and a server written in .NET Core. These projects work together to implement a Language Server Protocol (LSP) for plaintext files.
The Language Server Protocol (LSP) is a protocol used between a code editor (like Visual Studio Code) and a language server that provides language features such as auto-completion, go-to-definition, and diagnostics. The goal of LSP is to standardize the communication between the editor and the language server, allowing for better integration and support for multiple programming languages.
For more information on LSP, you can read the official LSP specification.
The client project is written in TypeScript and requires NodeJs to be installed. It is responsible for communicating with the language server and providing language features to the editor.
The server project is written in .NET Core. It implements the language server that provides language features for plaintext files.
- NodeJs (for the client)
- TypeScript compiler. For example
npm install -g typescript
- .NET Core 8.0 SDK (for the server)
- Visual Studio Code
- Clone the repository:
git clone https://github.com/grant-archibald-ms/plaintext-lsp.git
cd plaintext-lsp
- Set up the client:
cd src/client
npm install
npm run compile
- Set up the server:
cd ../PlaintextLspServer
dotnet restore
- Start the server:
cd PlaintextLspServer
dotnet run
The server will start listening on the port specified in the `config.json` file (default is 8080).
-
Open the src/client folder in Visual Studio Code
-
Open the src/client.ts file
-
Select F5 to start debugging the extension. The client will connect to the server and start providing language features for plaintext files.
-
Experiment with adding capitals to have diagnostic errors
-
Type list
Test.
then press control space to get completion suggetions
The server port can be configured in the config.json
file located in the PlaintextLspServer
directory. The default port is 8080.
The client port can be configured in Visual Studio Code Settings