Skip to content

fix / place inline suppression where it will actually work for multi-location warnings - #109

Merged
davidramnero merged 2 commits into
mainfrom
fix/place-inline-suppression-where-it-will-actually-work-for-multi-location-warnings
Aug 28, 2026
Merged

fix / place inline suppression where it will actually work for multi-location warnings#109
davidramnero merged 2 commits into
mainfrom
fix/place-inline-suppression-where-it-will-actually-work-for-multi-location-warnings

Conversation

@davidramnero

Copy link
Copy Markdown
Collaborator

Note: the code actions still appear on what the extension considers the main location (i.e. last location in the warnings locations array), but the suppression comment will appear above the first location from the warnings locations array (see pictures).
Screenshot 2026-08-27 at 22 32 05
Screenshot 2026-08-27 at 22 32 25

Comment thread src/util/codeActions.ts
// Copy indentation from line affected by diagnostic
const indent = lineText.match(/^\s*/)?.[0] ?? "";

var affectedLine = diagnostic.range.start.line;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we check somewhere that the first location is in the same file? the locations for a warning can point at different files.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

very good point! Fixed

@davidramnero
davidramnero requested a review from danmar August 28, 2026 06:31
@davidramnero
davidramnero merged commit c9edaf3 into main Aug 28, 2026
7 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.

2 participants