Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tags #262

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions queries/tags.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(namespace_definition
name: (namespace_name) @name) @module
name: (namespace_name) @name) @definition.module

(interface_declaration
name: (name) @name) @definition.interface
Expand All @@ -10,7 +10,7 @@
(class_declaration
name: (name) @name) @definition.class

(class_interface_clause [(name) (qualified_name)] @name) @impl
(class_interface_clause [(name) (qualified_name)] @name) @reference.implementation

(property_declaration
(property_element (variable_name (name) @name))) @definition.field
Expand Down
26 changes: 26 additions & 0 deletions test/tags/definition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace A\B;
// ^ definition.module
// ^ definition.module

interface T {
// ^ definition.interface
}

trait U {
// ^ definition.interface
}

function f() {
// ^ definition.function
}

class A {
// ^ definition.class
int $foo;
// ^^^ definition.field
public function a() {
// ^ definition.function
}
}
20 changes: 20 additions & 0 deletions test/tags/reference.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

class B implements T {
// ^ reference.implementation
}

new A\B();
// ^ reference.class

new $foo();
// ^^^ reference.class

$bar->f();
// ^ reference.call

\f();
#^ reference.call

C::f();
// ^ reference.call