diff --git a/base/src/META-INF/blaze-base.xml b/base/src/META-INF/blaze-base.xml index 91966665d5f..381d9ce2bc6 100644 --- a/base/src/META-INF/blaze-base.xml +++ b/base/src/META-INF/blaze-base.xml @@ -377,6 +377,7 @@ + + diff --git a/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingFilter.java b/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingFilter.java index a51382116a4..6e6bc5a96e8 100644 --- a/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingFilter.java +++ b/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingFilter.java @@ -19,6 +19,7 @@ import com.google.idea.blaze.base.settings.BlazeImportSettings.ProjectType; import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInsight.daemon.impl.HighlightInfoFilter; +import com.intellij.openapi.util.registry.Registry; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,6 +29,9 @@ public class QuerySyncHighlightingFilter implements HighlightInfoFilter { @Override public boolean accept(@NotNull HighlightInfo highlightInfo, @Nullable PsiFile psiFile) { + if(Registry.is("bazel.qsync.enable.basic.highlighting.in.non.analysis.mode")) { + return true; + } if (psiFile == null) { return true; } diff --git a/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingSettingProvider.java b/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingSettingProvider.java new file mode 100644 index 00000000000..57d76863868 --- /dev/null +++ b/base/src/com/google/idea/blaze/base/qsync/QuerySyncHighlightingSettingProvider.java @@ -0,0 +1,25 @@ +package com.google.idea.blaze.base.qsync; + +import com.google.idea.blaze.base.settings.Blaze; +import com.google.idea.blaze.base.settings.BlazeImportSettings; +import com.intellij.codeInsight.daemon.impl.analysis.DefaultHighlightingSettingProvider; +import com.intellij.codeInsight.daemon.impl.analysis.FileHighlightingSetting; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiManager; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class QuerySyncHighlightingSettingProvider extends DefaultHighlightingSettingProvider { + @Override + public @Nullable FileHighlightingSetting getDefaultSetting(@NotNull Project project, @NotNull VirtualFile file) { + var psiFile = PsiManager.getInstance(project).findFile(file); + if (Blaze.getProjectType(psiFile.getProject()) == BlazeImportSettings.ProjectType.QUERY_SYNC) { + if(!QuerySyncManager.getInstance(psiFile.getProject()).isReadyForAnalysis(psiFile)){ + return FileHighlightingSetting.ESSENTIAL; + } + } + return null; + + } +}