From 66255b1f5b8f9cf94af61d5dff26f9429052e082 Mon Sep 17 00:00:00 2001 From: Kaloyan Raev Date: Mon, 10 Oct 2016 21:18:20 +0300 Subject: [PATCH] Better calculation of endLine --- src/PhpDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpDocument.php b/src/PhpDocument.php index 8ea222a..f0136ad 100644 --- a/src/PhpDocument.php +++ b/src/PhpDocument.php @@ -178,7 +178,7 @@ class PhpDocument $diagnostic = new Diagnostic(); $startLine = max($error->getStartLine() - 1, 0); $startColumn = $error->hasColumnInfo() ? $error->getStartColumn($this->content) - 1 : 0; - $endLine = $error->getEndLine() === -1 ? $startLine : $error->getEndLine() - 1; + $endLine = max($error->getEndLine() - 1, $startLine); $endColumn = $error->hasColumnInfo() ? $error->getEndColumn($this->content) : 0; $diagnostic->range = new Range(new Position($startLine, $startColumn), new Position($endLine, $endColumn)); $diagnostic->severity = DiagnosticSeverity::ERROR;