Skip to content

Commit b79aa13

Browse files
Complete private members from libraries in Evaluate Expression dialog
1 parent 26c1536 commit b79aa13

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
### IDE
2424
- Debugger can distinguish nested inline arguments
2525
- Add kotlinClassName() and kotlinFunctionName() macros for use in live templates
26+
- Complete private members from libraries in Evaluate Expression dialog

idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ abstract class CompletionSession(
191191
if (descriptor is DeclarationDescriptorWithVisibility) {
192192
val visible = descriptor.isVisible(position, callTypeAndReceiver.receiver as? KtExpression, bindingContext, resolutionFacade)
193193
if (visible) return true
194-
return completeNonAccessible && !descriptor.isFromLibrary()
194+
return completeNonAccessible && (!descriptor.isFromLibrary() || file is KtCodeFragment)
195195
}
196196

197197
return true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.io.File
2+
3+
class MyFile : File("file") {
4+
private val privateField = 0
5+
}
6+
7+
fun foo(f: MyFile) {
8+
val a = 1<caret>
9+
}
10+
11+
// INVOCATION_COUNT: 2
12+
// EXIST: privateField
13+
// EXIST: prefixLength
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f.<caret>

idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/CodeFragmentCompletionTestGenerated.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public void testNoDuplicatesForSyntheticProperties() throws Exception {
8383
doTest(fileName);
8484
}
8585

86+
@TestMetadata("privatesInSecondPressCompletion.kt")
87+
public void testPrivatesInSecondPressCompletion() throws Exception {
88+
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/codeFragments/privatesInSecondPressCompletion.kt");
89+
doTest(fileName);
90+
}
91+
8692
@TestMetadata("topLevel.kt")
8793
public void testTopLevel() throws Exception {
8894
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/codeFragments/topLevel.kt");

0 commit comments

Comments
 (0)