1
0
Fork 0

Merge branch 'master' into autocomplet-speedup

pull/602/head
Declspeck 2018-02-09 22:54:46 +02:00
commit 98ac9ff913
No known key found for this signature in database
GPG Key ID: F0417663122A2189
2 changed files with 21 additions and 5 deletions

View File

@ -166,10 +166,12 @@ class CompletionProvider
|| (
$node instanceof Node\Statement\InlineHtml
&& (
$context === null
$context !== null
// Make sure to not suggest on the > trigger character in HTML
|| $context->triggerKind === CompletionTriggerKind::INVOKED
|| $context->triggerCharacter === '<'
&& (
$context->triggerKind === CompletionTriggerKind::INVOKED
|| $context->triggerCharacter === '<'
)
)
)
|| $pos == new Position(0, 0)

View File

@ -444,7 +444,7 @@ class CompletionTest extends TestCase
], true), $items);
}
public function testHtmlWithPrefix()
public function testHtmlWontBeProposedWithoutCompletionContext()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/html_with_prefix.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
@ -452,7 +452,21 @@ class CompletionTest extends TestCase
new TextDocumentIdentifier($completionUri),
new Position(0, 1)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
$this->assertEquals(new CompletionList([], true), $items);
}
public function testHtmlWontBeProposedWithPrefixWithCompletionContext()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/html_with_prefix.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(0, 1),
new CompletionContext(CompletionTriggerKind::TRIGGER_CHARACTER, '<')
)->wait();
$this->assertEquals(new CompletionList([
new CompletionItem(
'<?php',
CompletionItemKind::KEYWORD,