Cleanup
parent
eef824488e
commit
aba798aaba
|
@ -15,7 +15,6 @@ class ParserHelpers
|
|||
(
|
||||
$node instanceof Node\QualifiedName &&
|
||||
(
|
||||
// $node->parent instanceof Node\Statement\ExpressionStatement ||
|
||||
$parent instanceof Node\Expression ||
|
||||
$parent instanceof Node\DelimitedList\ExpressionList ||
|
||||
$parent instanceof Node\ArrayElement ||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace LanguageServer;
|
||||
|
||||
class ParserKind
|
||||
{
|
||||
const PHP_PARSER = 1;
|
||||
const TOLERANT_PHP_PARSER = 2;
|
||||
const DIAGNOSTIC_TOLERANT_PHP_PARSER = 3;
|
||||
const DIAGNOSTIC_PHP_PARSER = 4;
|
||||
}
|
|
@ -30,7 +30,7 @@ class Range
|
|||
* @param Node $node
|
||||
* @return self
|
||||
*/
|
||||
public static function fromNode($node)
|
||||
public static function fromNode(Node $node)
|
||||
{
|
||||
$range = PhpParser\PositionUtilities::getRangeFromPosition($node->getStart(), $node->getWidth(), $node->getFileContents());
|
||||
|
||||
|
|
|
@ -107,18 +107,6 @@ class SymbolInformation
|
|||
$symbol->name = $node->variableName->getText($node);
|
||||
} else if (!isset($symbol->name)) {
|
||||
return null;
|
||||
// if (!isset($symbol->name)) {
|
||||
// if ($node instanceof Node\Name) {
|
||||
// $symbol->name = (string)$node;
|
||||
// } else if ($node instanceof Node\Expr\Assign || $node instanceof Node\Expr\AssignOp) {
|
||||
// $symbol->name = $node->var->name;
|
||||
// } else if ($node instanceof Node\Expr\ClosureUse) {
|
||||
// $symbol->name = $node->var;
|
||||
// } else if (isset($node->name)) {
|
||||
// $symbol->name = (string)$node->name;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
$symbol->location = Location::fromNode($node);
|
||||
|
|
|
@ -49,7 +49,7 @@ class TextDocument
|
|||
/**
|
||||
* @var ReadableIndex
|
||||
*/
|
||||
public $index;
|
||||
protected $index;
|
||||
|
||||
/**
|
||||
* @var \stdClass|null
|
||||
|
|
|
@ -17,8 +17,10 @@ class TreeAnalyzer
|
|||
/** @var Node */
|
||||
private $stmts;
|
||||
|
||||
/** @var Diagnostic[] */
|
||||
private $diagnostics;
|
||||
|
||||
/** @var string */
|
||||
private $content;
|
||||
|
||||
/**
|
||||
|
@ -65,11 +67,11 @@ class TreeAnalyzer
|
|||
$this->update($node);
|
||||
}
|
||||
|
||||
if (($_error = PhpParser\DiagnosticsProvider::checkDiagnostics($node)) !== null) {
|
||||
$range = PhpParser\PositionUtilities::getRangeFromPosition($_error->start, $_error->length, $this->content);
|
||||
if (($error = PhpParser\DiagnosticsProvider::checkDiagnostics($node)) !== null) {
|
||||
$range = PhpParser\PositionUtilities::getRangeFromPosition($error->start, $error->length, $this->content);
|
||||
|
||||
$this->diagnostics[] = new Diagnostic(
|
||||
$_error->message,
|
||||
$error->message,
|
||||
new Range(
|
||||
new Position($range->start->line, $range->start->character),
|
||||
new Position($range->end->line, $range->start->character)
|
||||
|
|
Loading…
Reference in New Issue