protobuf-language-server
A language server implementation for Google Protocol Buffers
installation
Build binary
go clean -modcache
go install github.com/lasorda/protobuf-language-server@latest
Add it to your PATH
Configure vim/nvim
Using coc.nvim, add it to :CocConfig
"languageserver": {
"proto" :{
"command": "protobuf-language-server",
"filetypes": ["proto", "cpp"]
"settings": {
"additional-proto-dirs": [ ]
}
}
}
Using lsp-config.nvim
local configs = require('lspconfig.configs')
local util = require('lspconfig.util')
configs.protobuf_language_server = {
default_config = {
cmd = { 'path/to/protobuf-language-server' },
filetypes = { 'proto', 'cpp' },
root_dir = util.root_pattern('.git'),
single_file_support = true,
settings = {
["additional-proto-dirs"] = [
]
},
}
}
local lspconfig = require('lspconfig')
lspconfig.protobuf_language_server.setup {
}
if you use vscode, see vscode-extension/README.md
features
- Parsing document symbols
- Go to definition
- Symbol definition on hover
- Format file with clang-format
- Code completion
- Jump from protobuf's cpp header to proto define (only global message and enum)