Code Monkey home page Code Monkey logo

lsprotocol's Introduction

Language Server Protocol types code generator & packages

This repository contains packages and tools to generate code for Language Server Protocol types and classes.

It simplifies the creation of language servers for different programming languages by providing a robust and easy-to-use type generation system.

➡️ For instructions on how to use the code generator, refer to the Usage section.

➡️ For instructions on existing plugins and packages for different languages, refer to the table in the Existing packages/plugins section.

➡️ For instructions on how to create additional plugins to support more languages, refer to the Contributing plugins section.

Code Generator Usage

You will need a Python environment to run the generator. Here are the steps:

  1. Create a Python environment: python -m venv .venv

    Note: Python 3.8 is the minimum supported version

  2. Activate the environment: .venv\Scripts\activate (Windows) or source .venv/bin/activate (Linux/macOS)
  3. Install this repo's tool: python -m pip install git+https://github.com/microsoft/lsprotocol.git
  4. Run your plugin. You can use the command line or Nox to run the generator.

Command line

Clone this repository and run generator as a Python module.

For example: python -m generator --plugin dotnet --output-dir ./code

>python -m generator --help
usage: __main__.py [-h] [--model [MODEL [MODEL ...]]] --plugin PLUGIN
                   [--output-dir OUTPUT_DIR]

Generate types from LSP JSON model.

optional arguments:
  -h, --help            show this help message and exit
  --model [MODEL [MODEL ...]], -m [MODEL [MODEL ...]]
                        Path to a model JSON file. By default uses packaged
                        model file.
  --plugin PLUGIN, -p PLUGIN
                        Name of a builtin plugin module. By default uses all
                        plugins.
  --output-dir OUTPUT_DIR, -o OUTPUT_DIR
                        Path to a directory where the generated content is

Using Nox

This project uses Nox as a task runner to run the code generator. You can install Nox and run a build_lsp session to generate code from the spec available in this repo.

> python -m pip install nox
> nox --session build_lsp

You can also use Nox to format code, run tests and run various tasks. Run nox --list to see all available tasks.

Contributing plugins

Adding a new plugin

Follow these steps to generate boilerplate code for a new plugin:

  1. Create a virtual environment for Python using Python >= 3.8 and activate that environment.
    1. If you are using the Python extension for VS Code, you can just run the Python: Create Environment command from the Command Palette. Be sure to select all the requirements.txt files in the repo. This command will install all packages needed and select the newly created environment for you.
  2. Ensure nox is installed.
    1. Run nox --list in the terminal. If Nox is installed, you should see a list of all available sessions. Otherwise, run python -m pip install nox in the activated environment you created above.
  3. Run nox --session create_plugin and follow the prompts to create a new plugin.

Example:

> nox --session create_plugin
nox > Running session create_plugin
nox > Creating virtual environment (virtualenv) using python.exe in .nox\create_plugin
Enter the name of the plugin: java
nox > Created plugin java.
nox > Session create_plugin was successful.

Existing packages/plugins

Below is the list of plugins already created using this package, with their respective package links.

Language Plugin Module Package Status Documentation
Python generator.plugins.python PyPI Active Python package README
Rust generator.plugins.rust Crates Active Rust package README
Dotnet generator.plugins.dotnet Under development

lsprotocol's People

Contributors

0xjonas avatar 39555 avatar alcarney avatar anthonykim1 avatar dependabot[bot] avatar dimbleby avatar jhossbach avatar karthiknadig avatar lramos15 avatar luabud avatar microsoft-github-operations[bot] avatar microsoftopensource avatar muffinmad avatar r3m0t avatar rzhao271 avatar svenberkvens avatar timheuer avatar

Watchers

 avatar  avatar

lsprotocol's Issues

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 68aea48ae13d51d0345fe8fb35a678bf1369028865ee29b2ae992b71e90ba799

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: b636d13b4eeb57655ac72b9fc2338ddf172a79e49b1efa7da9b0e0edea7916b4

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 89fc1a2dd8552b340dc0511c76b3e3207d5399b27064f78186d83d16dbb12a2d

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 0c8e3e52386a7162a58327462077451557f449808b62fb9b675b79ecf25aef8e

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 3ab804f7aa4511cd626c6660c4ce9bf82dbb3b5ab8d405ea8969937de64be9ee

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: c6d21c1122c008f0d36b1643fb4bcb56c7cf4f5272599a02f51379d0a0a4f074

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 4ff16e238c3290e1df596b71d5d97ba018fc7e35e3d45bb33b05d0229b25f63f

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 09cafb373931d94bd4016ccd620fae6b029c1e9a3cb434cb14b59076d2cb7007

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 44fc784e14108c85c5f00d5e36e9cdbb39d8fd51d436077f3c34defe9c1e3d01

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: d4bffdd06e33d94ed5910ecab64274c9a97318c3749dfa075f05310f24a8cf1a

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: cc9eed2d23b6325ded06b3159356b415340b94f5340af2f372bbbe6ca3434d7d

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 87b8977c43b57f6f938d1ead8b4ff7f295f1bf7cb6a9b77a83a6c03de66a8dfb

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: 72d854b086dcdde72f366c436ea13745e98885e7acc47cbb18958fde3dd1db2a

Update LSP schema and model

LSP Schema has changed. Please update the generator.
Schema: source
Model: source

Instructions:

  1. Setup a virtual environment and install nox.
  2. Install all requirements for generator.
  3. Run nox --session update_lsp.

Hashes:

  • schema: 6a3119d483b7dcfe2e6d42dd2af945de1b7871c7238d846a97f6566d9811ae9c
  • model: ed2e4b3a95c31c1e703ffdbcdbb5d09c782cd7b4ebc2b23aba71b14750733191

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.