Skip to content

Commit

Permalink
Disable highlight pass on mock files (#1998)
Browse files Browse the repository at this point in the history
## Changes 

Replaces #1995

Fixes Fixes
[CODY-3166](https://linear.app/sourcegraph/issue/CODY-3166/sourcegraphjetbrains1991-jetbrains-ask-cody-to-fix-and-ask-cody-to)
/ #1991

Mock files are used for in-memory buffers. Normally all editable code
files are not mocks/in-memory files (even scratches are normal files) so
we can assume if file is mock it is most likely some special component
for which we do not want to add cody error highlighting.

## Test plan

Manually verified that HighlightPass no longer applies to the Repo
Editor
  • Loading branch information
pkukielka authored Aug 7, 2024
1 parent 99f5abe commit ae1c369
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ class CodyFixHighlightPass(val file: PsiFile, val editor: Editor) :
class CodyFixHighlightPassFactory : TextEditorHighlightingPassFactoryRegistrar {
private val factory: TextEditorHighlightingPassFactory =
TextEditorHighlightingPassFactory { file, editor ->
CodyFixHighlightPass(file, editor)
when (file.virtualFile.fileSystem.protocol) {
"mock" -> null
else -> CodyFixHighlightPass(file, editor)
}
}

override fun registerHighlightingPassFactory(
Expand Down

0 comments on commit ae1c369

Please sign in to comment.