-
Notifications
You must be signed in to change notification settings - Fork 358
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
Handle case when VirtualFile is null #7156
Handle case when VirtualFile is null #7156
Conversation
@@ -45,6 +45,8 @@ jobs: | |||
pushd jetbrains | |||
scip-java index --build-tool=gradle | |||
popd > /dev/null | |||
env: |
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.
is it needed?
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.
This is fixing SCIP failing on search build.
That said, it is failing later anyway on:
e: There are some plugins incompatible with language version 2.0:
> Task :compileKotlin FAILED
com.sourcegraph.semanticdb_kotlinc.AnalyzerRegistrar
Please use language version 1.9 or below
@dominiccooney should we somehow push to fix it?
If not or it won't be easy, should we just disable it for jetbrains to not waste time on failing compilation?
TBH. I'm not sure what is policy on the SCIP and what it exectly gives us (considering it is failing for a long time already and no one complains...)
} | ||
if (file.virtualFile == null) null | ||
else | ||
when (file.virtualFile.fileSystem.protocol) { |
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.
If you want to get a non-null virtual file consider using FileViewProvider#getVirtualFile()
Interesting... 🤔
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.
https://plugins.jetbrains.com/docs/intellij/psi-files.html
btw, here are some docs on PSI Files if you are interested
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.
https://plugins.jetbrains.com/docs/intellij/virtual-file.html#how-do-i-get-a-virtual-file
may return null if the PSI file exists only in memory
The exceptions we get show that we must assume that sometimes there will be a null returned.
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.
LGTM
Closes sourcegraph/jetbrains#3087
During creation of TextEditorHighlightingPass VirtualFile can return null. This PR handles this situation.
Test plan
N/A