Provide context for multiple files
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@ public class CliLightClassGenerationSupport extends LightClassGenerationSupport
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LightClassConstructionContext analyzeRelevantCode(@NotNull JetFile file) {
|
||||
public LightClassConstructionContext analyzeRelevantCode(@NotNull Collection<JetFile> files) {
|
||||
return new LightClassConstructionContext(getTrace().getBindingContext(), null);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.jetbrains.jet.asJava;
|
||||
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.navigation.ItemPresentationProviders;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -202,7 +201,7 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa
|
||||
// The context must reflect _all files in the module_. not only the current file
|
||||
// Otherwise, the analyzer gets confused and can't, for example, tell which files come as sources and which
|
||||
// must be loaded from .class files
|
||||
LightClassConstructionContext context = LightClassGenerationSupport.getInstance(project).analyzeRelevantCode(file);
|
||||
LightClassConstructionContext context = LightClassGenerationSupport.getInstance(project).analyzeRelevantCode(Collections.singletonList(file));
|
||||
|
||||
Throwable error = context.getError();
|
||||
if (error != null) {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public abstract class LightClassGenerationSupport {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract LightClassConstructionContext analyzeRelevantCode(@NotNull JetFile file);
|
||||
public abstract LightClassConstructionContext analyzeRelevantCode(@NotNull Collection<JetFile> files);
|
||||
|
||||
@NotNull
|
||||
public abstract Collection<JetClassOrObject> findClassOrObjectDeclarations(@NotNull FqName fqName, @NotNull GlobalSearchScope searchScope);
|
||||
|
||||
+1
-2
@@ -44,8 +44,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LightClassConstructionContext analyzeRelevantCode(@NotNull JetFile file) {
|
||||
Project project = file.getProject();
|
||||
public LightClassConstructionContext analyzeRelevantCode(@NotNull Collection<JetFile> files) {
|
||||
KotlinDeclarationsCache cache = KotlinCacheManager.getInstance(project).getDeclarationsFromProject(project);
|
||||
return new LightClassConstructionContext(cache.getBindingContext(), null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user