mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-110369 Autocompletion in GString with two extrapolated strings - $ is deleted
This commit is contained in:
+6
@@ -659,6 +659,12 @@ public class GroovyCompletionContributor extends CompletionContributor {
|
||||
if (identifier != null) {
|
||||
context.setDummyIdentifier(identifier);
|
||||
}
|
||||
|
||||
//don't eat $ from gstrings when completing previous injection ref. see IDEA-110369
|
||||
PsiElement position = context.getFile().findElementAt(context.getStartOffset());
|
||||
if (position!= null && position.getNode().getElementType() == mDOLLAR) {
|
||||
context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, context.getStartOffset());
|
||||
}
|
||||
}
|
||||
|
||||
private String getIdentifier(CompletionInitializationContext context) {
|
||||
|
||||
+32
@@ -1823,4 +1823,36 @@ def foo(Util util) {
|
||||
}
|
||||
''', CompletionType.SMART)
|
||||
}
|
||||
|
||||
void testDollarInGString() {
|
||||
doCompletionTest('''\
|
||||
class Autocompletion {
|
||||
def reportDir = '/'
|
||||
def reportDirectory = '/'
|
||||
def fileName = "$reportD<caret>${File.separator}"
|
||||
}
|
||||
''', '''\
|
||||
class Autocompletion {
|
||||
def reportDir = '/'
|
||||
def reportDirectory = '/'
|
||||
def fileName = "$reportDir<caret>${File.separator}"
|
||||
}
|
||||
''', '\t', CompletionType.BASIC)
|
||||
}
|
||||
|
||||
void testDollarInGString2() {
|
||||
doCompletionTest('''\
|
||||
class Autocompletion {
|
||||
def reportDir = '/'
|
||||
def fileName = "$report<caret>D${File.separator}"
|
||||
}
|
||||
''', '''\
|
||||
class Autocompletion {
|
||||
def reportDir = '/'
|
||||
def fileName = "$reportDir<caret>${File.separator}"
|
||||
}
|
||||
''', '\t', CompletionType.BASIC)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user