Skip to content

Commit fba42fe

Browse files
authored
feat: add workspace support (#20)
- [x] Hover - [x] Prepare rename - [x] Completion of enums and messages in current package - [ ] ~Rename~ (Deferred to future) - [x] Definition - [ ] ~Workspace Symbols~ (No use as of now) Handle extra operations to update inner state: - [x] did_create_file - [x] did_delete_file - [x] did_rename_file
1 parent c60f8c1 commit fba42fe

File tree

59 files changed

+1434
-805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1434
-805
lines changed

Cargo.lock

Lines changed: 45 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "protols"
33
description = "Language server for proto3 files"
4-
version = "0.3.0"
4+
version = "0.4.0"
55
edition = "2021"
66
license = "MIT"
77
homepage = "https://github.com/coder3101/protols"
@@ -23,3 +23,6 @@ tree-sitter = "0.22.6"
2323
tracing-appender = "0.2.3"
2424
protols-tree-sitter-proto = "0.2.0"
2525
walkdir = "2.5.0"
26+
27+
[dev-dependencies]
28+
insta = { version = "1.39.0", features = ["yaml"] }

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# protols
2-
A Language Server for **proto3** files. It uses tree-sitter parser for all operations and always runs in **single file mode**.
2+
[![Crates](https://img.shields.io/crates/v/protols.svg)](https://crates.io/crates/protols)
3+
[![Build and Test](https://github.com/coder3101/protols/actions/workflows/ci.yml/badge.svg)](https://github.com/coder3101/protols/actions/workflows/ci.yml)
4+
5+
A Language Server for **proto3** files. It uses tree-sitter parser for all operations.
36

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

69
## Features
7-
- [x] Hover
8-
- [x] Go to definition
9-
- [x] Diagnostics
10+
- [x] Completion (keywords, enums and messages of the package)
11+
- [x] Diagnostics - based on sytax errors
1012
- [x] Document Symbols for message and enums
11-
- [x] Rename message, enum and rpc
12-
- [x] Completion for proto3 keywords
13+
- [x] Go to definition - across packages
14+
- [x] Hover - across packages
15+
- [x] Rename - in current buffer only
1316

1417
## Installation
1518

16-
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.
19+
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)
1720

1821
```lua
1922
require'lspconfig'.protols.setup{}

sample/simple.proto

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ message Book {
77
// Of a message called Book
88
int64 isbn = 1;
99
string title = 2;
10-
string author = 3;
10+
Author author = 3;
11+
google.protobuf.Any data = 4;
12+
BookState state = 5;
13+
14+
// Author is a author of a book
15+
message Author {
16+
string name = 1;
17+
int64 age = 2;
18+
}
19+
20+
enum BookState {
21+
HARD_COVER = 1;
22+
SOFT_COVER = 2;
23+
}
1124
}
1225

1326
// This is a comment on message
@@ -22,7 +35,7 @@ message GotoBookRequest {
2235
}
2336

2437
message GetBookViaAuthor {
25-
string author = 1;
38+
Book.Author author = 1;
2639
}
2740

2841

@@ -31,6 +44,7 @@ service BookService {
3144
// This is GetBook RPC that takes a book request
3245
// and returns a Book, simple and sweet
3346
rpc GetBook (GetBookRequest) returns (Book) {}
47+
rpc GetBookAuthor (GetBookRequest) returns (Book.Author) {}
3448
rpc GetBooksViaAuthor (GetBookViaAuthor) returns (stream Book) {}
3549
rpc GetGreatestBook (stream GetBookRequest) returns (Book) {}
3650
rpc GetBooks (stream GetBookRequest) returns (stream Book) {}

0 commit comments

Comments
 (0)