Skip to content

Conversation

@1eyewonder
Copy link
Contributor

@1eyewonder 1eyewonder commented Oct 11, 2025

Summary

Closes #47

This pull request introduces support for analyzer ignore comments in the SDK, allowing users to specify ranges in source files where certain analyzer codes should be ignored. The implementation parses various ignore comment formats (single line, file-wide, and range-based, including nested and multiple codes), and exposes the resulting ignore ranges in both CLI and editor contexts for analyzers to consume.

With this feature set, creators of analyzers will not need to create custom ignore logic but rather just rely on the SDK to do this for them

Ignore Pattern

We are following a prefix: command [codes] pattern when doing ignores.

Prefix: fsharpanalyzers

Commands:

  • ignore-line-next
    • ignores analyzer hits which start on the next line
  • ignore-line
    • ignores analyzer hits which start on the current line
  • ignore-file
    • ignores analyzer hits for the entire file
  • ignore-region-start & ignore-region-end
    • ignores analyzer hits between the given range. We support nested and overlapping ranges

Additional Context

This work came about from playing around with the idea here. Initially it started with just single line comments but I ended up expanding the functionality when bringing it over to the SDK to provide more options for the analyzer ecosystem.

Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Can't wait to use this. I think the two remaining things to do is document:

  1. Page for analyzer users showing different ways to use this feature
  2. Page for analyzer authors showing how they can use AnalyzerIgnoreRanges to optimize their analyzers.

Co-authored-by: Jimmy Byrd <jimmybyrd@gmail.com>
Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send-to-the-internet

@TheAngryByrd TheAngryByrd merged commit 005cbb4 into ionide:main Oct 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow disabling analyzers for line/file/etc.

3 participants