Return correct ProjectFacade for script and its dependencies
^KT-22588 Fixed
This commit is contained in:
+6
-1
@@ -404,7 +404,12 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService {
|
|||||||
|
|
||||||
private fun getResolutionFacadeByModuleInfo(moduleInfo: IdeaModuleInfo, platform: TargetPlatform): ResolutionFacade {
|
private fun getResolutionFacadeByModuleInfo(moduleInfo: IdeaModuleInfo, platform: TargetPlatform): ResolutionFacade {
|
||||||
val settings = PlatformAnalysisSettings(platform, moduleInfo.sdk, moduleInfo.supportsAdditionalBuiltInsMembers())
|
val settings = PlatformAnalysisSettings(platform, moduleInfo.sdk, moduleInfo.supportsAdditionalBuiltInsMembers())
|
||||||
val projectFacade = globalFacade(settings)
|
val projectFacade = when (moduleInfo) {
|
||||||
|
is ScriptDependenciesInfo.ForProject,
|
||||||
|
is ScriptDependenciesSourceInfo.ForProject -> facadesForScriptDependencies[null]
|
||||||
|
is ScriptDependenciesInfo.ForFile -> facadesForScriptDependencies[moduleInfo.scriptModuleInfo]
|
||||||
|
else -> globalFacade(settings)
|
||||||
|
}
|
||||||
return ModuleResolutionFacadeImpl(projectFacade, moduleInfo)
|
return ModuleResolutionFacadeImpl(projectFacade, moduleInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
public int getField() {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField(int field) {
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int field = 1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
test.Utils().field
|
||||||
|
test.Utils().<caret>field = 2
|
||||||
|
|
||||||
|
// DEPENDENCIES: classpath:lib-classes
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
test.Utils().field
|
||||||
|
test.Utils().<caret>field = 2
|
||||||
|
|
||||||
|
// DEPENDENCIES: classpath:runtime-classes
|
||||||
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
public int getField() {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setField(int field) {
|
||||||
|
this.field = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int field = 1;
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.script
|
package org.jetbrains.kotlin.idea.script
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.highlighting.HighlightUsagesHandler
|
||||||
import com.intellij.openapi.extensions.Extensions
|
import com.intellij.openapi.extensions.Extensions
|
||||||
import com.intellij.openapi.module.JavaModuleType
|
import com.intellij.openapi.module.JavaModuleType
|
||||||
import com.intellij.openapi.module.Module
|
import com.intellij.openapi.module.Module
|
||||||
@@ -51,6 +52,10 @@ import kotlin.script.dependencies.Environment
|
|||||||
abstract class AbstractScriptConfigurationHighlightingTest : AbstractScriptConfigurationTest() {
|
abstract class AbstractScriptConfigurationHighlightingTest : AbstractScriptConfigurationTest() {
|
||||||
fun doTest(path: String) {
|
fun doTest(path: String) {
|
||||||
configureScriptFile(path)
|
configureScriptFile(path)
|
||||||
|
|
||||||
|
// Highlight references at caret
|
||||||
|
HighlightUsagesHandler.invoke(project, editor, myFile)
|
||||||
|
|
||||||
checkHighlighting(
|
checkHighlighting(
|
||||||
editor,
|
editor,
|
||||||
InTextDirectivesUtils.isDirectiveDefined(file.text, "// CHECK_WARNINGS"),
|
InTextDirectivesUtils.isDirectiveDefined(file.text, "// CHECK_WARNINGS"),
|
||||||
|
|||||||
Generated
+12
@@ -97,6 +97,18 @@ public class ScriptConfigurationHighlightingTestGenerated extends AbstractScript
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("propertyAccessor")
|
||||||
|
public void testPropertyAccessor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/highlighting/propertyAccessor/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("propertyAccessorFromModule")
|
||||||
|
public void testPropertyAccessorFromModule() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/highlighting/propertyAccessorFromModule/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simple")
|
@TestMetadata("simple")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/highlighting/simple/");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/script/definition/highlighting/simple/");
|
||||||
|
|||||||
Reference in New Issue
Block a user