protols

module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0

README

Protobuf Language Server

Release CI License

A language server implementation for Protocol Buffers. Under active development; some features are still a work in progress.

LSP features:

  • Document Formatting
  • Full semantic token support
    • (partial) Embedded CEL expression semantic tokens
  • Document and workspace diagnostics
  • Import links
  • Find references/definition
    • Types and enums
    • Imports
    • Options, extensions, and field references
    • Inlay Hints
    • Package names and prefixes
  • Hover
    • Types and enums
    • Options, extensions, and field references
    • Inlay Hints
    • Package names and prefixes
    • CEL tokens
  • Code Actions & Refactors
    • Identify and remove unused imports
    • Add missing import for unresolved symbol
    • Auto-fix imports on save
    • Simplify repeated option declarations
    • Simplify repeated message literal fields
    • Simplify map literal fields
    • Extract fields to new message
    • Inline fields from message
    • Renumber message fields
  • Code Lens
    • Generate file/package/workspace
  • Inlay hints
    • Extension types
    • Resolved import paths
  • Rename symbols
  • Multi-workspace support
  • Document symbols
  • Workspace symbol query with fuzzy matching
  • Completion:
    • Message and enum types
    • Extendee types
    • Context-sensitive keywords
    • Import paths
    • Package names
    • Message and field literals
    • Field literal values
  • Import resolution
    • Local/relative paths
    • Go module path lookup with inline sources
    • Go module path lookup with missing proto sources synthesized from generated code
    • Context-sensitive imports and pattern detection
    • Import path lookup from existing generated Go code
    • Fully interactive sources generated from well-known (or any other) descriptors
  • Legacy compatibility
    • gogoproto sources (k8s, etc.)
    • proto2 sources
  • Future compatibility
    • Editions
  • Code generator tools
    • Built-in compiler with workspace context
    • CLI support
      • 'protols fmt'
      • 'protols vet'
      • 'protols rename'
      • ...
    • Interact with generated code
      • Go to Generated Definition
      • Find references
      • Call hierarchy
      • Cross-language rename
  • Debugging tools
    • AST viewer
    • Wire message decoder ('protols decode')
    • ...
  • Editor support
    • VSCode
    • Neovim

Installing

  1. Clone this repo
  2. Build and install the protols binary: go install ./cmd/protols
  3. Install vsce if you don't have it: npm install --global @vscode/vsce
  4. cd to editors/vscode, then run vsce package
  5. Install the vsix plugin: code --install-extension ./protols-vscode-<version>.vsix

Special Thanks

This project is derived from bufbuild/protocompile and jhump/protoreflect. Thanks to the buf developers for their fantastic work.

Several packages in https://github.com/golang/tools are used to build the language server. A minimal subset of its lsp-related packages are maintained as a library at https://github.com/kralicky/tools-lite.

Directories

Path Synopsis
cmd
pkg
lsp
x/protogen/genid
contains select definitions from protobuf/internal/genid.
contains select definitions from protobuf/internal/genid.
x/protogen/strs
contains select definitions from protobuf/internal/strs.
contains select definitions from protobuf/internal/strs.
x/symbols
contains modified code from gopls/internal/golang/workspace_symbol.go.
contains modified code from gopls/internal/golang/workspace_symbol.go.
sdk
marker/expect
Translation of go/expect/extract.go for protobuf sources
Translation of go/expect/extract.go for protobuf sources

Jump to

Keyboard shortcuts

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