This commit is contained in:
Daniil Ovchinnikov
2017-02-14 19:28:15 +03:00
parent ebc316287b
commit 2fa8ef7f33
6 changed files with 12 additions and 11 deletions
@@ -45,7 +45,7 @@ public abstract class GroovyNamedArgumentProvider {
@Nullable PsiElement resolve,
@Nullable String argumentName,
boolean forCompletion,
Map<String, NamedArgumentDescriptor> result) {
@NotNull Map<String, NamedArgumentDescriptor> result) {
// no op
}
@@ -54,7 +54,7 @@ public abstract class GroovyNamedArgumentProvider {
@Nullable GroovyResolveResult resolveResult,
@Nullable String argumentName,
boolean forCompletion,
Map<String, NamedArgumentDescriptor> result) {
@NotNull Map<String, NamedArgumentDescriptor> result) {
getNamedArguments(call, resolve, argumentName, forCompletion, result);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
@Nullable PsiElement resolve,
@Nullable String argumentName,
boolean forCompletion,
Map<String, NamedArgumentDescriptor> result) {
@NotNull Map<String, NamedArgumentDescriptor> result) {
if (!(call instanceof GrNewExpression)) return;
if (resolve != null) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class GroovyMethodReturnNamedArgumentProvider extends GroovyNamedArgument
@Nullable PsiElement resolve,
@Nullable String argumentName,
boolean forCompletion,
Map<String, NamedArgumentDescriptor> result) {
@NotNull Map<String, NamedArgumentDescriptor> result) {
if (!forCompletion || !(resolve instanceof PsiMethod)) return;
PsiType returnType = ((PsiMethod)resolve).getReturnType();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ public class GroovySourceCodeNamedArgumentProvider extends GroovyNamedArgumentPr
@Nullable PsiElement resolve,
@Nullable String argumentName,
boolean forCompletion,
Map<String, NamedArgumentDescriptor> result) {
@NotNull Map<String, NamedArgumentDescriptor> result) {
if (resolve instanceof GrMethod) {
result.putAll(((GrMethod)resolve).getNamedParameters());
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class SwingBuilderNamedArgumentProvider extends GroovyNamedArgumentProvid
@Nullable PsiElement resolve,
@Nullable String argumentName,
boolean forCompletion,
Map<String, NamedArgumentDescriptor> result) {
@NotNull Map<String, NamedArgumentDescriptor> result) {
PsiType returnType = resolve == null ? null : ((PsiMethod)resolve).getReturnType();
PsiClass aClass = PsiTypesUtil.getPsiClass(returnType);
if (aClass == null) return;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -469,6 +469,7 @@ class Test {
private doTestCompletionWithinMap(String text, String text2 = null) {
PlatformTestUtil.registerExtension GroovyNamedArgumentProvider.EP_NAME, new GroovyNamedArgumentProvider() {
@NotNull
@Override
Map<String, NamedArgumentDescriptor> getNamedArguments(@NotNull GrListOrMap literal) {
['foo': NamedArgumentDescriptor.SIMPLE_NORMAL, 'bar': NamedArgumentDescriptor.SIMPLE_NORMAL]