protolint
protolint copied to clipboard
Question: protolint API for granular fixes in VS Code extension
Hello, I'd like to implement granular error fixes for VS Code. At the moment the extension just highlights the whole code line with error(s).
Could you validate my implementation plan? The main priorities are being future-proof and easy to maintain.
-fix flag applies all fixes at once, so it doesn't seem to be the best solution for displaying granular errors and fixes in IDE.
The plan:
- Run protolint with
-reporter jsonflags (as I haven't foundrulefield in plain or unix report formats). - Make a regex pattern for every rule, e.g. for
FIELD_NAMES_LOWER_SNAKE_CASE:
pattern: /^Field name "(?<wrong>.+)" must be underscore_separated_names like "(?<fix>.+)"$/
- Extract granular error ranges and fixes (if available) via these patterns and protolint JSON report. Hopefully, if a
ruleis fixable, its lintermessagealways contains the fix information.
Thank you!
Hi @AlexCannonball
Thank you for your interest in the protolint ecosystem!
I was wondering if there is a demand for granular fixes in general and whether it is worth the extra effort to make the protolint error literal an API.
In my opinion, fixing the current file at once, as ale fixer does, is sufficient.
I have already heard that even this simpler and quicker first step has value, as seen in this issue: plexsystems/vscode-protolint#8.