Remove error logging when we can't determine the type (js or jvm) of the module the source belongs to (for example navigating to library sources which happens really often)
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.plugin.project;
|
package org.jetbrains.jet.plugin.project;
|
||||||
|
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.module.Module;
|
import com.intellij.openapi.module.Module;
|
||||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||||
@@ -40,25 +39,18 @@ public final class AnalyzerFacadeProvider {
|
|||||||
public static AnalyzerFacade getAnalyzerFacadeForFile(@NotNull JetFile file) {
|
public static AnalyzerFacade getAnalyzerFacadeForFile(@NotNull JetFile file) {
|
||||||
VirtualFile virtualFile = file.getOriginalFile().getVirtualFile();
|
VirtualFile virtualFile = file.getOriginalFile().getVirtualFile();
|
||||||
if (virtualFile == null) {
|
if (virtualFile == null) {
|
||||||
logErrorIfNotTests("No virtual file for " + file.getName() + " with text:\n" + file.getText());
|
|
||||||
return getDefaultAnalyzerFacade();
|
return getDefaultAnalyzerFacade();
|
||||||
}
|
}
|
||||||
Module moduleForFile = ProjectFileIndex.SERVICE.getInstance(file.getProject()).getModuleForFile(virtualFile);
|
Module moduleForFile = ProjectFileIndex.SERVICE.getInstance(file.getProject()).getModuleForFile(virtualFile);
|
||||||
if (moduleForFile == null) {
|
if (moduleForFile == null) {
|
||||||
logErrorIfNotTests("File " + virtualFile.getPath() + " is not under any module. Cannot determine which facade to use.");
|
|
||||||
return getDefaultAnalyzerFacade();
|
return getDefaultAnalyzerFacade();
|
||||||
}
|
}
|
||||||
return getAnalyzerFacadeForModule(moduleForFile);
|
return getAnalyzerFacadeForModule(moduleForFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void logErrorIfNotTests(@NotNull String message) {
|
|
||||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
|
||||||
LOG.error(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static AnalyzerFacade getDefaultAnalyzerFacade() {
|
private static AnalyzerFacade getDefaultAnalyzerFacade() {
|
||||||
|
//TODO: should deal with situations when we can't determine whether to use java or js backend more carefully
|
||||||
LOG.info("Using default analyzer facade");
|
LOG.info("Using default analyzer facade");
|
||||||
return AnalyzerFacadeForJVM.INSTANCE;
|
return AnalyzerFacadeForJVM.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user