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