Open scbizu opened 3 years ago
Hi @scbizu, this is indeed a bug, I've reproduced it and I have a fix ready, it'll be available with v0.0.3.
Hello
The issue seems to have reappeared, I have it too:
buf lint
works.
Strange, I can see the command in my editor, and the "Feature Contributions" page lists the command too:
Do you see the same thing in your editor?
Ok, got it to work.
For some reason if I just open the proto file from VSCode and lint it doesn't work. I have to open the containing folder to get linting.
Hm, it may have something to do with the activation rules: https://github.com/bufbuild/vscode-buf/blob/fa44b78bbb3322aec5f7c0bfef15e06fe573f6ae/package.json#L36-L39. It's unclear to me whether that would match a *.proto
file on its own.
It's the activation rules that gave me the hint indeed, but it was a guess, no idea if it's really the cause.
Thanks for the update, I've reopened and renamed the issue. I don't have time to fix this anytime soon but I'd be happy to review a fix.
Ok, thanks, at least there is an easy fix.
I had a quick look at the available events and I'm not convinced it's so easy: https://code.visualstudio.com/api/references/activation-events. I can't see an event for "file name" or similar, it looks to me like we'd have to use *
which is a bit frowned upon.
Sorry I meant by "easy fix" that I just had to open the containing folder. I was unclear 😅.
We have a couple of options on how we can handle this:
onStartupFinished
flag under activation events (which is recommended over *
). This will give the user of the extension access to the buf.lint
command regardless of the contents of the vscode workspace, and will load after start-up (as opposed to during start-up, such as *
). The benefits of having buf.lint
command available and the extension loaded in any workspace is that users can also define custom tasks, etc. using the command. The downside, is of course, that the extension will be loaded even when it may not be strictly necessary. That being said, this is a pretty common pattern and is used in vscode-eslint
, for example: https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/package.json#L27-L29
I already installed buf but when I lints my proto file It says
Anything I miss ?