Skip to content
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
5 changes: 5 additions & 0 deletions fixtures/completion/bare_php.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$abc = 1;
$abc2 = 2;
echo $ab
4 changes: 2 additions & 2 deletions tests/LanguageServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testIndexingWithDirectFileAccess()
if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) {
if ($msg->body->params->type === MessageType::ERROR) {
$promise->reject(new Exception($msg->body->params->message));
} else if (strpos($msg->body->params->message, 'All 25 PHP files parsed') !== false) {
} else if (strpos($msg->body->params->message, 'All 26 PHP files parsed') !== false) {
$promise->fulfill();
}
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testIndexingWithFilesAndContentRequests()
if ($promise->state === Promise::PENDING) {
$promise->reject(new Exception($msg->body->params->message));
}
} else if (strpos($msg->body->params->message, 'All 25 PHP files parsed') !== false) {
} else if (strpos($msg->body->params->message, 'All 26 PHP files parsed') !== false) {
$promise->fulfill();
}
}
Expand Down
32 changes: 32 additions & 0 deletions tests/Server/TextDocument/CompletionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,36 @@ public function testNamespace()
)
], true), $items);
}

public function testBarePhp()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/bare_php.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(4, 8)
)->wait();
$this->assertEquals(new CompletionList([
new CompletionItem(
'$abc2',
CompletionItemKind::VARIABLE,
'int',
null,
null,
null,
null,
new TextEdit(new Range(new Position(4, 8), new Position(4, 8)), 'c2')
),
new CompletionItem(
'$abc',
CompletionItemKind::VARIABLE,
'int',
null,
null,
null,
null,
new TextEdit(new Range(new Position(4, 8), new Position(4, 8)), 'c')
)
], true), $items);
}
}