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

Implement LSP code action for disabling rule in configuration #622

Open
anderseknert opened this issue Apr 4, 2024 · 4 comments
Open

Implement LSP code action for disabling rule in configuration #622

anderseknert opened this issue Apr 4, 2024 · 4 comments

Comments

@anderseknert
Copy link
Member

The language server should provide a code action to allow developers to disable a rule in .regal/config.yaml via the "Quick fix" menu provided where the error is reported.

If no .regal/config.yaml is found, we should create one.

Screenshot 2024-04-04 at 09 46 42
@anderseknert
Copy link
Member Author

I looked into this briefly last night, and the big challenge here is preserving user comments. These are quite common in .regal/config.yaml files, and they should be! That's a great way to document why some rule is disabled, or configured the way it is. Wiping these as part of a marshalling roundtrip would be terrible, so we'll need to make this a custom process... which makes it non-trivial.

@anderseknert
Copy link
Member Author

anderseknert commented Apr 11, 2024

Honestly, it's probably easier to just skip parsing altogether, just grep for <category>: and then insert text straight into the document. I mean, just look at this.

@charlieegan3
Copy link
Member

https://forum.golangbridge.org/t/modify-yaml-files-using-golang/31838/3 on the other hand looks more hopeful.

@anderseknert
Copy link
Member Author

Yeah, I looked at that but didn’t find a good example like that! It’s worth a shot, although it’s not 100% lossless AFAICS, but perhaps it’s fine to mess a little with whitespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: TODO
Development

No branches or pull requests

2 participants