mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 18:00:07 -04:00
highlights(hack): extend queries add tests
This commit is contained in:
parent
77c006eb08
commit
cc0bdabe5f
10 changed files with 280 additions and 5 deletions
46
tests/query/highlights/xhp-intro.hack
Normal file
46
tests/query/highlights/xhp-intro.hack
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// From https://docs.hhvm.com/hack/XHP/introduction (MIT licensed)
|
||||
|
||||
use namespace Facebook\XHP\Core as x;
|
||||
use type Facebook\XHP\HTML\{XHPHTMLHelpers, a, form};
|
||||
|
||||
|
||||
final xhp class a_post extends x\element {
|
||||
// ^ keyword
|
||||
// ^ keyword
|
||||
// ^ keyword
|
||||
use XHPHTMLHelpers;
|
||||
|
||||
attribute string href @required;
|
||||
// ^ attribute
|
||||
attribute string target;
|
||||
// ^ keyword
|
||||
|
||||
<<__Override>>
|
||||
protected async function renderAsync(): Awaitable<x\node> {
|
||||
$id = $this->getID();
|
||||
|
||||
$anchor = <a>{$this->getChildren()}</a>;
|
||||
// ^ tag.delimiter
|
||||
// ^ tag
|
||||
$form = (
|
||||
<form
|
||||
id={$id}
|
||||
method="post"
|
||||
action={$this->:href}
|
||||
target={$this->:target}
|
||||
class="postLink">
|
||||
{$anchor}
|
||||
</form>
|
||||
);
|
||||
|
||||
$anchor->setAttribute(
|
||||
'onclick',
|
||||
'document.getElementById("'.$id.'").submit(); return false;',
|
||||
);
|
||||
$anchor->setAttribute('href', '#');
|
||||
// ^ method
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue