Add more symbols to symbol test
* constants * static properties * static methodspull/49/head
parent
063c7f9ad2
commit
658a27f5a5
|
@ -2,10 +2,19 @@
|
||||||
|
|
||||||
namespace TestNamespace;
|
namespace TestNamespace;
|
||||||
|
|
||||||
|
const TEST_CONST = 123;
|
||||||
|
|
||||||
class TestClass
|
class TestClass
|
||||||
{
|
{
|
||||||
|
const TEST_CLASS_CONST = 123;
|
||||||
|
public static $staticTestProperty;
|
||||||
public $testProperty;
|
public $testProperty;
|
||||||
|
|
||||||
|
public static function staticTestMethod()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testMethod($testParameter)
|
public function testMethod($testParameter)
|
||||||
{
|
{
|
||||||
$testVariable = 123;
|
$testVariable = 123;
|
||||||
|
|
|
@ -59,7 +59,7 @@ class SymbolFinder extends NodeVisitorAbstract
|
||||||
public function enterNode(Node $node)
|
public function enterNode(Node $node)
|
||||||
{
|
{
|
||||||
$this->nodeStack[] = $node;
|
$this->nodeStack[] = $node;
|
||||||
$containerName = end($this->nameStack);
|
$containerName = empty($this->nameStack) ? null : end($this->nameStack);
|
||||||
|
|
||||||
// If we enter a named node, push its name onto name stack.
|
// If we enter a named node, push its name onto name stack.
|
||||||
// Else push the current name onto stack.
|
// Else push the current name onto stack.
|
||||||
|
|
|
@ -44,6 +44,24 @@ class TextDocumentTest extends TestCase
|
||||||
],
|
],
|
||||||
'containerName' => null
|
'containerName' => null
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => 'TEST_CONST',
|
||||||
|
'kind' => SymbolKind::CONSTANT,
|
||||||
|
'location' => [
|
||||||
|
'uri' => 'whatever',
|
||||||
|
'range' => [
|
||||||
|
'start' => [
|
||||||
|
'line' => 4,
|
||||||
|
'character' => 6
|
||||||
|
],
|
||||||
|
'end' => [
|
||||||
|
'line' => 4,
|
||||||
|
'character' => 22
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'containerName' => 'TestNamespace'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => 'TestClass',
|
'name' => 'TestClass',
|
||||||
'kind' => SymbolKind::CLASS_,
|
'kind' => SymbolKind::CLASS_,
|
||||||
|
@ -51,17 +69,53 @@ class TextDocumentTest extends TestCase
|
||||||
'uri' => 'whatever',
|
'uri' => 'whatever',
|
||||||
'range' => [
|
'range' => [
|
||||||
'start' => [
|
'start' => [
|
||||||
'line' => 4,
|
'line' => 6,
|
||||||
'character' => 0
|
'character' => 0
|
||||||
],
|
],
|
||||||
'end' => [
|
'end' => [
|
||||||
'line' => 12,
|
'line' => 21,
|
||||||
'character' => 1
|
'character' => 1
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => 'TestNamespace'
|
'containerName' => 'TestNamespace'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => 'TEST_CLASS_CONST',
|
||||||
|
'kind' => SymbolKind::CONSTANT,
|
||||||
|
'location' => [
|
||||||
|
'uri' => 'whatever',
|
||||||
|
'range' => [
|
||||||
|
'start' => [
|
||||||
|
'line' => 8,
|
||||||
|
'character' => 10
|
||||||
|
],
|
||||||
|
'end' => [
|
||||||
|
'line' => 8,
|
||||||
|
'character' => 32
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'containerName' => 'TestNamespace\\TestClass'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'staticTestProperty',
|
||||||
|
'kind' => SymbolKind::PROPERTY,
|
||||||
|
'location' => [
|
||||||
|
'uri' => 'whatever',
|
||||||
|
'range' => [
|
||||||
|
'start' => [
|
||||||
|
'line' => 9,
|
||||||
|
'character' => 18
|
||||||
|
],
|
||||||
|
'end' => [
|
||||||
|
'line' => 9,
|
||||||
|
'character' => 37
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'containerName' => 'TestNamespace\\TestClass'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => 'testProperty',
|
'name' => 'testProperty',
|
||||||
'kind' => SymbolKind::PROPERTY,
|
'kind' => SymbolKind::PROPERTY,
|
||||||
|
@ -69,17 +123,35 @@ class TextDocumentTest extends TestCase
|
||||||
'uri' => 'whatever',
|
'uri' => 'whatever',
|
||||||
'range' => [
|
'range' => [
|
||||||
'start' => [
|
'start' => [
|
||||||
'line' => 6,
|
'line' => 10,
|
||||||
'character' => 11
|
'character' => 11
|
||||||
],
|
],
|
||||||
'end' => [
|
'end' => [
|
||||||
'line' => 6,
|
'line' => 10,
|
||||||
'character' => 24
|
'character' => 24
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'containerName' => 'TestNamespace\\TestClass'
|
'containerName' => 'TestNamespace\\TestClass'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => 'staticTestMethod',
|
||||||
|
'kind' => SymbolKind::METHOD,
|
||||||
|
'location' => [
|
||||||
|
'uri' => 'whatever',
|
||||||
|
'range' => [
|
||||||
|
'start' => [
|
||||||
|
'line' => 12,
|
||||||
|
'character' => 4
|
||||||
|
],
|
||||||
|
'end' => [
|
||||||
|
'line' => 15,
|
||||||
|
'character' => 5
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'containerName' => 'TestNamespace\\TestClass'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => 'testMethod',
|
'name' => 'testMethod',
|
||||||
'kind' => SymbolKind::METHOD,
|
'kind' => SymbolKind::METHOD,
|
||||||
|
@ -87,11 +159,11 @@ class TextDocumentTest extends TestCase
|
||||||
'uri' => 'whatever',
|
'uri' => 'whatever',
|
||||||
'range' => [
|
'range' => [
|
||||||
'start' => [
|
'start' => [
|
||||||
'line' => 8,
|
'line' => 17,
|
||||||
'character' => 4
|
'character' => 4
|
||||||
],
|
],
|
||||||
'end' => [
|
'end' => [
|
||||||
'line' => 11,
|
'line' => 20,
|
||||||
'character' => 5
|
'character' => 5
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -105,11 +177,11 @@ class TextDocumentTest extends TestCase
|
||||||
'uri' => 'whatever',
|
'uri' => 'whatever',
|
||||||
'range' => [
|
'range' => [
|
||||||
'start' => [
|
'start' => [
|
||||||
'line' => 14,
|
'line' => 23,
|
||||||
'character' => 0
|
'character' => 0
|
||||||
],
|
],
|
||||||
'end' => [
|
'end' => [
|
||||||
'line' => 17,
|
'line' => 26,
|
||||||
'character' => 1
|
'character' => 1
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -123,11 +195,11 @@ class TextDocumentTest extends TestCase
|
||||||
'uri' => 'whatever',
|
'uri' => 'whatever',
|
||||||
'range' => [
|
'range' => [
|
||||||
'start' => [
|
'start' => [
|
||||||
'line' => 19,
|
'line' => 28,
|
||||||
'character' => 0
|
'character' => 0
|
||||||
],
|
],
|
||||||
'end' => [
|
'end' => [
|
||||||
'line' => 22,
|
'line' => 31,
|
||||||
'character' => 1
|
'character' => 1
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue