use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.
the class BlazeIssueParserTest method testParseGenericError.
@Test
public void testParseGenericError() {
BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
String msg = "Bad target pattern 'USE_CANARY_BLAZE=1': package names may contain only " + "A-Z, a-z, 0-9, '/', '-', '.', ' ', '$', '(', ')' and '_'.";
IssueOutput issue = blazeIssueParser.parseIssue("ERROR: " + msg);
assertThat(issue).isNotNull();
assertThat(issue.getMessage()).isEqualTo(msg);
assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.
the class BlazeIssueParserTest method testPackageProjectViewParser.
@Test
public void testPackageProjectViewParser() {
BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
IssueOutput issue = blazeIssueParser.parseIssue("no such package 'package/path': BUILD file not found on package path");
assertThat(issue).isNotNull();
assertThat(issue.getFile().getPath()).isEqualTo(".blazeproject");
assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.
the class BlazeIssueParserTest method testLabelProjectViewParser.
@Test
public void testLabelProjectViewParser() {
BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
IssueOutput issue = blazeIssueParser.parseIssue("no such target '//package/path:hello4': " + "target 'hello4' not declared in package 'package/path' " + "defined by /path/to/root/package/path/BUILD");
assertThat(issue).isNotNull();
assertThat(issue.getFile().getPath()).isEqualTo(".blazeproject");
assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.
the class IssueOutputFilter method getHyperlinkInfo.
@Nullable
private static HyperlinkInfo getHyperlinkInfo(IssueOutput issue) {
Navigatable navigatable = issue.getNavigatable();
if (navigatable != null) {
return project -> navigatable.navigate(true);
}
VirtualFile vf = resolveVirtualFile(issue.getFile());
return vf != null ? project -> new OpenFileDescriptor(project, vf, issue.getLine() - 1, issue.getColumn() - 1).navigate(true) : null;
}
use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.
the class IssueOutputFilter method applyFilter.
@Nullable
@Override
public Result applyFilter(String line, int entireLength) {
IssueOutput issue = issueParser.parseIssue(line);
if (issue == null) {
return null;
}
logger.warn(issue.toString());
List<ResultItem> links = new ArrayList<>();
int offset = entireLength - line.length();
if (linkToBlazeConsole) {
ResultItem dummyResult = dummyResult(offset);
BlazeProblemsView.getInstance(project).addMessage(issue, openConsoleToHyperlink(dummyResult.getHyperlinkInfo(), offset));
links.add(dummyResult);
} else {
BlazeProblemsView.getInstance(project).addMessage(issue, null);
}
ResultItem hyperlink = hyperlinkItem(issue, offset);
if (hyperlink != null) {
links.add(hyperlink);
}
return !links.isEmpty() ? new Result(links) : null;
}
Aggregations