Still heavily work in progress. It uses tree-sitter as a dependency and therefore is not plug and play at the moment. Also the repository currently implements the Definition and Hover Providers on top of the Parse Tree and an AST-Construction function on top of the Parse Tree aswell. Implemented LSP features do not use AST at all.
As a first milestone, it is supposed to support the basic examples of the https://github.com/p4lang/tutorials repository.
This repository is based on the official Microsoft LSP example repository.
You can use the language server component of this repository without the vscode-extension. Make sure you satisfy the dependencies of node-gyp for your operating system. Afterwards,
npm install
in the root of this repositorynpm run compile:ls
to build the language server for NodeJS
To use the language server standalone, run
node server/out/server/src/server.js --stdio
.
├── client // Language Client
│ ├── src
│ │ |
│ │ └── extension.ts // Language Client entry point
├── package.json // The extension manifest.
└── server // Language Server
└── src
└── server.ts // Language Server entry point
- Run
npm install
in this folder. This installs all necessary npm modules in both the client and server folder - Open VS Code on this folder.
- Press Ctrl+Shift+B to compile the client and server.
- Switch to the Debug viewlet.
- Select
Launch Client
from the drop down. - Run the launch config.
- If you want to debug the server as well use the launch configuration
Attach to Server
- In the [Extension Development Host] instance of VSCode, open a P4 source file.