zxh0 / vscode-proto3

vscode extension for proto3
MIT License
322 stars 72 forks source link

Consider integration with Buf #138

Open tmc opened 2 years ago

tmc commented 2 years ago

Buf has emerged as a major player for improving protobuf development -- optionally leaning on it for things like formatting or linting could be quite helpful.

debkanchan commented 2 years ago

Not only that. All dependencies through buf show up as "x.proto not found" which is very annoying

TechyShishy commented 2 years ago

At the very least, there should be either documentation or configuration to search for proto files in buf's cache. I'm using the following stanza in my specific environment (Windows 11 Remote WSL Debian), and it seems to be working well, but YMMV:


    "protoc": {
        "options": [
            "--proto_path=${workspaceFolder}",
            "--proto_path=${userHome}/.cache/buf/v1/module/data/",
        ]
    }
debkanchan commented 2 years ago

Update: I've moved to trunk.io

pkwarren commented 1 year ago
            "--proto_path=${userHome}/.cache/buf/v1/module/data/",

FYI - we're in the progress of releasing support for a newer cache format which uses content addressable storage, so this workaround won't work for long. In general, the Buf CLI cache folder format is subject to change and should be considered an internal implementation detail.

rndmit commented 1 year ago

Found workaround. Run this to vendor deps into local dir (e.g. ~/.local/proto):

yq '.deps' buf.yaml | sed 's|^-*||' | xargs -I {} buf export {} --output $PROTO_VENDOR_DIR

And add to .vscode/settings.json:

"protoc": {
  "options": [
    "--proto_path=$PROTO_VENDOR_DIR"
  ]
}