Skip to content

Commit

Permalink
Correct diagnostic behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfbecker committed Sep 4, 2016
1 parent 23f641f commit 4e88a17
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Server/TextDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,15 @@ private function updateAst(string $uri, string $content)
$diagnostic = new Diagnostic();
$diagnostic->range = new Range(
new Position($error->getStartLine() - 1, $error->hasColumnInfo() ? $error->getStartColumn($content) - 1 : 0),
new Position($error->getEndLine() - 1, $error->hasColumnInfo() ? $error->getEndColumn($content) - 1 : 0)
new Position($error->getEndLine() - 1, $error->hasColumnInfo() ? $error->getEndColumn($content) : 0)
);
$diagnostic->severity = DiagnosticSeverity::ERROR;
$diagnostic->source = 'php';
// Do not include "on line ..." in the error message
$diagnostic->message = $error->getRawMessage();
$diagnostics[] = $diagnostic;
}
if (count($diagnostics) > 0) {
$this->client->textDocument->publishDiagnostics($uri, $diagnostics);
}
$this->client->textDocument->publishDiagnostics($uri, $diagnostics);
// $stmts can be null in case of a fatal parsing error
if ($stmts) {
$traverser = new NodeTraverser;
Expand Down

0 comments on commit 4e88a17

Please sign in to comment.