padawan-php / padawan.php Goto Github PK
View Code? Open in Web Editor NEWphp intelligent code completion http server
Home Page: http://mkusher.name/padawan/
License: MIT License
php intelligent code completion http server
Home Page: http://mkusher.name/padawan/
License: MIT License
When I have class with namespace like this:
<?php
namespace My\Name\Space;
class MyClass {
public function testFunction() {
new DateTi //case 1
new \DateTi //case 2
}
}
For case one padawan is giving suggestions when pointing on 9th column (D letter), but for the case 2 when pointing at 10th column (D letter as in case 1).
Is that how it should be?
I'm not even sure if the case 1 should be suggested as the code is invalid (it's creating My\Name\Space\DateTi...
. For the second case, shouldn't completion work when pointing at backslash (as it is part of the class name)?
Maybe missing GenerateCommand.php file in git? Doesn't look like its in the Command directory at all, and its being referenced via Framework\Application\Cli.php on commit f030bea
Padawan could not generate index for Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass
This issue is used to announce API changes.
I know it's not your library and you just use it here, but maybe you know whether new version of that library ( after you told me to use dev-master ) or something else, makes the line
$countries = $this->country ?: ['US'] + array_keys(\CountryState::getCountries());
to throw an error in padawan-server
exception 'PhpParser\Error' with message 'Syntax error, unexpected T_STRING on line 52'
Doesn't generate successful index (haven't had an updated index since March 31st :()
Looks like some syntax error:
[2016-05-06 10:00:41] completer.ERROR: Parsing failed in file /home/michael/work/colorescience/vendor/symfony/symfony/src/Symfony/Component/VarDumper/Tests/Fixtures/G[5/1924]
Demo.php [] []
[2016-05-06 10:00:41] completer.ERROR: exception 'PhpParser\Error' with message 'Syntax error, unexpected T_STRING, expecting ';' on line 14' in /home/michael/.composer/vendo
r/nikic/php-parser/lib/PhpParser/ParserAbstract.php:275 Stack trace: #0 /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Parser/Parser.php(57): PhpParser\ParserAbst
ract->parse('<?php\n\nnamespac...') #1 /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Parser/Parser.php(36): Padawan\Parser\Parser->parseContent('/home/michael/w.
..', '<?php\n\nnamespac...', NULL, false) #2 /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php(103): Padawan\Parser\Parser->pa
rseFile('vendor/symfony/...', NULL, false) #3 /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php(92): Padawan\Framework\Generat
or\IndexGenerator->createScopeForFile('vendor/symfony/...', Object(Padawan\Domain\Core\Index), false) #4 /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/
Generator/IndexGenerator.php(65): Padawan\Framework\Generator\IndexGenerator->processFile(Object(Padawan\Domain\Core\Index), 'vendor/symfony/...', false, false) #5 /home/mich
ael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php(47): Padawan\Framework\Generator\IndexGenerator->generateProjectIndex(Object(Padawan\D
omain\Core\Project)) #6 /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Command/GenerateCommand.php(39): Padawan\Framework\Generator\IndexGenerator->generateIndex(
Object(Padawan\Domain\Core\Project)) #7 /home/michael/.composer/vendor/symfony/console/Command/Command.php(259): Padawan\Command\GenerateCommand->execute(Object(Symfony\Compo
nent\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /home/michael/.composer/vendor/symfony/console/Application.php(844): Symfony\Compone
nt\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /home/michael/.composer/vendor/s
ymfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(Padawan\Command\GenerateCommand), Object(Symfony\Component\Console\Input\ArgvI
nput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /home/michael/.composer/vendor/symfony/console/Application.php(123): Symfony\Component\Console\Application-
>doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /home/michael/.composer/vendor/mkusher/padawan/bin/padaw
an(26): Symfony\Component\Console\Application->run() #12 {main} [] []
Installing zendframework/zend-stdlib (2.4.0)
Cloning eab586f4c18af3fa63c977611939f1f4a3cf1030
[RuntimeException]
Failed to clone [email protected]:zendframework/Component_ZendStdlib.git via git, https, ssh protocols, aborting.
git://github.com/zendframework/Component_ZendStdlib.git
Cloning into '/tmp/padawan.php/vendor/zendframework/zend-stdlib'...
fatal: remote error:
Repository not found.
https://github.com/zendframework/Component_ZendStdlib.git
Cloning into '/tmp/padawan.php/vendor/zendframework/zend-stdlib'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/zendframework/Component_ZendStdlib.git/'
[email protected]:zendframework/Component_ZendStdlib.git
Cloning into '/tmp/padawan.php/vendor/zendframework/zend-stdlib'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
This is somehow strange. Sometimes padawan is not responding to request at all. There is also no log message. Padawan is still up and running as a request in another file will work all right.
I can reproduce it with Laravel project.
composer global require laravel/installer
laravel new test
vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php
Sometimes the server is responding, and when it does its quite fast response. I've tried it with the netcat, and it worked few times, but usually its just silent. I think it is related to #13.
https://travis-ci.org/mkusher/padawan.php/jobs/69518081 should look through it and fix then
The recommended installation method is too use composer global install
. This failed on my machine, because of a conflict with other global packages. I ended up using composer create-project
to work this around, which gives me an independent project, with its packages. It would be great to provide a self-updating phar, like Composer does, for instance.
Hi,
I'm trying to use Padawan for the first time but having issues with running the server. I'm using Neovim with the padawan.vim (with Symfony2 padawan plugin) and deoplete-padawan plugins. I can successfully generate an index for my composer project (both from within Neovim and from the command line) but when I try to use the autocompletion I get a 'Pattern not found' error along with a 'Padawan.php is not running' message in :messages. :PadawanStartServer doesn't have any effect in Neovim and at the command line, running padawan-server gives the following error:
PHP Parse error: syntax error, unexpected 'loadRequestData' (T_STRING) in /Users/gary/.composer/vendor/mkusher/padawan/bin/padawan-server on line 51
Any ideas where I can start looking with this?
Kill command should return valid http response with 200 status
nikic/php-parser has had a ~2.0 release since December 2015. It adds support for PHP 7 amongst other things. It would be a good idea to upgrade.
I also can't use padawan at all until then as I already have something installed requiring 2.0.
When I try to index a Drupal project, it ends with an error reaching the 9000 limit.
These are the last lines in the log:
[2016-11-30 21:28:10] completer.DEBUG: Processing node Symfony\Comp[44978/48629]
er\Tests\CliDumperTest [] []
[2016-11-30 21:28:10] completer.DEBUG: Indexing: [0.061321973800659]s [] []
[2016-11-30 21:28:10] completer.DEBUG: Memory: 331009504 [] []
[2016-11-30 21:28:10] completer.INFO: Progress: 49% [] []
[2016-11-30 21:28:10] completer.INFO: processing vendor/symfony/var-dumper/Tests
/Fixtures/GeneratorDemo.php [] []
[2016-11-30 21:28:10] completer.DEBUG: Cache status: disabled [] []
[2016-11-30 21:28:10] completer.ERROR: Parsing failed in file /Users/rob/Sites/c
lients/go-intranet/vendor/symfony/var-dumper/Tests/Fixtures/GeneratorDemo.php [
] []
[2016-11-30 21:28:10] completer.INFO: Parsing: [0.0058910846710205]s [] []
[2016-11-30 21:28:10] completer.DEBUG: Processing nodes 0 [] []
[2016-11-30 21:28:10] completer.DEBUG: Indexing: [0.0069289207458496]s [] []
[2016-11-30 21:28:10] completer.DEBUG: Memory: 329638216 [] []
[2016-11-30 21:28:10] completer.INFO: Progress: 49% [] []
[2016-11-30 21:28:10] completer.INFO: processing vendor/symfony/var-dumper/Tests
/Fixtures/NotLoadableClass.php [] []
[2016-11-30 21:28:10] completer.DEBUG: Cache status: disabled [] []
[2016-11-30 21:28:10] completer.INFO: Traversing with 2 processors [] []
[2016-11-30 21:28:10] completer.INFO: Found 4 nodes [] []
[2016-11-30 21:28:10] completer.INFO: Parsing: [0.0022628307342529]s [] []
[2016-11-30 21:28:10] completer.DEBUG: Processing nodes 4 [] []
[2016-11-30 21:28:10] completer.DEBUG: Processing node Symfony\Component\VarDump
er\Tests\Fixtures\NotLoadableClass [] []
PHP Fatal error: Maximum function nesting level of '9000' reached, aborting! in
/Users/rob/Sites/other/padawan/vendor/mkusher/padawan/src/Entity/Collection/Spe
cification.php on line 50
PHP Stack trace:
PHP 1. {main}() /Users/rob/Sites/other/padawan/vendor/mkusher/padawan/bin/pada
wan:0
PHP 2. Application\CLI\App->handle() /Users/rob/Sites/other/padawan/vendor/mku
sher/padawan/bin/padawan:27
PHP 3. Application\BaseApplication->handle() /Users/rob/Sites/other/padawan/ve
ndor/mkusher/padawan/src/Application/CLI/App.php:16
This happens using padawan generate or :padawangenerate
Especially for quite complex framework like symfony, it makes the doc given in autocompletion less useful :)
I was struggling to get Padawan working in Vim, until I realised that the server itself doesn't seem to be starting correctly. I ran it by hand instead, and told Vim to generate the index, and it got to 5%, jumped to 100%, said "completed" but crashed the server with the following stack trace:
โ code git:(feature/567736-dynamic-module-base) โ padawan-server
Started http server on 127.0.0.1:15155
POST /kill
PHP Fatal error: Call to undefined method Command\KillCommand::getContainer() in /Users/josh/.composer/vendor/mkusher/padawan/src/Application/BaseApplication.php on line 31
PHP Stack trace:
PHP 1. {main}() /Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:0
PHP 2. React\EventLoop\StreamSelectLoop->run() /Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:85
PHP 3. React\EventLoop\StreamSelectLoop->waitForStreamActivity() /Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:201
PHP 4. call_user_func:{/Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:227}() /Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:227
PHP 5. React\Socket\Connection->handleData() /Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:227
PHP 6. Evenement\EventEmitter->emit() /Users/josh/.composer/vendor/react/socket/src/Connection.php:15
PHP 7. call_user_func_array:{/Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
PHP 8. React\Http\RequestHeaderParser->feed() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
PHP 9. Evenement\EventEmitter->emit() /Users/josh/.composer/vendor/react/http/src/RequestHeaderParser.php:30
PHP 10. call_user_func_array:{/Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
PHP 11. React\Http\Server->React\Http\{closure}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
PHP 12. React\Http\Server->handleRequest() /Users/josh/.composer/vendor/react/http/src/Server.php:28
PHP 13. Evenement\EventEmitter->emit() /Users/josh/.composer/vendor/react/http/src/Server.php:61
PHP 14. call_user_func_array:{/Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
PHP 15. {closure:/Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:59-72}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
PHP 16. Application\HTTP\App->handle() /Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:69
PHP 17. Application\BaseApplication->handle() /Users/josh/.composer/vendor/mkusher/padawan/src/Application/HTTP/App.php:23
Fatal error: Call to undefined method Command\KillCommand::getContainer() in /Users/josh/.composer/vendor/mkusher/padawan/src/Application/BaseApplication.php on line 31
Call Stack:
0.0003 260712 1. {main}() /Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:0
0.0274 2505000 2. React\EventLoop\StreamSelectLoop->run() /Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:85
17.6232 2648584 3. React\EventLoop\StreamSelectLoop->waitForStreamActivity() /Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:201
17.6232 2649120 4. call_user_func:{/Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:227}() /Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:227
17.6232 2649256 5. React\Socket\Connection->handleData() /Users/josh/.composer/vendor/react/event-loop/StreamSelectLoop.php:227
17.6233 2653904 6. Evenement\EventEmitter->emit() /Users/josh/.composer/vendor/react/socket/src/Connection.php:15
17.6233 2654000 7. call_user_func_array:{/Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
17.6233 2654640 8. React\Http\RequestHeaderParser->feed() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
17.6252 2910272 9. Evenement\EventEmitter->emit() /Users/josh/.composer/vendor/react/http/src/RequestHeaderParser.php:30
17.6252 2910368 10. call_user_func_array:{/Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
17.6252 2910936 11. React\Http\Server->React\Http\{closure}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
17.6252 2911224 12. React\Http\Server->handleRequest() /Users/josh/.composer/vendor/react/http/src/Server.php:28
17.6255 2952600 13. Evenement\EventEmitter->emit() /Users/josh/.composer/vendor/react/http/src/Server.php:61
17.6255 2952696 14. call_user_func_array:{/Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
17.6255 2953184 15. {closure:/Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:59-72}() /Users/josh/.composer/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
17.6255 2953272 16. Application\HTTP\App->handle() /Users/josh/.composer/vendor/mkusher/padawan/bin/padawan-server:69
17.6256 2953480 17. Application\BaseApplication->handle() /Users/josh/.composer/vendor/mkusher/padawan/src/Application/HTTP/App.php:23
Any ideas? I'm running PHP 5.6 on OSX 10.10.5, with the following $HOME/.composer/composer.json
:
"mkusher/padawan": "^0.2.1",
"mkusher/padawan-symfony": "^0.1.2"
When installing globally, all Laravel and Symfony users have a newer conflicting version installed. Are there any breaking changes between 2.* and 3.*?
Hello,
When autocompleting functions, is it possible to have an option where braces are appended?
e.g. function(
is inserted instead of function
On my setup, typing just bin/padawan
or bin/padawan made-up
argument does nothing. I would expect that to give a list of possible commands / the help for padawan.
I wiped original message for this:
To make it work, I had to install EnvironmentSettings to add padawan to $PATH, because sublime python just didn't see my real env variables. Composer autoloader works. I commented out symfony class to reindex everything. I chose 'generate index' but still couldn't make it work, because in GetProjectRoot I had to return sublime.active_window().extract_variables()['folder']
instead of current code. Then I fired 'start server' and I see process working and port reserved, but in sublime I see 'padawan.php' is not running.
It's was really hard way and it was for nothing. Any suggestions?
I try to generate the index in one project. But the command exit at 66% with
PHP Fatal error: Maximum function nesting level of '256' reached, aborting! in /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php on line 32
PHP Stack trace:
PHP 1. {main}() /home/erwan_f22/.composer/vendor/mkusher/padawan/bin/padawan:0
PHP 2. Application\CLI\App->handle() /home/erwan_f22/.composer/vendor/mkusher/padawan/bin/padawan:26
PHP 3. Application\BaseApplication->handle() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Application/CLI/App.php:16
PHP 4. Command\GenerateCommand->run() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Application/BaseApplication.php:36
PHP 5. Generator\IndexGenerator->generateIndex() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Command/GenerateCommand.php:21
PHP 6. Generator\IndexGenerator->generateProjectIndex() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Generator/IndexGenerator.php:49
PHP 7. Generator\IndexGenerator->processFile() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Generator/IndexGenerator.php:67
PHP 8. Parser\Parser->parseFile() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Generator/IndexGenerator.php:98
PHP 9. Parser\Parser->parseContent() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Parser/Parser.php:35
PHP 10. PhpParser\NodeTraverser->traverse() /home/erwan_f22/.composer/vendor/mkusher/padawan/src/Parser/Parser.php:68
PHP 11. PhpParser\NodeTraverser->traverseArray() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
PHP 12. PhpParser\NodeTraverser->traverseNode() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
PHP 13. PhpParser\NodeTraverser->traverseArray() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 14. PhpParser\NodeTraverser->traverseNode() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
PHP 15. PhpParser\NodeTraverser->traverseArray() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 16. PhpParser\NodeTraverser->traverseNode() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
PHP 17. PhpParser\NodeTraverser->traverseArray() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 18. PhpParser\NodeTraverser->traverseNode() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
PHP 19. PhpParser\NodeTraverser->traverseNode() /home/erwan_f22/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:97
Given
<?php
class Test
{
public function test($smth)
{
$this->test(a|
}
}
There is no suggestion fow function call, I would expect array_map
etc.
I already have phpcs, phpmd and php-cs-fixer installed. Some make use of Symfony/EventDispatcher v3.0.0, which collides with padawan required dependency ^2.6 as shown below:
Using version ^0.2.1 for mkusher/padawan
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove symfony/event-dispatcher v3.0.0
- Conclusion: don't install symfony/event-dispatcher v2.8.0
- Installation request for mkusher/padawan ^0.2.1 -> satisfiable by mkusher/padawan[v0.2.1].
- Conclusion: don't install symfony/event-dispatcher v3.0.0
- mkusher/padawan v0.2.1 requires symfony/event-dispatcher ^2.6 -> satisfiable by symfony/event-dispatcher[v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.8.0].
- Can only install one of: symfony/event-dispatcher[v2.6.0, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.1, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.10, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.11, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.12, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.2, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.3, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.4, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.5, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.6, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.7, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.8, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.6.9, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.0, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.1, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.2, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.3, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.4, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.5, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.6, v3.0.0].
- Can only install one of: symfony/event-dispatcher[v2.7.7, v3.0.0].
- Installation request for symfony/event-dispatcher == 3.0.0.0 -> satisfiable by symfony/event-dispatcher[v3.0.0].
Installation failed, reverting ./composer.json to its original content.
Project file is a yaml(e.g. .padawan.yml
) configuration for a project.
php: 7
plugins:
Mkusher\SymfonyPlugin:
Someone\SomepackagePlugin:
extra_option_for_somepackagePlugin: 1
exclude: ['app/bootstrap.php.cache', 'app/cache/*']
cache_dir: '.padawan'
here we have 3 sections:
plugins
- plugins you want to be enabled for this projectexclude
- files or folders you want to exclude from being indexedcache_dir
- folder for padawan.php cache for this projectphp
- version of php being used for running padawan. Could be 5 or 7. php5.* will use nikic/PHP-Parser and 7 will use built-in AST builder.Before editors were looking for composer.json file, now they will have to look for .padawan.yml
first and only then look for composer.json
.
That's something what is missing I think. When I have class like App\Entities\Order and I just type Order, I don't get anything unless I type 'use' keyword before. It wouldn't be a problem if I could do 'find use' and it would automatically add it to other use lines and leave 'Order' in current line. Is there a chance to enable that autocompletion without use keyword at least?
When generating the index for a new Laravel project the indexer Segfaults (php 5.6.20 Debian 8.4) while processing this Symfony test class.
https://github.com/symfony/var-dumper/blob/master/Tests/Fixtures/NotLoadableClass.php
It seems the issue is with the class extending itself:
class NotLoadableClass extends NotLoadableClass
If I change one of the class names it will finish wihtout crashing.
I have also noticed that about 50Mbytes of memory is allocated while processing that class. So maybe there is some reference loop. The PHP process doesn't seem to hit the memory limit (padawan sets the limit to 2Gbytes), the whole process uses around 500Mbytes (199Mbytes reported in the log) when it crashes.
I would like to be able to add a custom command to padawan.php plugin. As far as I can tell this is currently not possible.
Can we add something like special route, where we can pass plugin action?
I was thinking about a command that will dispatch event, which can be handled by the plugin.
What do you think? I'm happy to write a patch if you think that's a good idea.
Master branch is not loading plugins.
It looks like the plugin loader is never called. Unless there was some breaking change? I can only tell that the Plugin
class inside my plugin is never created.
It works fine in 0.2.1
PS.
plugin.json
is now created in src
directory, in 0.2.1 it was created in the root
. Not sure if that's by design or missed in refactoring?
Hi there
I just tried installing padawan, but unfortunately composer global require mkusher/padawan
failed with the following error message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mkusher/padawan ^0.2.1 -> satisfiable by mkusher/padawan[v0.2.1].
- Conclusion: remove phpdocumentor/reflection-docblock 3.1.0
- Conclusion: don't install phpdocumentor/reflection-docblock 3.1.0
- mkusher/padawan v0.2.1 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].
- Can only install one of: phpdocumentor/reflection-docblock[2.0.0, 3.1.0].
- Can only install one of: phpdocumentor/reflection-docblock[2.0.1, 3.1.0].
- Can only install one of: phpdocumentor/reflection-docblock[2.0.2, 3.1.0].
- Can only install one of: phpdocumentor/reflection-docblock[2.0.3, 3.1.0].
- Can only install one of: phpdocumentor/reflection-docblock[2.0.4, 3.1.0].
- Installation request for phpdocumentor/reflection-docblock (locked at 3.1.0) -> satisfiable by phpdocumentor/reflection-docblock[3.1.0].
Installation failed, reverting ./composer.json to its original content.
My global composer.json looks like this:
{
"require": {
"laravel/envoy": "~1.0",
"laravel/installer": "^1.3",
"laravel/valet": "^1.1",
"phpunit/phpunit": "~5.0"
}
}
If I understand the error message correctly, the issue appears due to a padawan using an older version of reflection-docblock. Maybe this could be updated?
Thanks for making padawan!
Man, thank you so much! This is awesome work you're doing :D Keep it up!
Hey @mkusher, I started working on a similar project a couple months ago: https://github.com/cweagans/theforce
Want to work together? I'd love to help on this!
Having file:
namespace A\B;
class B
{
public function test(){}
}
$b = new B;
$b->
won't show any completion
The sub-folder is not created before saving the index, so no ".padawan/project" file is created if the sub-folder doesn't exist.
Everything works okay in most cases, e.g.:
<?php
class Foo {}
$x = new F # Padawan suggests `Foo`
But shouldn't the built-in functions (like below) get completed as well?
<?php
func_g # Padawan doesn't return suggestions
func_get_args(); # same
imagecreatetruecolor(); # same
foreach(); # same
All I get is:
Padawan.php error: Could not define empty line context
Maybe there's something wrong with my installation process?
NVIM-0.1.6-dev
and vundle
,deoplete
, deoplete-padawan
and padawan
,composer global require mkusher/padawan
,PHP 5.6.11.1
via sudo apt-get install php
,foo.php
, opened it with nvim
and started typing.As far as I understand, the purpose of the set omnifunc
provider is to provide language syntax completion? At least phpcomplete-extended
was doing that... So what am I doing wrong?
[EDITED] If I install UltiSnips
and a snippets pack I get templates suggestions, so it doesn't seem to be the problem with deoplete
.
Here's the idea. Instead of doing mass reindex in project root there could be something like a lazy index. On the first completion, we could collect files and classes only (which should be much faster than a full index), and then when doing completion inside the file index missing related files. So if class A uses object of class B then index class B etc. Hopefully, it's clear what the idea is.
With that feature, we could have full completion in any project without needs for full reindex.
Just to give you some figures, reindex in one of my projects:
$ \time -f %es padawan generate
...
74.82s
In the same project:
$ \time -f %es ag --php '^class.*$'
...
0.98s
It would be probably slower in pure PHP, but still should be faster than full reindex.
How feasible you think it is?
I have the following code
<?php
class A {
public function foo(){}
}
$a = new A();
// place X
[
'a' => $a // place Y
];
If i try now to type $a->
at place X it will work, but if it try to type ->
at place Y, it will not
if the array is a multiline normal one , it does work , same for multiline function call
Well like i talk with u @mkusher i will put here some itens that can be nice to have in padawan.php
For now is that i will go thinking in other staff and editing this issue to make this more elaborated.
Im building a package that use this server to get autocompletion for php, but until now i generate the index file (.padawan/project), after this point im a little lose cuz i start the padawan server but i don't know to what url make the query for the autocompletions.
I know that in the realm u have linked a vim plugin and until i see u call to a complete method passing 4 parameters, im trying to do that with a tester app to http request and restful api but i don't get any completion passing the 4 parameters.
Exists some doc about how the server use this 4 parameters or if need something more?
Given file causing fatal error:
<?php
class A
{
protected $smth = null;
public function __construct()
{
$name = 'test';
$b = new B;
$this->smth = $b->$name;
}
}
class B {
public $test = 'value';
}
Error:
PHP Catchable fatal error: Object of class PhpParser\Node\Expr\Variable could not be converted to string in /home/smeagol/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Complete/Resolver/NodeTypeResolver.php on line 95
Catchable fatal error: Object of class PhpParser\Node\Expr\Variable could not be converted to string in /home/smeagol/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Complete/Resolver/NodeTypeResolver.php on line 95
Line $this->smth = $b->$name;
is the problem, if I change it to $smth = $b->$name;
it's fine and $this->smth = $b->test;
is also all right.
Tested on master branch (works all right on 0.2.1).
class SomeParent
{
public function test(){}
protected function testProtected(){}
private function testPrivate(){}
}
class SomeChild extends SomeParent
{
public function test()
{
parent::
}
}
should return test
and testProtected
In the README I see namespace completion which looks to be working in Sublime. However, in the VIM plugin it doesn't seem to work properly. If I type
use
Then <C-x><C-o>
(trigger omnicomplete) I get an error Pattern not found
. Same if I input text first like
use Symf
Just wondering if this a VIM implementation issue, or issue with the padawan server? Also, I'm on commit hash be0cd81
Cheers
Getting this error on padawan generate:
PHP Fatal error: Call to undefined method Padawan\Domain\Core\Completion\Scope\ClassScope::addClass() in /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Domain/Co
re/Completion/Scope/ClassScope.php on line 26
PHP Stack trace:
PHP 1. {main}() /home/michael/.composer/vendor/mkusher/padawan/bin/padawan:0
PHP 2. Symfony\Component\Console\Application->run() /home/michael/.composer/vendor/mkusher/padawan/bin/padawan:27
PHP 3. Symfony\Component\Console\Application->doRun() /home/michael/.composer/vendor/symfony/console/Application.php:123
PHP 4. Symfony\Component\Console\Application->doRunCommand() /home/michael/.composer/vendor/symfony/console/Application.php:192
PHP 5. Symfony\Component\Console\Command\Command->run() /home/michael/.composer/vendor/symfony/console/Application.php:844
PHP 6. Padawan\Framework\Application\CLI\GenerateCommand->execute() /home/michael/.composer/vendor/symfony/console/Command/Command.php:259
PHP 7. Padawan\Framework\Generator\IndexGenerator->generateIndex() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Application/CLI/GenerateCommand.php:
39
PHP 8. Padawan\Framework\Generator\IndexGenerator->generateProjectIndex() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php:
47
PHP 9. Padawan\Framework\Generator\IndexGenerator->processFile() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php:65
PHP 10. Padawan\Framework\Generator\IndexGenerator->createScopeForFile() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php:92
PHP 11. Padawan\Parser\Parser->parseFile() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Framework/Generator/IndexGenerator.php:103
PHP 12. Padawan\Parser\Parser->parseContent() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Parser/Parser.php:36
PHP 13. PhpParser\NodeTraverser->traverse() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Parser/Parser.php:71
PHP 14. PhpParser\NodeTraverser->traverseArray() /home/michael/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
PHP 15. Padawan\Parser\Walker\IndexGeneratingWalker->enterNode() /home/michael/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:120
PHP 16. Padawan\Domain\Core\Completion\Scope\ClassScope->__construct() /home/michael/.composer/vendor/mkusher/padawan/src/Padawan/Parser/Walker/IndexGeneratingWalker.php:64
Components such as event-dispatcher, console, etc. should allow both ~2.7|~3.0
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.