protobuf-language-server

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

README

protobuf-language-server

A language server implementation for Google Protocol Buffers

installation

Build binary

go clean -modcache
# insatll to `go env GOPATH`
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

-- first we need to configure our custom server
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"] = [
                -- path to additional protobuf directories
                -- "vendor",
                -- "third_party",
            ]
        },
    }
}

-- then we can continue as we do with official servers
local lspconfig = require('lspconfig')
lspconfig.protobuf_language_server.setup {
    -- your custom stuff
}

if you use vscode, see vscode-extension/README.md

features

  1. Parsing document symbols
  2. Go to definition
  3. Symbol definition on hover
  4. Format file with clang-format
  5. Code completion
  6. Jump from protobuf's cpp header to proto define (only global message and enum)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
go-lsp
example command
lsp
code gen by methods_gen_test.go, do not edit!
code gen by methods_gen_test.go, do not edit!
proto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL