ionide / ionide/FSharp.Analyzers.SDK
Feature: Passing options through the context to named analyzers
- Dominant language
- F#
- Stars
- 85
- Forks
- 28
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 20
Description
**Is your feature request related to a problem? Please describe.**
The end user does not have any way to control the behavior the used analyzer within a project. Just like with code linters, it would great if the user could provide options for the analyzers on a per-project basis. One use-case would be to control the strictness of an analyzer and changing the severity of certain errors from compile errors into warning.
**Describe the solution you'd like**
For this to work, the SDK must have a way to *identify* the used analyzers. One way to do that is by giving analyzers an optional name from the `Analyzer` attribute:
```fsharp
[]
```
Then with the help of ionide, the SDK would pick up a configuration file called `fsharp-analyzers.json` that has the following structure:
```json
{
"MyAnalyzerName": {
"Mode": "Strict",
"ErrorsAsWarnings": "true"
},
"OtherAnalyzer": {
"ErrorsAsWarnings": "true"
}
}
```
The SDK can then read this JSON file and parse the options as `Map` per analyzer where this `Map` would be available through the context input of the analyzer. For example, for the "MyAnalyzerName", the options would be
```fsharp
Map.ofList [ "Mode", "Strict"; "ErrorsAsWarnings", "true" ]
```
**Describe alternatives you've considered**
N/A
**Additional context**
N/A
Contributor guide
Assessment
This issue has not been assessed yet.