|
4 | 4 | namespace LanguageServer; |
5 | 5 |
|
6 | 6 | use LanguageServer\Index\ReadableIndex; |
7 | | -use LanguageServer\Protocol\{ |
| 7 | +use LanguageServer\Factory\CompletionItemFactory; |
| 8 | +use LanguageServerProtocol\{ |
8 | 9 | TextEdit, |
9 | 10 | Range, |
10 | 11 | Position, |
@@ -246,7 +247,7 @@ public function provideCompletion(PhpDocument $doc, Position $pos, CompletionCon |
246 | 247 | foreach ($this->index->getDefinitions() as $fqn => $def) { |
247 | 248 | foreach ($prefixes as $prefix) { |
248 | 249 | if (substr($fqn, 0, strlen($prefix)) === $prefix && $def->isMember) { |
249 | | - $list->items[] = CompletionItem::fromDefinition($def); |
| 250 | + $list->items[] = CompletionItemFactory::fromDefinition($def); |
250 | 251 | } |
251 | 252 | } |
252 | 253 | } |
@@ -279,7 +280,7 @@ public function provideCompletion(PhpDocument $doc, Position $pos, CompletionCon |
279 | 280 | foreach ($this->index->getDefinitions() as $fqn => $def) { |
280 | 281 | foreach ($prefixes as $prefix) { |
281 | 282 | if (substr(strtolower($fqn), 0, strlen($prefix)) === strtolower($prefix) && $def->isMember) { |
282 | | - $list->items[] = CompletionItem::fromDefinition($def); |
| 283 | + $list->items[] = CompletionItemFactory::fromDefinition($def); |
283 | 284 | } |
284 | 285 | } |
285 | 286 | } |
@@ -337,7 +338,7 @@ public function provideCompletion(PhpDocument $doc, Position $pos, CompletionCon |
337 | 338 | foreach ($aliases as $alias => $fqn) { |
338 | 339 | // Suggest symbols that have been `use`d and match the prefix |
339 | 340 | if (substr($alias, 0, $prefixLen) === $prefix && ($def = $this->index->getDefinition($fqn))) { |
340 | | - $list->items[] = CompletionItem::fromDefinition($def); |
| 341 | + $list->items[] = CompletionItemFactory::fromDefinition($def); |
341 | 342 | } |
342 | 343 | } |
343 | 344 | } |
@@ -370,7 +371,7 @@ public function provideCompletion(PhpDocument $doc, Position $pos, CompletionCon |
370 | 371 | // Only suggest classes for `new` |
371 | 372 | && (!isset($creation) || $def->canBeInstantiated) |
372 | 373 | ) { |
373 | | - $item = CompletionItem::fromDefinition($def); |
| 374 | + $item = CompletionItemFactory::fromDefinition($def); |
374 | 375 | // Find the shortest name to reference the symbol |
375 | 376 | if ($namespaceNode && ($alias = array_search($fqn, $aliases, true)) !== false) { |
376 | 377 | // $alias is the name under which this definition is aliased in the current namespace |
|
0 commit comments