use of com.jetbrains.python.traceBackParsers.TraceBackParser in project intellij-community by JetBrains.
the class PythonTracebackFilter method applyFilter.
@Override
@Nullable
public final Result applyFilter(@NotNull final String line, final int entireLength) {
for (final TraceBackParser parser : TraceBackParser.PARSERS) {
final LinkInTrace linkInTrace = parser.findLinkInTrace(line);
if (linkInTrace == null) {
continue;
}
final int lineNumber = linkInTrace.getLineNumber();
final VirtualFile vFile = findFileByName(linkInTrace.getFileName());
if (vFile != null) {
final OpenFileHyperlinkInfo hyperlink = new OpenFileHyperlinkInfo(myProject, vFile, lineNumber - 1);
final int textStartOffset = entireLength - line.length();
final int startPos = linkInTrace.getStartPos();
final int endPos = linkInTrace.getEndPos();
return new Result(startPos + textStartOffset, endPos + textStartOffset, hyperlink);
}
}
return null;
}
Aggregations