-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,76 @@ | ||
# protols | ||
[](https://crates.io/crates/protols) | ||
# Protols - Protobuf Language Server | ||
|
||
[](https://crates.io/crates/protols) | ||
[](https://github.com/coder3101/protols/actions/workflows/ci.yml) | ||
|
||
A Language Server for **proto3** files. It uses tree-sitter parser for all operations. | ||
**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. | ||
|
||
 | ||
|
||
## Features | ||
- [x] Completion | ||
- [x] Diagnostics | ||
- [x] Formatting | ||
- [x] Document Symbols | ||
- [x] Go to definition | ||
- [x] Hover | ||
- [x] Rename | ||
## ✨ Features | ||
|
||
- ✅ Code Completion | ||
- ✅ Diagnostics | ||
- ✅ Document Symbols | ||
- ✅ Code Formatting | ||
- ✅ Go to Definition | ||
- ✅ Hover Information | ||
- ✅ Rename Symbols | ||
|
||
## 🚀 Getting Started | ||
|
||
## Installation | ||
### Installation | ||
|
||
### Neovim | ||
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) | ||
#### For Neovim | ||
|
||
To install Protols, run: | ||
|
||
```bash | ||
cargo install protols | ||
``` | ||
|
||
Then, configure it with [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#protols): | ||
|
||
```lua | ||
require'lspconfig'.protols.setup{} | ||
|
||
``` | ||
|
||
### Visual Studio Code | ||
#### For Visual Studio Code | ||
|
||
You can use the [Protobuf Language Support](https://marketplace.visualstudio.com/items?itemName=ianandhum.protobuf-support) extension, which leverages this LSP under the hood. | ||
|
||
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. | ||
> **Note:** This extension is [open source](https://github.com/ianandhum/vscode-protobuf-support) but is not maintained by us. | ||
> NOTE: It is [open-sourced](https://github.com/ianandhum/vscode-protobuf-support) but do not own or maintain it. | ||
## 🛠️ Usage | ||
|
||
### Code Completion | ||
|
||
## Usage | ||
Protols provides intelligent autocompletion for messages, enums, and proto3 keywords within the current package. | ||
|
||
#### Completion | ||
### Diagnostics | ||
|
||
Out of the box you will get auto Completion for Message, Enum of current package and Completion for keywords. | ||
Diagnostics are powered by the tree-sitter parser, which catches syntax errors but does not utilize `protoc` for more advanced error reporting. | ||
|
||
#### Diagnostics | ||
### Code Formatting | ||
|
||
Diagnostics is not reported by executing `protoc` so do not expect a full blown diagnostic result, we use tree-sitter parse for diagnostic which only displays parser errors. | ||
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. | ||
|
||
#### Formatting | ||
### Document Symbols | ||
|
||
Formatting is enabled only if [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) is found. You can control the [formatting style](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) by putting a `.clang-format` file at the root of the workspace. Both document and rage formatting is supported. | ||
Provides symbols for the entire document, including nested symbols, messages, and enums. | ||
|
||
#### Document Symbols | ||
### Go to Definition | ||
|
||
Symbols for the document (i.e Message and Enums) along with support for nested symbols is available. | ||
Jump to the definition of any custom symbol, even across package boundaries. | ||
|
||
#### Goto definition | ||
### Hover Information | ||
|
||
You can jump to definition of any custom symbols even across package boundaries. | ||
Displays comments and documentation for protobuf symbols on hover. Works seamlessly across package boundaries. | ||
|
||
#### Hover | ||
### Rename Symbols | ||
|
||
Protobuf is usually documented by putting comments above symbol definition and hover feature utilises this assumption to present Hover text for symbols. This also works across package boundaries. | ||
Allows renaming of symbols like messages and enums, along with all their usages across packages. Currently, renaming fields within symbols is not supported directly. | ||
|
||
#### Rename | ||
--- | ||
|
||
You can only document symbols such as Message and Enum names and all its usages will be renamed by the LSP, we do not support renaming field within a symbol however, you can jump to definition of field and rename the symbol. Renaming is also performed across pakages. | ||
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! 🎉 |