-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing field completion in nested with closure #803
Comments
Within isStatic = requestor.isStatic;
context.lhsType = requestor.lhsType;
completionType = getCompletionType(completionNode, context, requestor);
int closureStrategy = -1;
if (isPrimary && requestor.currentScope.getEnclosingClosure() != null) {
closureStrategy = requestor.currentScope.getEnclosingClosureResolveStrategy();
}
List<IProposalCreator> creators = chooseProposalCreators(context);
// if completionType is delegate, use instance (non-static) semantics
boolean isStatic1 = (isStatic && closureStrategy < Closure.OWNER_FIRST);
proposalCreatorLoop(groovyProposals, creators, requestor, context, options, completionType, isStatic1, isPrimary);
...
// within a closure, include content assist for the enclosing type (aka "owner")
if (closureStrategy >= Closure.OWNER_FIRST) {
ClassNode enclosingType = requestor.currentScope.getOwner();
if (enclosingType != null && !enclosingType.equals(completionType)) {
List<IGroovyProposal> ownerProposals = new ArrayList<>(); // keep proposals separate
proposalCreatorLoop(ownerProposals, creators, requestor, context, options, enclosingType, isStatic, isPrimary);
// if "delegate" and/or "owner" qualifiers are required, add them now
setClosureQualifiers(groovyProposals, ownerProposals, closureStrategy);
groovyProposals.addAll(ownerProposals);
}
} |
Ready to test.
|
Hi Eric, sorry for the delay, I verified this works well in 3.3.0.xx-201902091728-e1812, thank you! 👍 |
Hi Eric, sorry, I found another example which I think is equivalent to this that doesn't work yet: package test49
import java.util.zip.ZipOutputStream
class Test49 {
String foobar
void doSomething() {
def tmpFile = File.createTempFile('export', '.zip')
def records = []
tmpFile.withOutputStream { tmpOut ->
def zipOs = new ZipOutputStream(tmpOut)
zipOs.comment = 'foo'
zipOs.withStream { zip ->
foo|
}
}
}
} Completion of |
Ready to re-test |
Hi Eric, I confirm that with 3.3.0.xx-201902111952-e1812 the new use case works as well. Thank you! |
Consider this:
Invoke code assist at "|":
foobar
is not proposed. Please note it is if you are outside the innerwith
closure body.The text was updated successfully, but these errors were encountered: