Skip to content

Commit 755a591

Browse files
committed
bugfix: Handle compiler position that is not a range
1 parent 7d85e8d commit 755a591

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

frontend/src/main/scala/bloop/logging/BspServerLogger.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ final class BspServerLogger private (
161161
private def toExistingBspPosition(pos: xsbti.Position): Option[bsp.Range] = {
162162
def asIntPos(opt: Optional[Integer]) = InterfaceUtil.toOption(opt).map(_.toInt)
163163
for {
164-
startLine <- asIntPos(pos.startLine())
165-
startColumn <- asIntPos(pos.startColumn())
166-
endLine <- asIntPos(pos.endLine())
167-
endColumn <- asIntPos(pos.endColumn())
164+
startLine <- asIntPos(pos.startLine()).orElse(asIntPos(pos.line()))
165+
startColumn <- asIntPos(pos.startColumn()).orElse(asIntPos(pos.pointer()))
166+
endLine = asIntPos(pos.endLine()).getOrElse(startLine)
167+
endColumn = asIntPos(pos.endColumn()).getOrElse(startColumn)
168168
} yield bsp.Range(
169169
bsp.Position(startLine - 1, startColumn),
170170
bsp.Position(endLine - 1, endColumn)

0 commit comments

Comments
 (0)