1
0
Fork 0
Commit Graph

166 Commits (afd72156241c31c980334586925c76ea29655b9b)

Author SHA1 Message Date
Felix Becker bedd157636 Caching (#260) 2017-02-04 00:20:38 +01:00
Felix Becker d8823bc7dc Use JetBrains PHPStorm stubs from packagist (#264)
* Use JetBrains PHPStorm stubs from packagist

* Fix path
2017-01-30 11:55:13 +01:00
Felix Becker 96aa998486 Make Index an EventEmitter (#255) 2017-01-25 01:38:11 +01:00
Ivan Bozhanov 43a91b0d09 Handle hover for $this (#249) 2017-01-19 15:47:11 +01:00
Felix Becker d080c161a9 Don't crash if indexing fails 2017-01-13 12:06:58 -08:00
Felix Becker 106aa24b5d Implement global references protocol extension (#236) 2017-01-10 17:08:52 -08:00
Felix Becker 49245fd4d3 Allow overriding (#229)
* Add missing documentLoader property

* Make PhpDocumentLoader->contentRetriever public
2017-01-04 19:18:14 -08:00
Felix Becker 662143abad Fix wrong function call in DefinitionResolver 2016-12-24 16:35:20 +01:00
Felix Becker b93d4f33cb Fix stubs location 2016-12-20 13:53:15 +01:00
Felix Becker 710d2a7ff7 Fix autoloading in ComposerScripts 2016-12-20 13:44:01 +01:00
Felix Becker 2005518dfe Support find-all-references for namespaces (#221) 2016-12-17 03:46:08 +01:00
Felix Becker 83618fee2e Avoid multiple references with function calls (#220) 2016-12-16 23:42:47 +01:00
Felix Becker 2242a35678 Reset definitions and references on content update (#219) 2016-12-16 23:33:55 +01:00
Felix Becker a4a13e6528 Add support for inherited members (#218)
in completion, definition, references, hover etc
2016-12-16 01:40:17 +01:00
Felix Becker cc9d5e987b Fix wrong class name 2016-12-15 18:01:44 +01:00
Felix Becker 0b61951a9c Support hover for definitions
#201
2016-12-13 03:18:07 +01:00
Felix Becker 96ea8608d7 Support getting references from a reference
Closes #201
2016-12-13 02:53:01 +01:00
Felix Becker b8a113ddd0 Correct reference collection for New_ nodes
Closes #202
2016-12-13 02:40:51 +01:00
Felix Becker d90a88e625 Add missing property declaration 2016-12-13 02:13:57 +01:00
Felix Becker d7fc9e0425 Index twice to collect dynamic references (#206) 2016-12-13 02:11:29 +01:00
Felix Becker a7d77d844e Add Index classes and stubs (#214) 2016-12-13 01:51:02 +01:00
Felix Becker b9f9871156 Files finder (#209) 2016-12-08 02:33:48 +01:00
Felix Becker ebd1cc6133 Refactor content retrieval (#208) 2016-12-08 01:51:32 +01:00
Michal Niewrzal db6f4f7e5d Don't filter properties on typed prefix (#207) 2016-12-07 21:17:55 +01:00
Felix Becker 10fb3c92e0 Completion (#165)
* Add support for method/property completion

* Move completion fixtures into directory

* Add support for variable suggestions

Refactor logic into CompletionProvider class

* Allow getTypeFromNode() to take Variable nodes

* Use property and constant values

* Fix using @var tag for variables

* Improve completion

* classes
* variables with prefix filtering

* Make FQNs more distinct

* use -> for instance methods/properties
* use ::$ for static properties

* Add tests for static access

* Properly filter completion on empty property

* Fix existing tests

* Add support for static access without prefix

* Fix testFullyQualifiedClass

* Add missing fixtures

* Correct file number in init test

* Only insert backslash if not typed yet

* Completion for keywords and bug fixes

* Correct variable insertion

* Support completion for namespaces

* Use CompletionList

* Always set isIncomplete to true

* Update PHPCodeSniffer

* Remove unused method

* And the call

* Handle case where FQN could not be resolved
2016-11-30 22:23:51 +01:00
Felix Becker f56b14438b Shutdown when the socket is closed (#191) 2016-11-30 21:10:05 +01:00
Michal Niewrzal ea92b224cd Symbols throws error for empty php file (#187)
Closes #186
2016-11-29 13:10:02 +01:00
Michal Niewrzal e8ab8aa2b8 Make processId optional for initialization (#178) 2016-11-23 18:38:57 +01:00
Felix Becker 429114ff97 Handle group use declarations in DocBlockParser (#166) 2016-11-19 13:04:13 +01:00
Felix Becker 5213940064 Don't encode spaces to + 2016-11-19 12:25:52 +01:00
Felix Becker 8f6ee8dd02 Handle null return from getClosestNode() 2016-11-19 12:03:43 +01:00
Felix Becker 00bc8537a6 Support compound types when resolving FQNs 2016-11-19 11:45:25 +01:00
Felix Becker fb84741d55 Add missing property 2016-11-19 06:37:07 +01:00
Felix Becker c2ae7cd022 FIx crashes when tag doesn't have a type 2016-11-19 06:36:57 +01:00
Felix Becker 33211c68ca Resolve expressions recursively (#155)
* Add Definition class
* Add recursive DefinitionResolver
* Cache hover
2016-11-18 15:22:24 +01:00
Michal Niewrzal 50490d51ea Fix formatting makes LS non-responsive (#153) 2016-11-18 14:25:05 +01:00
Felix Becker 12df6a7dd6 Add size limit back (#161) 2016-11-18 13:24:26 +01:00
Felix Becker 32b01afa90 Index files serially again (#157) 2016-11-17 22:20:37 +01:00
Felix Becker 642425dede Ignore errors from dependencies (#147) 2016-11-14 20:00:10 +01:00
Felix Becker 03bbf5f4ba Enable LS to operate without accessing the file system (#136)
This PR decouples the LS from direct file system access by implementing the proposals for workspace/files and textDocument/content under workspace/xfiles and textDocument/xcontent. The requests are only used when the client expressed support for them through ClientCapabilities, otherwise direct FS access is used.
This turns document content retrieval and recursive file search into async operations.
In turn, all server handlers can now operate async by returning a promise.
2016-11-14 10:25:44 +01:00
Felix Becker 25f300c157 Add test for indexing 2016-11-07 11:52:24 +01:00
Felix Becker 47472252a7 Encode spaces in paths to %20 instead of + (#140) 2016-11-07 10:24:49 +01:00
Felix Becker 04ef6c8adf Handle Client responses (#128) 2016-10-31 11:47:21 +01:00
Felix Becker 18e58b4ce8 Update php-parser to latest commit (#119) 2016-10-26 22:25:24 +02:00
Felix Becker ed41df0062 Remove caching for now (#118) 2016-10-26 21:35:57 +02:00
Michal Niewrzal 867196babf Definition for instanceof class (#117) 2016-10-26 20:56:02 +02:00
Michal Niewrzal 8a354ba1af Definition for use function (#116) 2016-10-26 11:47:02 +02:00
Stephan Unverwerth 6806ba94e0 Async ProtocolStreamWriter (#112) 2016-10-25 23:50:36 +02:00
Felix Becker cd3bf18fe2 Revert "Handle closed input or output stream (#110)"
This reverts commit 83afa0c1b8.
2016-10-24 23:20:15 +02:00
ADmad 5ecab683eb Linting (#107)
* Update travis config.
* Add phpcs config file.
* Exclude rules
* Ignore failures in tests
* Automatic fixes
* Inline ParsingMode enum as class constants
* Loosen FormatTest because of excluded rule
2016-10-24 19:35:37 +02:00
Kaloyan Raev 83afa0c1b8 Handle closed input or output stream (#110) 2016-10-24 13:46:39 +02:00
Michal Niewrzal a19d225a7a Fix definition for method return type (#76) 2016-10-21 16:51:11 +02:00
Felix Becker b16674d394 Improve logging 2016-10-20 16:46:34 +02:00
Felix Becker b9222b0fd1 Switch to serialize() instead of JSON (#104) 2016-10-20 04:31:07 +02:00
Felix Becker 1e7260a2ea Cache index on disk (#82) 2016-10-20 03:48:30 +02:00
Felix Becker 8e36e59e9a Fix crash 2016-10-20 03:36:17 +02:00
Felix Becker 953a8023b7 Update AdvancedJsonRpc (#103) 2016-10-20 03:31:12 +02:00
Felix Becker f8733c741c Remove PhpParser workaround (#102) 2016-10-20 02:13:15 +02:00
Felix Becker 1e00275e02 Hold SymbolInformation table in memory (#101) 2016-10-20 02:08:23 +02:00
Felix Becker 9cbca1cd7f Revert "Use SymbolKind::FIELD for class fields (#78)"
This reverts commit 2980941fd1.
2016-10-20 01:53:07 +02:00
Felix Becker 96694996f7 Refactor FQN functions to own namespace (#100) 2016-10-20 01:00:20 +02:00
Felix Becker e993b9994a Remove unneeded argument to ReferencesCollector 2016-10-20 00:20:30 +02:00
Felix Becker e19670c141 Resolve self, static, parent (#99) 2016-10-20 00:18:36 +02:00
Felix Becker 6bd1b10e4d Resolve $this (#98) 2016-10-20 00:10:47 +02:00
Felix Becker 44445e3af4 Remove old definition/references after reparse (#88) 2016-10-19 13:33:43 +02:00
Felix Becker 7668a0c695 Catch parse error in indexing (#83) 2016-10-19 12:41:53 +02:00
Felix Becker 4db7ffd88c Hover (#50)
* Add hover support

* Use context in DocBlockParser

* Improve DocBlockParser error handling

* Improve hover output

* Add more tests
2016-10-19 12:31:32 +02:00
Felix Becker 6b6ec8c105 Symbol test refactor (#92)
* Don't use json_decode in symbol tests

* Remove custom setUp()

* Use getDefinitionLocation()

* TextDocumentTestCase -> ServerTestCase

* Refactor Workspace\SymbolTest
2016-10-18 23:09:51 +02:00
Michal Niewrzal cba4357856 Fix file name for CompletionItemKind (#85) 2016-10-17 10:17:18 +02:00
Felix Becker 1e6917ef55 Add size limit of 0.5MB for indexing (#80) 2016-10-14 09:06:56 +02:00
Felix Becker 2980941fd1 Use SymbolKind::FIELD for class fields (#78) 2016-10-14 09:02:42 +02:00
Felix Becker c479969758 Add support for definition of static class access (#72)
Getting the definition of TestClass in
TestClass::staticTestMethod();
echo TestClass::$staticTestProperty;
echo TestClass::TEST_CLASS_CONST;
2016-10-12 12:40:13 +02:00
Felix Becker 6fe01183b0 References (#52)
* Adds support for textDocument/references
* Adds tests for global definitions and global fallback
2016-10-12 01:45:15 +02:00
Felix Becker 66b5176a43 Allow %-encoded colon after drive letter in URI 2016-10-12 00:53:21 +02:00
Michal Niewrzal c667f83371 Remove unused use statements (#67) 2016-10-11 16:23:09 +02:00
Felix Becker 15e004fb9b Only hold AST for open files in memory (#63)
* Only hold content for open files in memory

* Add test for didClose

* Remove invalid URI formatting test

* Don't keep AST in memory

* Fix symbol search crash

* Change Project map to FQN => URI

Removes PhpDocument::load(), isLoaded(), unload()

* Add docblocks

* Rename some functions

* Extend documentation

* Correct docblock
2016-10-11 14:42:56 +02:00
Kaloyan Raev d41cde2039 Return empty array instead of null for empty definitions result (#64) 2016-10-11 10:26:46 +02:00
Kaloyan Raev 1f808c59e1 Fixes #59: Handle correctly negative endLine in PHP Parser errors (#62)
* Fixes #59: Handle correctly negative endLine in PHP Parser errors

* Clearer $startLine calculation

* Add missing test file

* Better calculation of endLine

* Remove trailing spaces
2016-10-11 10:15:20 +02:00
Michal Niewrzal e75c1592fc Use PHP_CodeSniffer as a formatter (#35)
Also adds uriTopath util function
2016-10-10 15:06:02 +02:00
Felix Becker 03e4e34a4e Don't %-decode the document URI 2016-10-09 19:09:28 +02:00
Felix Becker aff9edb630 Don't crash on array assignments 2016-10-09 19:06:46 +02:00
Felix Becker 1689e4d0dc Extend symbol search tests 2016-10-09 16:37:17 +02:00
Felix Becker 0387f28759 Rename NodeVisitors NS to NodeVisitor 2016-10-09 16:03:56 +02:00
Felix Becker 7f95b76cf8 Refactor DefinitionResolver
Move logic to PhpDocument::getDefininedFqn() for reusability
Fix DefinitionResolverTest
2016-10-09 15:58:39 +02:00
Felix Becker 7322a6c658 Add fromNode() factories and correct columns 2016-10-09 15:58:39 +02:00
Felix Becker 3a880934e5 Split up PhpDocument::getDefinitionByNode() 2016-10-09 15:58:39 +02:00
Felix Becker 6be53ad658 Use DefinitionCollector for symbol requests 2016-10-09 15:58:39 +02:00
Felix Becker d4757e0a24 Add textDocument/definition support 2016-10-09 15:58:39 +02:00
Felix Becker 827ab4c842 Add Position::compare() and Range::includes() 2016-10-09 15:51:42 +02:00
Felix Becker fbdf1aa414 Add ownerDocument attribute to nodes 2016-10-09 15:51:42 +02:00
Felix Becker 48c71e5bc1 Add method to find out node at position
Keep AST in memory
2016-10-09 15:51:42 +02:00
Felix Becker 4786fe173c Decorate all nodes with parent, sibling references 2016-10-08 15:18:31 +02:00
Felix Becker 658a27f5a5 Add more symbols to symbol test
* constants
* static properties
* static methods
2016-10-08 15:02:04 +02:00
Felix Becker 063c7f9ad2 Move NodeVisitors to own namespace 2016-10-08 15:01:58 +02:00
Felix Becker 6cb916e28d Improve inline documentation and code style 2016-10-08 13:45:10 +02:00
Stephan Unverwerth 0c758ec815 Fix issue #42 and add regression test (#43) 2016-09-30 15:13:54 +02:00
Felix Becker 6917f1c789 Add more declare(strict_types = 1) (#39) 2016-09-30 11:54:49 +02:00
Stephan Unverwerth 501d26e1d4 Global symbol search (#31)
* Implemented workspace symbol search

* Fixed missing TextEdit using declaration

* Fixed generating uri when parsing next file.

* Cleaned up code. Fixed tests

* Fixed PHPDoc for LanguageServer::initialize()

* Moved utility functions to utils.php

* Added tests for pathToUri and findFilesRecursive

* Added command line argument for socket communication

* Fixed local variable detection and containerName generation in SymbolFinder

* Fixed formatting in ProtocolStreamReader

* Store text content in PHPDocument, removed stmts, regenerate on demand

* Fixed local variable detection and containerName generation in SymbolFinder.

* Added Tests for Project and Workspace

* Added test for didChange event

* Modified lexer error handling

* Removed file that shouldn't have been committed.

* Updated sabre/event dependency to 4.0.0

* Updated readme.md to show tcp option

* make input stream non-blocking

* Correct code style

* Use triple equals

* Revert change in SymbolFinder

* Optimize processFile() a bit

* Use MessageType enum instead of number literal

* Add missing space

* Fixed ProtocolStreamWriter for nonblocking connection.

* Suppress fwrite() notice when not all bytes could be written.

* Fix another code style issue

* Throw Exceotion instead of Error

* Added ProtocolStreamWriter test

* Correct workspace/symbol documentation

* Improve exception in ProtocolStreamWriter::write()
2016-09-30 11:30:08 +02:00
Kaloyan Raev 817056270e Shift end position in SymbolInformation ranges (#28)
Fixes #27
2016-09-14 09:45:24 +02:00
Levan Gabeskiria 4d5052bebd Exclude variable symbols (#16) 2016-09-09 19:57:28 +02:00