Skip to content

Commit f4b21a4

Browse files
committed
Give the source location if available to the AsciiDoc warning so that it is displayed in the right spot in the IDE
1 parent 8a6a43d commit f4b21a4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build-logic/asciidoc-extensions/src/main/java/org/spockframework/plugins/asciidoctor/IncludedSourceLinker.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,14 @@ private void processBlocks(Document document, boolean listings) {
588588
// Once https://github.com/asciidoctor/asciidoctor/issues/4556 is implemented we could add a recognition here
589589
if (includeSourceMarkerLine.isEmpty()) {
590590
if (listings && !cloakedLiteral && !lines.isEmpty()) {
591-
log(new LogRecord(WARN, "listing with only inline code found; " +
591+
log(new LogRecord(WARN, block.getSourceLocation(), "listing with only inline code found; " +
592592
"if this is not source from a file, consider using a literal block instead; " +
593-
"first line: " + lines.get(0)));
593+
// work-around for https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/752
594+
// once it is fixed, check whether the Gradle output contains the source location,
595+
// otherwise add the source location instead of the first line here, it is just to find the spot
596+
((block.getSourceLocation() == null)
597+
? "first line: " + lines.get(0)
598+
: "")));
594599
}
595600
return;
596601
}

0 commit comments

Comments
 (0)