Skip to content

Commit

Permalink
Merge pull request felixfbecker#1 from kaloyan-raev/keyword_completion
Browse files Browse the repository at this point in the history
Completion Request should return CompletionList
  • Loading branch information
Michal Niewrzal authored Sep 13, 2016
2 parents 5d85e4d + 07914c9 commit b72c6c0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Server/TextDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
FormattingOptions,
TextEdit,
CompletionItem,
CompletionItemKind
CompletionItemKind,
CompletionList
};
use LanguageServer\Server\Completion\PHPKeywords;

Expand Down Expand Up @@ -166,17 +167,19 @@ public function formatting(TextDocumentIdentifier $textDocument, FormattingOptio

public function completion(TextDocumentIdentifier $textDocument, Position $position)
{
$items = [];
$list = new CompletionList();
$list->isIncomplete = false;
$list->items = [];
$keywords = new PHPKeywords();
foreach ($keywords->getKeywords() as $keyword){
$item = new CompletionItem();
$item->label = $keyword->getLabel();
$item->kind = CompletionItemKind::KEYWORD;
$item->insertText = $keyword->getInsertText();
$item->detail = "PHP Language Server";
$items[] = $item;
$list->items[] = $item;
}
return $items;
return $list;
}

}

0 comments on commit b72c6c0

Please sign in to comment.