Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: protolint API for granular fixes in VS Code extension #331

Open
AlexCannonball opened this issue May 2, 2023 · 1 comment
Open
Labels
question Further information is requested

Comments

@AlexCannonball
Copy link

AlexCannonball commented May 2, 2023

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:

  1. Run protolint with -reporter json flags (as I haven't found rule field in plain or unix report formats).
  2. 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>.+)"$/
  1. Extract granular error ranges and fixes (if available) via these patterns and protolint JSON report. Hopefully, if a rule is fixable, its linter message always contains the fix information.

Thank you!

@yoheimuta
Copy link
Owner

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.

@yoheimuta yoheimuta added the question Further information is requested label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants