Skip to content

Commit a846a39

Browse files
committed
Merge pull request #2555 from grenki/GoLightTypeGetText
Add getText() method to GoLightType and GoLightType.LightTypeList
2 parents fc15619 + 6367ebd commit a846a39

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/com/goide/psi/impl/GoLightType.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.goide.psi.*;
2020
import com.goide.stubs.GoTypeStub;
21+
import com.intellij.openapi.util.text.StringUtil;
2122
import com.intellij.psi.PsiElement;
2223
import com.intellij.psi.impl.light.LightElement;
2324
import com.intellij.psi.stubs.IStubElementType;
@@ -108,6 +109,11 @@ public List<GoType> getTypeList() {
108109
public String toString() {
109110
return "MyGoTypeList{myTypes=" + myTypes + '}';
110111
}
112+
113+
@Override
114+
public String getText() {
115+
return StringUtil.join(getTypeList(), GoPsiImplUtil.GET_TEXT_FUNCTION, ", ");
116+
}
111117
}
112118

113119
static class LightFunctionType extends GoLightType<GoSignatureOwner> implements GoFunctionType {
@@ -175,5 +181,4 @@ public PsiElement getTripleDot() {
175181
return null;
176182
}
177183
}
178-
179184
}

testData/highlighting/forRange.go

+10
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,14 @@ func _(a *Bits) {
4747
fmt.Println(i)
4848
fmt.Println(x)
4949
}
50+
51+
for i, x := range <error descr="Cannot range over data (type int, int)">a2()</error> {
52+
fmt.Println(i)
53+
fmt.Println(x)
54+
}
55+
}
56+
57+
func a2() (value int, error int){
58+
value, error = 2, 3
59+
return
5060
}

0 commit comments

Comments
 (0)