FSharpLint icon indicating copy to clipboard operation
FSharpLint copied to clipboard

SuggestedFix structure

Open MecuSorin opened this issue 4 years ago • 3 comments

Description

I wanted to add a quick fix suggestion for linter warnings like RecordFieldNames (to add to the beginning of the file a //fsharplint:disable RecordFieldNames).

I was looking at the FSharpLint.Framework.Suggestion.SuggestedFix record and didn't understood how I suppose to do that(what I described above), maybe are some conventions in place, but are undocumented.

Can somebody guide me through the process? I need some tips.

MecuSorin avatar Jun 21 '20 10:06 MecuSorin

Hello,

This is interesting, the use case of the suggested fix is to provide a fix to the code so that it follows the rule, rather than to suppress the rule, so I don't think this quite fits. However I do think it would be a good feature to have, a method IDEs can use to let the user easily suppress a rule without having to look at our docs.

I think you'd need a new attribute to handle this rather than attempting to use SuggestedFix. Although I would be tempted to have a separate function which takes the error, rather than an attribute on the error itself. Would you still be interested in attempting this? I'd be happy to help, if not we can turn this into a feature request

duckmatt avatar Jun 26 '20 17:06 duckmatt

Need to look more at the code then, to understand your suggestion about the attribute. Was thinking that add opens or remove unused opens are doing something similar to what I want. Need to find that portion of the code

MecuSorin avatar Jun 28 '20 19:06 MecuSorin

Please turn it in a feature request. Didn't found what I was imagined that should be there and don't have enough time to invest in this.

MecuSorin avatar Jul 05 '20 19:07 MecuSorin