Skip to content

fix: allow navigation to ranges in files which are not IDE documents [IDE-1781]#793

Merged
andrewrobinsonhodges-snyk merged 3 commits intomasterfrom
fix/IDE-1781_fix-file-navigation
Feb 27, 2026
Merged

fix: allow navigation to ranges in files which are not IDE documents [IDE-1781]#793
andrewrobinsonhodges-snyk merged 3 commits intomasterfrom
fix/IDE-1781_fix-file-navigation

Conversation

@andrewrobinsonhodges-snyk
Copy link
Contributor

Description

The navigateToSource function used when a user clicks on an issue in the tree view previously validated the range by comparing to the length of the target file as an IDE document.

This mean that we were silently failing to navigate to files that the IDE could not process as a document (e.g., .gitleaksignore). The fix is to log the discrepancy and let the PsiNavigationSupport library handle it. The file will now open, even if the correct range cannot be determined.

Note that we expect that the ranges returned by the Secrets scanner should always be correct, so this was an overly defensive practice.

Checklist

Screenshots / GIFs

Visuals that may help the reviewer. Please add screenshots for any UI change. GIFs are most welcome!

@andrewrobinsonhodges-snyk andrewrobinsonhodges-snyk changed the title fix: allow navigation to ranges in files which are not IDE documents fix: allow navigation to ranges in files which are not IDE documents [IDE-1781] Feb 27, 2026
@snyk-io
Copy link

snyk-io bot commented Feb 27, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

Code Coverage

File Coverage [56.80%]
src/main/kotlin/io/snyk/plugin/Utils.kt 56.80%
Total Project Coverage 46.79%

Copy link
Contributor

@rrama rrama left a comment

Choose a reason for hiding this comment

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

LGTM.

every { appMock.invokeLater(any<Runnable>()) } answers { firstArg<Runnable>().run() }
every {
appMock.invokeLater(any<Runnable>(), any<com.intellij.openapi.application.ModalityState>())
} answers { firstArg<Runnable>().run() }
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to pull this out as a common test util.

@andrewrobinsonhodges-snyk andrewrobinsonhodges-snyk merged commit 4d57c71 into master Feb 27, 2026
15 of 16 checks passed
@andrewrobinsonhodges-snyk andrewrobinsonhodges-snyk deleted the fix/IDE-1781_fix-file-navigation branch February 27, 2026 16:37
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