plexsystems / vscode-protolint

A protobuf linter for visual studio code
MIT License
52 stars 14 forks source link

Errors not appearing in problems window (extension not working) #19

Closed chrisdMSFT closed 3 years ago

chrisdMSFT commented 3 years ago

Testing with your examples and I get the error from protolint but no love with the extension.

image

PS G:\vscode-protolint\example> protolint version
protolint version 0.31.0(d193089)

Windows 10, vscode 1.56.2, extensions in screen shot.

I'm also not sure what extension for proto syntax highlighting extension you recommend and/or test with.

jpreese commented 3 years ago

@chrisdMSFT sorry for the delay, thanks for reporting this! I've personally been using vscode-proto3.

For the issue at hand, after some digging, it looks to be that the extension can't find the .protolint.yaml because it's inside of the examples folder, but the workspace is going to be vscode-protolint.

I've moved the .protolint.yaml file to the root of this repository, so if you get latest the examples should work now. Though it may be valuable to be a bit smarter on how to find the config.

I've also added some additional error checking so that when either protolint cannot be found, or a protolint configuration cannot be found, an error window will appear.

chrisdMSFT commented 3 years ago

Thanks. It's working now, however it's only showing the problems when I open and then save (Ctrl+S) the file, and only for that file. (Not sure if this is expected).

Repro (with pictures):

Open bar.proto and saved it. image

Open baz - Note the problem is still only for bar.

image

Ctrl+S (safe) on baz_with_whitespace.proto image

We now detect and highlight the issue but the previous issue is cleared.

jpreese commented 3 years ago

@chrisdMSFT I had noticed this as well as I was testing everything. I've added an event for opening protos as well which I'll include in the 0.6.0 release coming up here shortly

https://github.com/plexsystems/vscode-protolint/blob/master/src/extension.ts#L25

jpreese commented 3 years ago

v0.6.0 has been released which should make it a bit easier to diagnose errors and immediately lint when moving to a new file.

chrisdMSFT commented 3 years ago

@jpreese - I updated to 0.6.0 and now I'm not seeing any lint errors. (confirmed protolint is in path, and it has errors). Which output can I look at/copy to help debug?

chrisdMSFT commented 3 years ago

Oh I saw the popup telling me"

"protolint was not detected. Download from: https://github.com/yoheimuta/protolint"

But protolint.exe is on the path confirmed before I started vs code and in the terminal.

image

There is something strange with the path. protolint.exe is working but not protolint. I'm investigating.

jpreese commented 3 years ago

Sorry about the trouble, @chrisdMSFT. I have a Windows machine here that I can try the extension against. It may be related to this section here about ENV and Windows: https://nodejs.org/api/child_process.html#child_process_child_process

Any information you gather is greatly appreciated, and I'll do some investigation on my end as well.

jpreese commented 3 years ago

I just tried on my Windows machine and the extension is working on this end. I only have PATH set when using printenv (i.e. Path is unset).

Do you potentially have two versions of protolint installed? One on the path and one not? Maybe your PATH length has grown too big and is being truncated?

chrisdMSFT commented 3 years ago

Thanks, I'll play with path stuff and see if that PATH length is the issue. Will report back.

chrisdMSFT commented 3 years ago

Confirmed, I made a batch file that was adding a relative path to protolint... cause that's a good idea.

All is well. Also confirmed the problems do update on opening a file (yea!). They do NOT run for any already open files (when opening code, e.g. g:\contracts\> code . (where I already have foo.proto open). I just need to save it to kick it.. but figured I'd share.

tl;dr - It's working great now. Thanks!

jpreese commented 3 years ago

Awesome to hear! Glad it worked out