Skip to content

Commit c36b05b

Browse files
authored
feat: add doc and range formatting if clang-format is available (#27)
- [x] Update README - [x] Tag and release v0.6.0 - [x] Format temporary file not original file
1 parent 993120b commit c36b05b

24 files changed

+536
-91
lines changed

.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BasedOnStyle: Google
2+
DerivePointerAlignment: false
3+
PointerAlignment: Left

Cargo.lock

Lines changed: 90 additions & 11 deletions
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.5.0"
4+
version = "0.6.0"
55
edition = "2021"
66
license = "MIT"
77
homepage = "https://github.com/coder3101/protols"
@@ -23,6 +23,9 @@ 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+
hard-xml = "1.36.0"
27+
tempfile = "3.12.0"
28+
serde = { version = "1.0.209", features = ["derive"] }
2629

2730
[dev-dependencies]
2831
insta = { version = "1.39.0", features = ["yaml"] }

README.md

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,76 @@
1-
# protols
2-
[![Crates](https://img.shields.io/crates/v/protols.svg)](https://crates.io/crates/protols)
1+
# Protols - Protobuf Language Server
2+
3+
[![Crates.io](https://img.shields.io/crates/v/protols.svg)](https://crates.io/crates/protols)
34
[![Build and Test](https://github.com/coder3101/protols/actions/workflows/ci.yml/badge.svg)](https://github.com/coder3101/protols/actions/workflows/ci.yml)
45

5-
A Language Server for **proto3** files. It uses tree-sitter parser for all operations.
6+
**Protols** is an open-source Language Server Protocol (LSP) for **proto3** files, powered by the robust and efficient [tree-sitter](https://tree-sitter.github.io/tree-sitter/) parser. With Protols, you get powerful code assistance for protobuf files, including auto-completion, syntax diagnostics, and more.
67

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

9-
## Features
10-
- [x] Completion (keywords, enums and messages of the package)
11-
- [x] Diagnostics - based on sytax errors
12-
- [x] Document Symbols
13-
- [x] Go to definition
14-
- [x] Hover
15-
- [x] Rename
10+
## ✨ Features
11+
12+
- ✅ Code Completion
13+
- ✅ Diagnostics
14+
- ✅ Document Symbols
15+
- ✅ Code Formatting
16+
- ✅ Go to Definition
17+
- ✅ Hover Information
18+
- ✅ Rename Symbols
19+
20+
## 🚀 Getting Started
21+
22+
### Installation
1623

17-
## Installation
24+
#### For Neovim
25+
26+
To install Protols, run:
27+
28+
```bash
29+
cargo install protols
30+
```
1831

19-
### Neovim
20-
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)
32+
Then, configure it with [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#protols):
2133

2234
```lua
2335
require'lspconfig'.protols.setup{}
24-
2536
```
2637

27-
### Visual Studio Code
38+
#### For Visual Studio Code
39+
40+
You can use the [Protobuf Language Support](https://marketplace.visualstudio.com/items?itemName=ianandhum.protobuf-support) extension, which leverages this LSP under the hood.
41+
42+
> **Note:** This extension is [open source](https://github.com/ianandhum/vscode-protobuf-support) but is not maintained by us.
43+
44+
## 🛠️ Usage
45+
46+
### Code Completion
47+
48+
Protols provides intelligent autocompletion for messages, enums, and proto3 keywords within the current package.
49+
50+
### Diagnostics
51+
52+
Diagnostics are powered by the tree-sitter parser, which catches syntax errors but does not utilize `protoc` for more advanced error reporting.
53+
54+
### Code Formatting
55+
56+
Formatting is enabled if [clang-format](https://clang.llvm.org/docs/ClangFormat.html) is available. You can control the [formatting style](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) by placing a `.clang-format` file in the root of your workspace. Both document and range formatting are supported.
57+
58+
### Document Symbols
59+
60+
Provides symbols for the entire document, including nested symbols, messages, and enums.
61+
62+
### Go to Definition
63+
64+
Jump to the definition of any custom symbol, even across package boundaries.
65+
66+
### Hover Information
67+
68+
Displays comments and documentation for protobuf symbols on hover. Works seamlessly across package boundaries.
69+
70+
### Rename Symbols
71+
72+
Allows renaming of symbols like messages and enums, along with all their usages across packages. Currently, renaming fields within symbols is not supported directly.
2873

29-
You can install an extension called [Protobuf Language Support](https://marketplace.visualstudio.com/items?itemName=ianandhum.protobuf-support) which uses this LSP under the hood.
74+
---
3075

31-
> NOTE: It is [open-sourced](https://github.com/ianandhum/vscode-protobuf-support) but do not own or maintain it.
76+
Protols is designed to supercharge your workflow with **proto3** files. We welcome contributions and feedback from the community! Feel free to check out the [repository](https://github.com/coder3101/protols) and join in on improving this tool! 🎉

0 commit comments

Comments
 (0)