Skip to content

Commit e277091

Browse files
committed
Handle only gotest protocol
1 parent 50436b0 commit e277091

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/com/goide/runconfig/testing/GoTestConsoleProperties.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected boolean processServiceMessages(@NotNull String text, Key outputType, S
7878

7979
if ((matcher = RUN.matcher(text)).find()) {
8080
String testName = StringUtil.notNullize(matcher.group(1), "<test>");
81-
ServiceMessageBuilder testStarted = ServiceMessageBuilder.testStarted(testName).addAttribute("locationHint", "gotest://" + testName);
81+
ServiceMessageBuilder testStarted = ServiceMessageBuilder.testStarted(testName).addAttribute("locationHint", testUrl(testName));
8282
return processNotFinishedMessage(testStarted.toString(), outputType, visitor);
8383
}
8484

@@ -112,6 +112,11 @@ protected boolean processServiceMessages(@NotNull String text, Key outputType, S
112112
return super.processServiceMessages(text, outputType, visitor);
113113
}
114114

115+
@NotNull
116+
private static String testUrl(@NotNull String testName) {
117+
return GoTestLocationProvider.PROTOCOL + "://" + testName;
118+
}
119+
115120
private boolean processNotFinishedMessage(String message, Key outputType, ServiceMessageVisitor visitor) throws ParseException {
116121
if (myFailed || mySkipped) {
117122
processFailedMessage(outputType, visitor);

src/com/goide/runconfig/testing/GoTestLocationProvider.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@
2727
import com.intellij.util.containers.ContainerUtil;
2828
import org.jetbrains.annotations.NotNull;
2929

30+
import java.util.Collections;
3031
import java.util.List;
3132

3233
public class GoTestLocationProvider implements TestLocationProvider {
34+
public static final String PROTOCOL = "gotest";
35+
3336
@NotNull
3437
@Override
3538
public List<Location> getLocation(@NotNull String protocolId, @NotNull String locationData, @NotNull final Project project) {
39+
if (!PROTOCOL.equals(protocolId)) {
40+
return Collections.emptyList();
41+
}
3642
return ContainerUtil.map(GoFunctionIndex.find(locationData, project, GlobalSearchScope.projectScope(project)), new Function<GoFunctionDeclaration, Location>() {
3743
@Override
3844
public Location fun(GoFunctionDeclaration declaration) {

0 commit comments

Comments
 (0)