SSR: show variable name instead of filename in log

This commit is contained in:
Bas Leijdekkers
2018-03-05 16:15:27 +01:00
parent a1503738c4
commit ba9689ca32
2 changed files with 9 additions and 3 deletions
@@ -3,8 +3,11 @@ package com.intellij.structuralsearch.impl.matcher.predicates;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.structuralsearch.plugin.ui.UIUtil;
import static com.intellij.structuralsearch.impl.matcher.predicates.ScriptSupport.UUID;
/**
* @author Bas Leijdekkers
*/
@@ -36,7 +39,7 @@ public class ScriptLog {
for (StackTraceElement e : stackTrace) {
final String methodName = e.getMethodName();
if ("run".equals(methodName)) {
location = "(" + e.getFileName() + ":" + e.getLineNumber() + ") ";
location = "(" + StringUtil.replace(e.getFileName(), UUID + ".groovy", "") + ":" + e.getLineNumber() + ") ";
break;
}
}
@@ -24,7 +24,10 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Maxim.Mossienko
@@ -35,7 +38,7 @@ public class ScriptSupport {
* We use a randomly generated uuid for this, so the chance of accidental collision with an existing variable name is extremely small.
* This also enables to filter out this uuid from Groovy error messages, to clarify for which SSR variable the script failed.
*/
private static final String UUID = "a3cd264774bf4efb9ab609b250c5165c";
static final String UUID = "a3cd264774bf4efb9ab609b250c5165c";
private final Script script;
private final ScriptLog myScriptLog;