Skip to content

Conversation

@felixfbecker
Copy link
Owner

Closes #239
This changes the whole indexing process to be async again. The Index is now an EventEmitter that emits two events:

  • definition-added when a Definition was added
  • complete when the indexing has completed (triggered through setComplete())

isCompete() returns the current status.

All methods that return multiple results that depend on the project index (workspace/symbols, textDocument/references, workspace/xreferences) now defer the response until indexing finished.

All methods that need to resolve a single definition (textDocument/(x)definition, textDocument/hover) check the index for a result, then if no result was found and indexing did not finish yet, check again on every added definition.

Since LanguageServer::index is now executed async, adds new beforeIndex hook.

@codecov-io
Copy link

codecov-io commented Jan 24, 2017

Current coverage is 88.59% (diff: 95.65%)

Merging #255 into master will increase coverage by 1.14%

@@             master       #255   diff @@
==========================================
  Files            49         51     +2   
  Lines          1251       1412   +161   
  Methods         132        152    +20   
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           1094       1251   +157   
- Misses          157        161     +4   
  Partials          0          0          
Diff Coverage File Path
0% src/Index/DependenciesIndex.php
•••••••••• 100% src/Index/ProjectIndex.php
•••••••••• 100% src/Index/GlobalIndex.php
•••••••••• 100% src/ComposerScripts.php
•••••••••• 100% src/utils.php
•••••••••• 100% src/Index/AbstractAggregateIndex.php
•••••••••• 100% src/Server/Workspace.php
•••••••••• 100% src/Server/TextDocument.php
•••••••••• 100% src/Index/Index.php

Powered by Codecov. Last update 43a91b0...a296c7c

* @return void
*/
public function setStaticComplete()
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticComplete

$symbols[] = $definition->symbolInformation;
return coroutine(function () use ($query) {
// Wait until indexing for definitions finished
if (!$this->index->isComplete()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isStaticComplete?

@felixfbecker felixfbecker merged commit 96aa998 into master Jan 25, 2017
@felixfbecker felixfbecker deleted the evented-index branch January 25, 2017 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make indexing more evented

4 participants