plexsystems / vscode-protolint

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

Extension not working #12

Closed jd1378 closed 3 years ago

jd1378 commented 3 years ago

I'm on Windows 10 Pro 1909, using vscode 1.48.0-insider, tested also on 1.47.1 and still doesn't work. protolint is in the path, I can run it in terminal and get resultss I have no .protolint.yaml file, so I assume it should use the defaults even with having one at the root of project, it doesn't work I usually open my projects using "open folder" option of vscode, if that is of any importance using a workspace didn't help either

jd1378 commented 3 years ago

I did some debugging, it seems it's failing to get the errorLine from the following string: [d:\Projects\Private\go\playground\greet\greetpb\greet.proto:57:1] The line length is 88, but it must be shorter than 80 inside protoError.ts at line 11, so it returns NaN. I'm not sure if this is intended behavior, Can you check it out ?

jd1378 commented 3 years ago

hmm, actually I think it makes sense if it's only broken on windows, since in Unix we should not have the first :, so it would get the line number properly, but in windows that extra : breaks it.

jd1378 commented 3 years ago

I propose changing parseInt(error.split(":")[1], 10) to parseInt(error.split(".proto:")[1], 10), It would work on any OS, but would then break if the file extension is something else, but that's unlikely imo (because the docs only talks about .proto files)

Edit: I have tested the fix on windows only and it works

jpreese commented 3 years ago

@jd1378 thanks for reporting this. This is incredibly helpful. I'm looking into your proposed fix now.

jpreese commented 3 years ago

@jd1378 v0.4.0 with this change has been released and published to the Marketplace.

jd1378 commented 3 years ago

Thanks @jpreese , I can confirm it's fixed now.