Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete speedup vol. 2 - finishing #680

Merged
merged 48 commits into from
Nov 11, 2018
Merged

Autocomplete speedup vol. 2 - finishing #680

merged 48 commits into from
Nov 11, 2018

Conversation

MichaelBelgium
Copy link
Contributor

Finishing #599 by merging master and fixing the conflicts. Although I wasn't sure which side to pick while merging, I assumed the side of autocomplet-speedup.

closes #274
closes #599

@felixfbecker felixfbecker self-requested a review November 6, 2018 21:37
@felixfbecker felixfbecker self-assigned this Nov 6, 2018
@felixfbecker
Copy link
Owner

@MichaelBelgium unfortunately tests are failing (they passed on the old PR):

Error: Call to undefined method LanguageServerProtocol\CompletionItem::fromDefinition()

This function was moved to a different class: https://github.com/felixfbecker/php-language-server/blob/master/src/Factory/CompletionItemFactory.php

@codecov
Copy link

codecov bot commented Nov 10, 2018

Codecov Report

Merging #680 into master will increase coverage by 0.33%.
The diff coverage is 90.71%.

@@             Coverage Diff              @@
##             master     #680      +/-   ##
============================================
+ Coverage     81.83%   82.16%   +0.33%     
- Complexity      883      921      +38     
============================================
  Files            44       44              
  Lines          1993     2148     +155     
============================================
+ Hits           1631     1765     +134     
- Misses          362      383      +21
Impacted Files Coverage Δ Complexity Δ
src/DefinitionResolver.php 87.39% <100%> (+0.06%) 331 <0> (+1) ⬆️
src/Server/TextDocument.php 75.55% <100%> (+0.18%) 57 <0> (+1) ⬆️
src/Index/AbstractAggregateIndex.php 86.04% <71.42%> (-7.44%) 26 <6> (ø)
src/Index/Index.php 77.41% <82.5%> (+7.6%) 54 <32> (+32) ⬆️
src/FqnUtilities.php 83.87% <90.47%> (+13.87%) 0 <0> (ø) ⬇️
src/CompletionProvider.php 94.24% <96.69%> (-0.27%) 112 <73> (+4)

@MichaelBelgium
Copy link
Contributor Author

@MichaelBelgium unfortunately tests are failing (they passed on the old PR):

Error: Call to undefined method LanguageServerProtocol\CompletionItem::fromDefinition()

This function was moved to a different class: https://github.com/felixfbecker/php-language-server/blob/master/src/Factory/CompletionItemFactory.php

Fixed 👌

@felixfbecker
Copy link
Owner

I found a crash when running the language server on this project:

