Fixed hiding the tooltip too early, fixed tests
parent
b0f3952844
commit
1b68c73186
|
@ -4,6 +4,4 @@ function helpFunc2(int $count = 0)
|
|||
{
|
||||
}
|
||||
|
||||
$a = 1;
|
||||
|
||||
helpFunc2(
|
||||
|
|
|
@ -7,6 +7,4 @@ class HelpClass4
|
|||
}
|
||||
}
|
||||
|
||||
HelpClass4::method(1, 2, 3
|
||||
|
||||
HelpClass4::method(1, 2, 3
|
||||
HelpClass4::method(1
|
||||
|
|
|
@ -72,8 +72,13 @@ class SignatureHelpProvider
|
|||
$line = substr(fgets($handle), 0, $pos->character);
|
||||
fseek($handle, 0);
|
||||
|
||||
$i = 0;
|
||||
$orig = null;
|
||||
do {
|
||||
$node = $doc->getNodeAtPosition($pos);
|
||||
if ($node !== null) {
|
||||
$orig = $node;
|
||||
}
|
||||
$pos->character--;
|
||||
if ($pos->character < 0) {
|
||||
$pos->line --;
|
||||
|
@ -82,22 +87,23 @@ class SignatureHelpProvider
|
|||
}
|
||||
$pos->character = $lines[$pos->line];
|
||||
}
|
||||
} while ($node === null);
|
||||
|
||||
if ($node === null) {
|
||||
fclose($handle);
|
||||
return $help;
|
||||
}
|
||||
$i = 0;
|
||||
while (!(
|
||||
} while (!(
|
||||
$node instanceof Node\Expr\PropertyFetch ||
|
||||
$node instanceof Node\Expr\MethodCall ||
|
||||
$node instanceof Node\Expr\FuncCall ||
|
||||
$node instanceof Node\Expr\ClassConstFetch ||
|
||||
$node instanceof Node\Expr\StaticCall
|
||||
) && ++$i < 5 && $node !== null) {
|
||||
$node = $node->getAttribute('parentNode');
|
||||
) && ++$i < 120);
|
||||
|
||||
if ($node === null) {
|
||||
$node = $orig;
|
||||
}
|
||||
|
||||
if ($node === null) {
|
||||
fclose($handle);
|
||||
return $help;
|
||||
}
|
||||
|
||||
$params = '';
|
||||
if ($node instanceof Node\Expr\PropertyFetch) {
|
||||
fseek($handle, $node->name->getAttribute('startFilePos'));
|
||||
|
@ -142,7 +148,7 @@ class SignatureHelpProvider
|
|||
$fqn = $this->definitionResolver->resolveReferenceNodeToFqn($node->class);
|
||||
$def = $this->index->getDefinition($fqn.'::'.$method.'()');
|
||||
} else {
|
||||
if (!preg_match('(([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\((.*)$)', $line, $method)) {
|
||||
if (!preg_match('(([a-zA-Z_\x7f-\xff][:a-zA-Z0-9_\x7f-\xff]*)\s*\((.*)$)', $line, $method)) {
|
||||
fclose($handle);
|
||||
return $help;
|
||||
}
|
||||
|
|
|
@ -132,13 +132,13 @@ class SignatureHelpTest extends TestCase
|
|||
$this->assertEquals($help, $result);
|
||||
}
|
||||
|
||||
public function funcClosed()
|
||||
public function testFuncClosed()
|
||||
{
|
||||
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/signatureHelp/funcClosed.php');
|
||||
$this->loader->open($completionUri, file_get_contents($completionUri));
|
||||
$result = $this->textDocument->signatureHelp(
|
||||
new TextDocumentIdentifier($completionUri),
|
||||
new Position(5, 10)
|
||||
new Position(6, 10)
|
||||
)->wait();
|
||||
|
||||
$help = new SignatureHelp;
|
||||
|
@ -154,13 +154,13 @@ class SignatureHelpTest extends TestCase
|
|||
$this->assertEquals($help, $result);
|
||||
}
|
||||
|
||||
public function funcNotClosed()
|
||||
public function testFuncNotClosed()
|
||||
{
|
||||
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/signatureHelp/funcNotClosed.php');
|
||||
$this->loader->open($completionUri, file_get_contents($completionUri));
|
||||
$result = $this->textDocument->signatureHelp(
|
||||
new TextDocumentIdentifier($completionUri),
|
||||
new Position(5, 10)
|
||||
new Position(6, 10)
|
||||
)->wait();
|
||||
|
||||
$help = new SignatureHelp;
|
||||
|
@ -176,7 +176,7 @@ class SignatureHelpTest extends TestCase
|
|||
$this->assertEquals($help, $result);
|
||||
}
|
||||
|
||||
public function staticClosed()
|
||||
public function testStaticClosed()
|
||||
{
|
||||
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/signatureHelp/staticClosed.php');
|
||||
$this->loader->open($completionUri, file_get_contents($completionUri));
|
||||
|
@ -198,7 +198,7 @@ class SignatureHelpTest extends TestCase
|
|||
$this->assertEquals($help, $result);
|
||||
}
|
||||
|
||||
public function staticNotClosed()
|
||||
public function testStaticNotClosed()
|
||||
{
|
||||
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/signatureHelp/staticNotClosed.php');
|
||||
$this->loader->open($completionUri, file_get_contents($completionUri));
|
||||
|
|
Loading…
Reference in New Issue