Skip to content

feat: add workspace support #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "protols"
description = "Language server for proto3 files"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
license = "MIT"
homepage = "https://github.com/coder3101/protols"
Expand All @@ -23,3 +23,6 @@ tree-sitter = "0.22.6"
tracing-appender = "0.2.3"
protols-tree-sitter-proto = "0.2.0"
walkdir = "2.5.0"

[dev-dependencies]
insta = { version = "1.39.0", features = ["yaml"] }
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# protols
A Language Server for **proto3** files. It uses tree-sitter parser for all operations and always runs in **single file mode**.
[![Crates](https://img.shields.io/crates/v/protols.svg)](https://crates.io/crates/protols)
[![Build and Test](https://github.com/coder3101/protols/actions/workflows/ci.yml/badge.svg)](https://github.com/coder3101/protols/actions/workflows/ci.yml)

A Language Server for **proto3** files. It uses tree-sitter parser for all operations.

![](./assets/protols.mov)

## Features
- [x] Hover
- [x] Go to definition
- [x] Diagnostics
- [x] Completion (keywords, enums and messages of the package)
- [x] Diagnostics - based on sytax errors
- [x] Document Symbols for message and enums
- [x] Rename message, enum and rpc
- [x] Completion for proto3 keywords
- [x] Go to definition - across packages
- [x] Hover - across packages
- [x] Rename - in current buffer only

## Installation

Run `cargo install protols` to install and add below to setup using [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#protols) until we start shipping this via Mason.
Run `cargo install protols` to install and add below to setup using [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#protols)

```lua
require'lspconfig'.protols.setup{}
Expand Down
18 changes: 16 additions & 2 deletions sample/simple.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ message Book {
// Of a message called Book
int64 isbn = 1;
string title = 2;
string author = 3;
Author author = 3;
google.protobuf.Any data = 4;
BookState state = 5;

// Author is a author of a book
message Author {
string name = 1;
int64 age = 2;
}

enum BookState {
HARD_COVER = 1;
SOFT_COVER = 2;
}
}

// This is a comment on message
Expand All @@ -22,7 +35,7 @@ message GotoBookRequest {
}

message GetBookViaAuthor {
string author = 1;
Book.Author author = 1;
}


Expand All @@ -31,6 +44,7 @@ service BookService {
// This is GetBook RPC that takes a book request
// and returns a Book, simple and sweet
rpc GetBook (GetBookRequest) returns (Book) {}
rpc GetBookAuthor (GetBookRequest) returns (Book.Author) {}
rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}
rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}
rpc GetBooks (stream GetBookRequest) returns (stream Book) {}
Expand Down
Loading