Skip to content

Commit

Permalink
Handle case when VirtualFile is null (#7156)
Browse files Browse the repository at this point in the history
Closes sourcegraph/jetbrains#3087

During creation of TextEditorHighlightingPass VirtualFile can return
null. This PR handles this situation.

## Test plan
N/A
<!-- Required. See
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles.
-->

---------

Co-authored-by: Tomasz Gołębiowski <[email protected]>
  • Loading branch information
tomaszgolebiowski and Tomasz Gołębiowski authored Feb 21, 2025
1 parent 3d681a3 commit 250db73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/scip-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
pushd jetbrains
scip-java index --build-tool=gradle
popd > /dev/null
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_SG_ACCESS_TOKEN }}

- name: Install src
run: yarn global add @sourcegraph/src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ class CodyFixHighlightPass(val file: PsiFile, val editor: Editor) :
class CodyFixHighlightPassFactory : TextEditorHighlightingPassFactoryRegistrar {
private val factory: TextEditorHighlightingPassFactory =
TextEditorHighlightingPassFactory { file, editor ->
when (file.virtualFile.fileSystem.protocol) {
"mock" -> null
else -> CodyFixHighlightPass(file, editor)
}
if (file.virtualFile == null) null
else
when (file.virtualFile.fileSystem.protocol) {
"mock" -> null
else -> CodyFixHighlightPass(file, editor)
}
}

override fun registerHighlightingPassFactory(
Expand Down

0 comments on commit 250db73

Please sign in to comment.