-
Notifications
You must be signed in to change notification settings - Fork 156
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
Adds exclusion config for analyzers #1120
Adds exclusion config for analyzers #1120
Conversation
use progress = new ServerProgressReport(lspClient) | ||
do! progress.Begin("Checking unused opens...", message = filePathUntag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds ProgressReport for users to help identify files which might benefit from disabling.
let analyzers = | ||
[ | ||
// if config.Linter then | ||
// commands.Lint filePath |> Async .Ignore | ||
if config.UnusedOpensAnalyzer then | ||
if config.UnusedOpensAnalyzer && isNotExcluded config.UnusedOpensAnalyzerExclusions then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclusion check
@@ -759,8 +777,11 @@ type FSharpConfig = | |||
InterfaceStubGenerationMethodBody: string | |||
AddPrivateAccessModifier: bool | |||
UnusedOpensAnalyzer: bool | |||
UnusedOpensAnalyzerExclusions: Regex array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we already have FSharp.unusedOpensAnalyzer
it would be a breaking change to make it a nested object and all client configs would need to update for this. Could be renamed to whatever makes more sense though.
@@ -738,6 +743,19 @@ type DebugConfig = | |||
LogDurationBetweenCheckFiles = false | |||
LogCheckFileDuration = false } | |||
|
|||
let logger = lazy (LogProvider.getLoggerByName "LspHelpers") | |||
|
|||
let tryCreateRegex (pattern: string) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safe creation of these Regex since the config could be bad regex.
ecc4c5a
to
713c028
Compare
713c028
to
4469871
Compare
This makes sense to me - but it makes me wonder if we need a more general config for each analyzer: "FSharp.analyzers.simplifyNames.enabled": true,
"FSharp.analyzers.simplifyNames.ignorePatterns": ["*.g.fs", ... ] Which you brought up, and would be a large change, but I just wanted to signal that I agree with that thought overall and think we should go that direction eventually. |
I'm bad at JsonConverters, just gonna go with this. |
WHAT
🤖 Generated by Copilot at ecc4c5a
This pull request enhances the configuration and progress reporting of the built-in analyzers in the
FsAutoComplete
project. It allows users to exclude files from analyzers based on regex patterns in theFSharpConfig
settings, and adds progress indicators to the analyzer runs. It also improves some code quality and performance aspects in theAdaptiveFSharpLspServer
type.🤖 Generated by Copilot at ecc4c5a
🛠️🚫📊
WHY
Closes #1118
HOW
🤖 Generated by Copilot at ecc4c5a
ServerProgressReport
objects to report the progress of the analyzers to the LSP client (link, link, link)builtInCompilerAnalyzers
function (link)builtInCompilerAnalyzers
function (link)System.Text.RegularExpressions
andFsAutoComplete.Logging
namespaces inLspHelpers.fs
andAdaptiveFSharpLspServer.fs
(link, link)tryCreateRegex
to handle the possible failures of creatingRegex
objects from strings inClassificationUtils.fs
(link)