CRITICAL  Error: Cannot use object of type LanguageServer\Definition as array in /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php:382
Stack trace:
#0 /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php(386): LanguageServer\Index\Index->getIndexValue(Array, Object(LanguageServer\Definition))
#1 /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php(151): LanguageServer\Index\Index->getIndexValue(Array, Array)
#2 /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/AbstractAggregateIndex.php(137): LanguageServer\Index\Index->getDefinition('->assertSession...', false)
#3 /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/AbstractAggregateIndex.php(137): LanguageServer\Index\AbstractAggregateIndex->getDefinition('->assertSession...', false)
#4 /Users/felix/src/github.com/felixfbecker/php-language-server/src/DefinitionResolver.php(772): LanguageServer\Index\AbstractAggregateIndex->getDefinition('->assertSession...')
#5 /Users/felix/src/github.com/felixfbecker/php-language-server/src/DefinitionResolver.php(739): LanguageServer\DefinitionResolver->resolveExpressionNodeToType(Object(Microsoft\PhpParser\Node\Expression\MemberAccessExpression))
#6 /Users/felix/src/github.com/felixfbecker/php-language-server/src/DefinitionResolver.php(404): LanguageServer\DefinitionResolver->resolveExpressionNodeToType(Object(Microsoft\PhpParser\Node\Expression\CallExpression))
#7 /Users/felix/src/github.com/felixfbecker/php-language-server/src/DefinitionResolver.php(331): LanguageServer\DefinitionResolver->resolveMemberAccessExpressionNodeToFqn(Object(Microsoft\PhpParser\Node\Expression\MemberAccessExpression))
#8 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(175): LanguageServer\DefinitionResolver->resolveReferenceNodeToFqn(Object(Microsoft\PhpParser\Node\Expression\MemberAccessExpression))
#9 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(124): LanguageServer\TreeAnalyzer->collectDefinitionsAndReferences(Object(Microsoft\PhpParser\Node\Expression\MemberAccessExpression))
#10 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(140): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\Expression\MemberAccessExpression))
#11 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(140): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\Expression\CallExpression))
#12 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(136): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement))
#13 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(140): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\Statement\CompoundStatementNode))
#14 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(136): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\MethodDeclaration))
#15 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(140): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\TraitMembers))
#16 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(136): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\Statement\TraitDeclaration))
#17 /Users/felix/src/github.com/felixfbecker/php-language-server/src/TreeAnalyzer.php(58): LanguageServer\TreeAnalyzer->traverse(Object(Microsoft\PhpParser\Node\SourceFileNode))
#18 /Users/felix/src/github.com/felixfbecker/php-language-server/src/PhpDocument.php(147): LanguageServer\TreeAnalyzer->__construct(Object(Microsoft\PhpParser\Parser), '<?php\n\nnamespac...', Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver), 'file:///Users/f...')
#19 /Users/felix/src/github.com/felixfbecker/php-language-server/src/PhpDocument.php(105): LanguageServer\PhpDocument->updateContent('<?php\n\nnamespac...')
#20 /Users/felix/src/github.com/felixfbecker/php-language-server/src/PhpDocumentLoader.php(141): LanguageServer\PhpDocument->__construct('file:///Users/f...', '<?php\n\nnamespac...', Object(LanguageServer\Index\Index), Object(Microsoft\PhpParser\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#21 /Users/felix/src/github.com/felixfbecker/php-language-server/src/PhpDocumentLoader.php(120): LanguageServer\PhpDocumentLoader->create('file:///Users/f...', '<?php\n\nnamespac...')
#22 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer\{closure}()
#23 /Users/felix/src/github.com/felixfbecker/php-language-server/vendor/sabre/event/lib/coroutine.php(70): Generator->send('<?php\n\nnamespac...')
#24 /Users/felix/src/github.com/felixfbecker/php-language-server/vendor/sabre/event/lib/Promise.php(242): Sabre\Event\{closure}('<?php\n\nnamespac...')
#25 /Users/felix/src/github.com/felixfbecker/php-language-server/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#26 /Users/felix/src/github.com/felixfbecker/php-language-server/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#27 /Users/felix/src/github.com/felixfbecker/php-language-server/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#28 /Users/felix/src/github.com/felixfbecker/php-language-server/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#29 /Users/felix/src/github.com/felixfbecker/php-language-server/bin/php-language-server.php(55): Sabre\Event\Loop\run()
#30 {main}

It crashes when indexing validation/frameworks/drupal/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php.

@felixfbecker
Copy link
Owner

Here's another crash that happens when running ./benchmarks/parsing.php:

Fatal error: Uncaught TypeError: Argument 3 passed to LanguageServer\Index\Index::indexDefinition() must be of the type array, object given, called in /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php on line 412 and defined in /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php:398
Stack trace:
#0 /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php(412): LanguageServer\Index\Index->indexDefinition(1, Array, Object(LanguageServer\Definition), Object(LanguageServer\Definition))
#1 /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php(175): LanguageServer\Index\Index->indexDefinition(0, Array, Array, Object(LanguageServer\Definition))
#2 /Users/felix/src/github.com/felixfbecker/php-language-server/src/PhpDocument.php(158): LanguageServer\Index\Index->setDefinition('->A()', Object(LanguageServer\Definition))
#3 /Users/felix/src/github.com/felixfbecker/php-language-server/src/PhpDocument.php(105): LanguageServer in /Users/felix/src/github.com/felixfbecker/php-language-server/src/Index/Index.php on line 398

@felixfbecker
Copy link
Owner

felixfbecker commented Nov 11, 2018

cc @Declspeck @nicolasmure

@felixfbecker felixfbecker merged commit 24388bc into felixfbecker:master Nov 11, 2018
@felixfbecker
Copy link
Owner

🎉 This PR is included in version 5.4.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@MichaelBelgium MichaelBelgium deleted the autocomplet-speedup branch November 11, 2018 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intellisense slow on 5k files
4 participants