A language server implementation for Google Protocol Buffers
Build binary
go build -o pls .
Add it to your PATH
Configure vim/nvim
Using coc.nvim, add it to :CocConfig
"languageserver": {
"proto" :{
"command": "pls",
"filetypes": ["proto", "cpp"]
}
}
Using lsp-config.nvim
-- first we need to configure our custom server
local configs = require('lspconfig.configs')
local util = require('lspconfig.util')
configs.pls = {
default_config = {
cmd = { 'path/to/pls' },
filetypes = { 'proto', 'cpp' },
root_fir = util.root_pattern('.git'),
single_file_support = true,
settings = {},
}
}
-- then we can continue as we do with official servers
local lspconfig = require('lspconfig')
lspconfig.pls.setup {}
if you use vscode, see vscode-extension/README.md
- Parsing document symbols
- Go to definition
- Format file with clang-format
- Code completion
- Jump from protobuf's cpp header to proto define (only global message and enum)