https://github.com/nobodywasishere/lsprotocol-crystal
Code generator and generated types for Language Server Protocol & Crystal lang
https://github.com/nobodywasishere/lsprotocol-crystal
crystal-lang lsp
Last synced: 2 months ago
JSON representation
Code generator and generated types for Language Server Protocol & Crystal lang
- Host: GitHub
- URL: https://github.com/nobodywasishere/lsprotocol-crystal
- Owner: nobodywasishere
- License: mit
- Created: 2024-07-23T22:20:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-05T13:57:35.000Z (7 months ago)
- Last Synced: 2025-04-12T07:52:47.814Z (2 months ago)
- Topics: crystal-lang, lsp
- Language: Crystal
- Homepage:
- Size: 148 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Language Server Protocol Types implementation for Crystal
`lsprotocol` is a Crystal implementation of object types used in the Language Server Protocol (LSP). This repository contains the code generator and the generated types for LSP.
Generated using [lsprotocol](https://github.com/microsoft/lsprotocol).## Overview
LSP is used by editors to communicate with various tools to enables services like code completion, documentation on hover, formatting, code analysis, etc. The intent of this library is to allow you to build on top of the types used by LSP. This repository will be kept up to date with the latest version of LSP as it is updated.
## Installation
```yaml
dependencies:
lsprotocol:
github: nobodywasishere/lsprotocol-crystal
```## Usage
### Using LSP types
```crystal
require "lsprotocol"position = LSP::Position.new(line: 10, character: 3)
```### Generating LSP types
1. Create a python virtual environment: `python -m venv .venv` (use latest python)
2. Activate the environment:
* Windows: `.venv\Script\activate`
* Linux\mac: `source .venv/bin/activate`
3. Install the generator: `python -m pip install git+https://github.com/microsoft/lsprotocol` or `make install_deps`
4. Run generator with crystal plugin: `python -m generator --plugin crystalgen --output-dir . --test-dir ./tests` or `make generate_code`
5. Generate test data: `python -m generator --plugin testdata --output-dir ./data` or `make generate_testdata`
6. Run tests: `crystal spec`