felixfbecker / vscode-php-intellisense Goto Github PK
View Code? Open in Web Editor NEWAdvanced PHP IntelliSense for Visual Studio Code ππ¬
License: MIT License
Advanced PHP IntelliSense for Visual Studio Code ππ¬
License: MIT License
php --version
and check version with semverfor example if i have a class defined as class Extremely_Long_Class_Name
aliased as Name
i can call a static method 'foo' from the class using either the full class name or the aliased name like this.
Extremely_Long_Class_Name::foo() // go to definition on foo works fine
Name::foo() // go to definition on foo doesn't work
Great extension, but is it possible to configure formatting options to follow PSR-2 standard - like do not remove empty lines, align assignments (by = sign), do not convert "else if" to "else } if", etc.?
Thanks.
Thanks for your efforts for doing this extension, but I get a high CPU overloading... And even, it will fork another process named PHP
in some cases.
Here is the processes:
yarco 59482 60.9 1.0 2535072 80160 ?? R 2:27δΈε 1:10.99 php /Users/yarco/.vscode/extensions/felixfbecker.php-intellisense-0.0.11/vendor/felixfbecker/language-server/bin/php-language-server.php
yarco 59260 60.4 1.4 2572720 117184 ?? R 2:06δΈε 12:59.76 php /Users/yarco/.vscode/extensions/felixfbecker.php-intellisense-0.0.11/vendor/felixfbecker/language-server/bin/php-language-server.php
yarco 31199 58.8 0.1 2486664 5448 ?? R 2:33δΈε 72:15.42 php /Users/yarco/.vscode/extensions/felixfbecker.php-intellisense-0.0.11/vendor/felixfbecker/language-server/bin/php-language-server.php
Hi, first off thank you for the wonderful php intellisense plugin.
I tried the format code option, but doesn't seem to show any effect on the file. Is there anything i am missing out on ?
Operation System: OSX
VS Code: 1.5.3
PHP Intellisense: 0.0.9
In output console
MAC Os sierra.
[Error - 5:15:37 AM] Server initialization failed. Message: Error: Call to undefined function phpDocumentor\Reflection\Types\token_get_all() in /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php:72 Stack trace: #0 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php(51): phpDocumentor\Reflection\Types\ContextFactory->createForNamespace('LanguageServer', '<?php\ndeclare(s...') #1 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php(97): phpDocumentor\Reflection\Types\ContextFactory->createFromReflector(Object(ReflectionClass)) #2 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/LanguageServer.php(135): AdvancedJsonRpc\Dispatcher->dispatch(Object(AdvancedJsonRpc\Request)) #3 [internal function]: LanguageServer\LanguageServer->LanguageServer\{closure}() #4 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/coroutine.php(64): Generator->valid() #5 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/coroutine.php(118): Sabre\Event\{closure}() #6 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/LanguageServer.php(158): Sabre\Event\coroutine(Object(Closure)) #7 [internal function]: LanguageServer\LanguageServer->LanguageServer\{closure}(Object(LanguageServer\Protocol\Message)) #8 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/EmitterTrait.php(88): call_user_func_array(Object(Closure), Array) #9 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/ProtocolStreamReader.php(56): Sabre\Event\Emitter->emit('message', Array) #10 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(311): LanguageServer\ProtocolStreamReader->LanguageServer\{closure}() #11 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(233): Sabre\Event\Loop\Loop->runStreams(NULL) #12 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true) #13 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run() #14 /Users/emem/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run() #15 {main} Code: -32603
This is a question:
I am getting this error in the output window:
Connection to server is erroring. Shutting down server.
What does this mean?
Do I have to install anything else apart form the VS Code extension? :^)
I don't even know what the language server is supposed to be (I guess the parser for the language?).
If you can help it would be cool. :)
Paradoxically, the "format code" option seems working (maybe it is native functionality of VS Code that you override?), but not the symbol listing.
Message: InvalidArgumentException: Not a valid file URI: inmemory://model/26 in...
I think it may be because the diff views shown aren't on disk, but instead loaded in memory? To reproduce, just open a repository folder, modify a PHP file, switch into the Git panel, and select the modified file.
Hi,
I'm playing with your extension and I have problems with using it with VS Code. After cloning I executed:
I copied whole directory to vscode extensions directory and now when I open PHP file in developer tools console I have error message:
[Extension Host] Response handler 'initialize' failed with message: Cannot read property 'code' of null
It is possible to make Ctrl + Click works to Go To Definition like PHP Storm or Netbeans?
Intellisense is taking an enormous amount of time to index a project (a WordPress site with 2352 files to parse). After 30mins it's still chugging through. During this time CPU usage is at 99.8% and both fans are going bonkers (2015 top spec MacBook Pro 15").
So I looked at the output window and discovered it seems to be going round and round and never reaching the end. Here's the bit of the output showing where it gets to before a Connection to server got closed. Server will restart
error occurs:
Parsing file 842/2352: file:///private/var/www/sites/mysite/wp-content/plugins/gravity-forms-advanced-file-uploader/inc/VideoUploader/includes/Zend/Validate/Hostname/Cn.php
[Info - 6:46:48 PM] Ignoring file file:///private/var/www/sites/mysite/wp-content/plugins/gravity-forms-advanced-file-uploader/inc/VideoUploader/includes/Zend/Validate/Hostname/Cn.php because it exceeds size limit of 150000 bytes (168073)
Parsing file 843/2352: file:///private/var/www/sites/mysite/wp-content/plugins/gravity-forms-advanced-file-uploader/inc/VideoUploader/includes/Zend/Validate/Hostname/Com.php
[Info - 6:46:48 PM] Connection to server got closed. Server will restart.
Parsing file 0/2352: file:///private/var/www/sites/mysite/a.php
Parsing file 1/2352: file:///private/var/www/sites/mysite/docs/temp/inc/admin.php
Parsing file 2/2352: file:///private/var/www/sites/mysite/docs/temp/inc/comments.php
Parsing file 3/2352: file:///private/var/www/sites/mysite/docs/temp/inc/core.php
Parsing file 4/2352: file:///private/var/www/sites/mysite/docs/temp/inc/courses.php
I'm getting this error in class files where there's no a defined namespace:
[Error - 17:38:31] Request textDocument/formatting failed.
Message: Exception: Unable to format file in /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/Formatter.php:52
Stack trace:
#0 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/PhpDocument.php(244): LanguageServer\Formatter::format('<?php\n\nuse Illu...', 'file:///opt/lam...')
#1 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/Server/TextDocument.php(179): LanguageServer\PhpDocument->getFormattedText()
#2 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Promise.php(242): LanguageServer\Server\TextDocument->LanguageServer\Server\{closure}(Object(LanguageServer\PhpDocument))
#3 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#4 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#5 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#6 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#7 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#8 {main}
Code: -32603
[Error - 17:39:50] Request textDocument/formatting failed.
Message: Exception: Unable to format file in /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/Formatter.php:52
Stack trace:
#0 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/PhpDocument.php(244): LanguageServer\Formatter::format('<?php\n\nuse Illu...', 'file:///opt/lam...')
#1 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/Server/TextDocument.php(179): LanguageServer\PhpDocument->getFormattedText()
#2 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Promise.php(242): LanguageServer\Server\TextDocument->LanguageServer\Server\{closure}(Object(LanguageServer\PhpDocument))
#3 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#4 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#5 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#6 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#7 /home/andreshg112/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#8 {main}
Code: -32603
Hello,
Thank you for this useful extension for visual studio code.
Is there any way to exclude some folders from scan, because I got below error, it seems that this extension search node_modules folder too, so I think that excluding this folder from search can help us.
[Error - 11:47:13 PM] Server initialization failed.
Message: UnexpectedValueException: RecursiveDirectoryIterator::__construct(c:/xampp/htdocs/axent/wp-content/plugins/wc-multistep-designer\node_modules\grunt-contrib-cssmin\node_modules\maxmin\node_modules\pretty-bytes\node_modules\meow\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\strip-bom,c:/xampp/htdocs/axent/wp-content/plugins/wc-multistep-designer\node_modules\grunt-contrib-cssmin\node_modules\maxmin\node_modules\pretty-bytes\node_modules\meow\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\strip-bom): The system cannot find the path specified. (code: 3) in C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\webmozart\glob\src\Iterator\RecursiveDirectoryIterator.php:43
Stack trace:
#0 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\webmozart\glob\src\Iterator\RecursiveDirectoryIterator.php(43): RecursiveDirectoryIterator->__construct('c:/xampp/htdocs...', 4128)
#1 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\webmozart\glob\src\Iterator\RecursiveDirectoryIterator.php(55): Webmozart\Glob\Iterator\RecursiveDirectoryIterator->__construct('c:/xampp/htdocs...', 4128)
#2 [internal function]: Webmozart\Glob\Iterator\RecursiveDirectoryIterator->getChildren()
#3 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\webmozart\glob\src\Iterator\RegexFilterIterator.php(130): FilterIterator->next()
#4 [internal function]: Webmozart\Glob\Iterator\RegexFilterIterator->next()
#5 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\felixfbecker\language-server\src\FilesFinder\FileSystemFilesFinder.php(24): IteratorIterator->next()
#6 [internal function]: LanguageServer\FilesFinder\FileSystemFilesFinder->LanguageServer\FilesFinder\{closure}()
#7 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\sabre\event\lib\coroutine.php(70): Generator->send(NULL)
#8 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\sabre\event\lib\Promise.php(242): Sabre\Event\{closure}(NULL)
#9 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\sabre\event\lib\Loop\Loop.php(261): Sabre\Event\Promise->Sabre\Event\{closure}()
#10 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\sabre\event\lib\Loop\Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#11 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\sabre\event\lib\Loop\Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#12 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\sabre\event\lib\Loop\functions.php(122): Sabre\Event\Loop\Loop->run()
#13 C:\Users\taher\.vscode\extensions\felixfbecker.php-intellisense-1.0.0\vendor\felixfbecker\language-server\bin\php-language-server.php(50): Sabre\Event\Loop\run()
#14 {main}
Code: -32603
Please let me know is there anyway to fixing this issue?
Regards.
From @BernalCarlos on September 13, 2016 13:53
Hi,
I just downloaded the extension for VSCode, but it does not seem to work. For example, i cant find symbols (it says "unfortunately we have no symbol information for the file") or format code (the option doesn't appear on the context menu).
I'm using Linux Mint 18, the latest version of VSCode, and installed PHP 7 using sudo apt-get install php
.
Is there something else i'm supposed to do?
Thank you.
Copied from original issue: felixfbecker/php-language-server#26
As soon I install your plugin I get a lot of PHP errors or warnings in my problems window.
All of those problems are related to files I did not create and I would like to disable code validation for those directories or files.
Is it possible to exclude some files from validation?
From @TRE8 on December 1, 2016 5:42
Steps to Reproduce:
Hi, I'm trying to point VSCode to my PHP executable. I'm on a Mac and using MAMP Pro, which I believe is the PHP executable that I'm suppose to point to.
I've gone into settings.json and added this line:
// Points to the php executable.
"php.validate.executablePath": "/Applications/MAMP/bin/php/php7.0.12/bin"
Here's an image to help if needed.
Not sure if I entered the file path wrong or if I should use a different one, it doesn't seem to click. I still get a message that PHP executable is not connected to VSCode.
Also, new to Github and trying to tag this as a question but don't see an option to tag a label to this post.
Copied from original issue: microsoft/vscode#16309
Format Code command automatically adds the "" before a class when it is used to invoke a static method.
Example:
\testClass::staticMethod()
When analyzing files, the PHP Language Server Output window opens. After it is closed manually, it re-opens after a while. Also, it appears as though the PHP Language Server is continuously re-parsing the files in the project when it re-opens.
I am running:
PHP IntelliSense 1.0.0
Visual Studio Code
Version 1.9.0
Commit 27240e71ef390bf2d66307e677c2a333cebf75af
Date 2017-02-02T08:21:13.228Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0
Ubuntu Linux
uname -a gives
Linux vmuser-VirtualBox 4.4.0-62-generic #83~14.04.1-Ubuntu SMP Wed Jan 18 18:10:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Congrats on hitting v1.
/**
* Some desc
* @see http://google.com
*/
function foo() { ... }
Complains: `"\http://google.com" is not a valid Fqsen.
Not sure how I can explain better, but this would be very useful, especially for private variables in classes.
Thank you for this great extension, makes VSCode perfect!
My VScode config specifies some files and folders to ignore:
files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/docs": true,
"**/upgrade": true,
"**/uploads": true,
"**/node_modules": true,
"**/.vscode": true
}
But Intellisense is scanning some of these as can be seen in the output window:
Parsing file 1/2352: file:///private/var/www/sites/mysite/docs/temp/inc/admin.php
Parsing file 2/2352: file:///private/var/www/sites/mysite/docs/temp/inc/comments.php
Parsing file 3/2352: file:///private/var/www/sites/mysite/docs/temp/inc/core.php
Parsing file 4/2352: file:///private/var/www/sites/mysite/docs/temp/inc/courses.php
In this case the docs folder contains a lot of PHP files that are not part of my project. Is there a way to specify that some folders should not be scanned, or for Intellisense to not scan excluded folders?
Whenever this extension is active, the php process constantly takes 100% CPU, making my laptop overheat uselessly.
Machine used: 13" Macbook Air, Early 2015 (Core i7, 8 GB RAM)
VSCode version: 1.8.1
Extensions installed:
I'll be happy to provide more informations if needed.
Hi.
I have been trying to install your plugin but I cannot seem to get it to work.
I turned off php.suggest.basic
, however I cannot seem to get autocomplete to work at all now? See the image below.
The output tab shows that the server booted and indexed all my files I guess. See below.
The Developer Tools tab give me no indication why it is not working.
Stuff like Find All References also turn up no result. Not sure if this feature is simply not supported or what? Find All References does work for classes.
I have tried various things, running the composer run-script --working-dir=vendor/felixfbecker/language-server parse-stubs
directly from the installed extensions folder. I am wondering I have missed some obvious installation instruction or something?
I am using VS Code 1.9.1 and I am on OSX
I cannot install the language server in my current project (nor do I want to) because it conflicts with laravel's install. I would like to be able to point to the install location of the language server through a config setting, but this doesn't seem to be supported.
I can install it somewhere else and run it through a seperate terminal, but this is undesired.
composer install
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: don't install laravel/framework v5.2.45
- Conclusion: don't install laravel/framework v5.2.44
- Conclusion: don't install laravel/framework v5.2.43
- Conclusion: don't install laravel/framework v5.2.42
- Conclusion: don't install laravel/framework 5.2.41
- Conclusion: don't install laravel/framework v5.2.40
- Conclusion: don't install laravel/framework v5.2.39
- Conclusion: don't install laravel/framework v5.2.38
- Conclusion: don't install laravel/framework v5.2.37
- Conclusion: don't install laravel/framework v5.2.36
- Conclusion: don't install laravel/framework v5.2.35
- Conclusion: don't install laravel/framework v5.2.34
- Conclusion: don't install laravel/framework v5.2.33
- Conclusion: don't install laravel/framework v5.2.32
- Conclusion: don't install laravel/framework v5.2.31
- Conclusion: don't install laravel/framework v5.2.30
- Conclusion: don't install laravel/framework v5.2.29
- Conclusion: don't install laravel/framework v5.2.28
- Conclusion: don't install laravel/framework v5.2.27
- Conclusion: don't install laravel/framework v5.2.26
- Conclusion: don't install laravel/framework v5.2.25
- Conclusion: don't install laravel/framework v5.2.24
- Conclusion: don't install laravel/framework v5.2.23
- Conclusion: don't install laravel/framework v5.2.22
- Conclusion: don't install laravel/framework v5.2.21
- Conclusion: don't install laravel/framework v5.2.20
- Conclusion: don't install laravel/framework v5.2.19
- Conclusion: don't install laravel/framework v5.2.18
- Conclusion: don't install laravel/framework v5.2.17
- Conclusion: don't install laravel/framework v5.2.16
- Conclusion: don't install laravel/framework v5.2.15
- Conclusion: don't install laravel/framework v5.2.14
- Conclusion: don't install laravel/framework v5.2.13
- Conclusion: don't install laravel/framework v5.2.12
- Conclusion: don't install laravel/framework v5.2.11
- Conclusion: don't install laravel/framework v5.2.10
- Conclusion: don't install laravel/framework v5.2.9
- Conclusion: don't install laravel/framework v5.2.8
- Conclusion: don't install laravel/framework v5.2.7
- Conclusion: don't install laravel/framework v5.2.6
- Conclusion: don't install laravel/framework v5.2.5
- Conclusion: don't install laravel/framework v5.2.4
- Conclusion: don't install laravel/framework v5.2.3
- Conclusion: don't install laravel/framework v5.2.2
- Conclusion: don't install laravel/framework v5.2.1
- laravel/framework v5.2.0 requires psy/psysh 0.6.* -> satisfiable by psy/psysh[v0.6.0, v0.6.1].
- Conclusion: don't install psy/psysh v0.6.1
- Conclusion: don't install nikic/php-parser v3.0.1|don't install psy/psysh v0.6.0|install nikic/php-parser v2.1.1
- Conclusion: don't install nikic/php-parser v2.1.1
- Installation request for laravel/framework 5.2.* -> satisfiable by laravel/framework[5.2.41, v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.32, v5.2.33, v5.2.34, v5.2.35, v5.2.36, v5.2.37, v5.2.38, v5.2.39, v5.2.4, v5.2.40, v5.2.42, v5.2.43, v5.2.44, v5.2.45, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
- Installation request for felixfbecker/language-server ^3.1 -> satisfiable by felixfbecker/language-server[v3.1.0].
- psy/psysh v0.6.0 requires nikic/php-parser ^1.2.1|~2.0 -> satisfiable by nikic/php-parser[v1.2.1, v1.2.2, v1.3.0, v1.4.0, v1.4.1, v2.0.0, v2.0.1, v2.1.0, v2.1.1].
- Can only install one of: nikic/php-parser[v3.0.0, v1.2.1].
- Can only install one of: nikic/php-parser[v3.0.0, v1.2.2].
- Can only install one of: nikic/php-parser[v3.0.0, v1.3.0].
- Can only install one of: nikic/php-parser[v3.0.0, v1.4.0].
- Can only install one of: nikic/php-parser[v3.0.0, v1.4.1].
- Can only install one of: nikic/php-parser[v3.0.0, v2.0.0].
- Can only install one of: nikic/php-parser[v3.0.0, v2.0.1].
- Can only install one of: nikic/php-parser[v3.0.0, v2.1.0].
- felixfbecker/language-server v3.1.0 requires nikic/php-parser ^3.0.0beta2 -> satisfiable by nikic/php-parser[v3.0.0, v3.0.1, v3.0.2].
- Conclusion: don't install nikic/php-parser v3.0.2
After updated version 0.0.12, I always got error.
The PHP Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.
Another message found in the console:
PHP Fatal error: Maximum function nesting level of '256' reached, aborting! in /Users/user/.vscode/extensions/felixfbecker.php-intellisense-0.0.12/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php on line 97
PHP Stack trace:
PHP 1. {main}() /Users/user/.vscode/extensions/felixfbecker.php-intellisense-0.0.12/vendor/felixfbecker/language-server/bin/php-language-server.php:0
...
PHP 228. PhpParser\NodeTraverser->traverseArray()
PHP 242. PhpParser\NodeTraverser->traverseNode()
PHP 249. PhpParser\NodeTraverser->traverseArray()
PHP 254. LanguageServer\NodeVisitor\DocBlockParser->enterNode()
In the language server project it says: "Errors/Warnings from the vendor directory are ignored."
Would be great to have a way to specify either a different directory, or multiple directories. Right now my composer.json has this:
"config": {
"vendor-dir": "library"
},
Steps to Reproduce:
Expected: Problems panel has problems of only opened files
Actual: Problems panel has problems of total workspace.
Can you add setting to scan on problems only opened file(s)? I have too large workspace with many "prev-" temporary files. I don't need to see errors from temporary files. And I don't need to scan all files, because it take CPU resources.
thank you.
P.S. related with comment of microsoft/vscode#19018 (comment)
file/line: https://github.com/felixfbecker/php-language-server/blob/d080c161a9e65e54ec28a4b9a3e3607f09232a9c/src/LanguageServer.php#L291
I don't know if I am doing something wrong or if it is even possible but I have framework classes in vendor folder so I would thought that autocomplete function hinting/completing these classes, eg. in use statement, function parameters etc. Every other function of your extension works well, great job! But autocomplete is not, even with your PDO example.
Hi,
It was long time ago I had to do any PHP coding and lot has changed since then (I use NET in my everyday development) and now I have some small PHP project to attend to, so I decided to use VS Code to help me with PHP.
First thing I did is to install PHP Debug (thank U for this extension too) and made it work pretty fast. Now I can debug PHP code :)
During my PHP development sessions, I saw that there is no VS code PHP intellisense for MySQL objects (in specific mysqli), so I decided to try your other extension - PHP Intellisense and I failed :(
After I installed extension, I can see format code option in context menu, but no matter what I tried I could not see any intellisense regarding MySQL PHP objects.
Here are my settings:
"php.validate.executablePath": "C:/xampp/php/php.exe", "php.validate.run": "onType", "php.validate.enable": false
I tried "php.executablePath" too, without and in combination with "php.validate.executablePath" but it did not seem to work. As U can see, I am using XAMPP with PHP 7.0.13 (cli) (built: Nov 8 2016 13:45:28) ( ZTS ) (PHP is in my PATH too).
Based on all said in READ.me I was not sure if I need to install PHP language server in order to make intellisense work so I did not install it :)
Is there anything else that I can do/try in order to get PHP MySQL objects intellisense to work?
Thanks
is it possible to add the ability to jump back to last definition?
I'm on:
and I can't see the Goto Definition on the popup menu.
Any ideas?
Is it possible?
Thanks.
I installed the latest version(0.0.11), go to definition doesn't work.
// Place your settings in this file to overwrite the default settings
{
"php.validate.executablePath": "C:/php56/php.exe",
"php.executablePath":"C:/php56/php.exe"
}
PHP IntelliSense is very good.But "Go to Definition" needs to be improved.
Look this code:
class ParentItem
{
public function test()
{
echo 'test';
}
}
class Child extends ParentItem
{
}
$a = new Child;
$a->test();
I can't go to definition$a->test()
From @Maelstorm1973 on January 18, 2017 11:57
PHP Version:
C:\Servers\php>php --version
PHP 7.1.0 (cli) (built: Dec 2 2016 05:24:57) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
VS Code Settings:
// PHP settings
"php.validate.enable": true,
"php.validate.executablePath": "C:\\Servers\\php\\php.exe",
"php.validate.run": "onType"
The error that I am getting is as follows:
ERROR The language server needs at least PHP 7 installed. Version found: 5.6.26
I can guarantee you that there is no PHP 5.6 installed anywhere on this machine.
Copied from original issue: felixfbecker/php-language-server#242
Hi. your work is very good. but you know not all use php in our projects. Some use php 5 or less. You know you should allow choose the version of php or that automatically detects and should also allow use more than one version of php
On OSX 10.12.3 with VSCode 1.8.1 the language server sometimes keeps running in the background, eating CPU resources at 80-99%.
Judging by the older issues and the performance mention in the readme its still indexing projects
I'll try to find out more when I have a bit more time to experiment.
I tried to compile plugin from scratch and after npm run compile
I got such error:
npm run compile
> [email protected] compile /home/wywrzal/git/vscode-php-intellisense
> node ./node_modules/vscode/bin/compile -p ./
src/extension.ts(7,25): error TS2307: Cannot find module 'semver'.
npm ERR! Linux 4.7.6-200.fc24.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "compile"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] compile: `node ./node_modules/vscode/bin/compile -p ./`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] compile script 'node ./node_modules/vscode/bin/compile -p ./'.
npm ERR! This is most likely a problem with the php-intellisense package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./node_modules/vscode/bin/compile -p ./
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs php-intellisense
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls php-intellisense
npm ERR! There is likely additional logging output above.
I tried several solutions from web but nothing helped. Any hints?
Fedora 24, 64bit
I'm having Error parsing PHP version. Please check the output of php --version
but i'm with php 7.0.6
C:> php --version
PHP Warning: Module 'openssl' already loaded in Unknown on line 0
Warning: Module 'openssl' already loaded in Unknown on line 0
PHP 7.0.6 (cli) (built: Apr 28 2016 14:12:14) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
Add the ability to ignore folders that contain libraries. That way I don't get hundreds of warnings from somebody elses code.
I'm running Gentoo and this extension fails to compare the version of php:
The language server needs at least PHP 7 installed and in your PATH. Version found: 7.0.10--pl0-gentoo
After latest extension update (v1.1.1) a get this error when i hover over methods
Message: ErrorException: Object of class PhpParser\Node\NullableType could not be converted to string in .vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/DefinitionResolver.php:759
#0 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/DefinitionResolver.php(759): {closure}(4096, 'Object of class...', '/home/andrejs/....', 759, Array)
#1 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/DefinitionResolver.php(131): LanguageServer\DefinitionResolver->getTypeFromNode(Object(PhpParser\Node\Stmt\ClassMethod))
#2 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/NodeVisitor/DefinitionCollector.php(45): LanguageServer\DefinitionResolver->createDefinitionFromNode(Object(PhpParser\Node\Stmt\ClassMethod), 'Skus\Zone->tari...')
#3 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(159): LanguageServer\NodeVisitor\DefinitionCollector->enterNode(Object(PhpParser\Node\Stmt\ClassMethod))
#4 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(101): PhpParser\NodeTraverser->traverseArray(Array)
#5 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(171): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Class_))
#6 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(101): PhpParser\NodeTraverser->traverseArray(Array)
#7 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(171): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Namespace_))
#8 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(85): PhpParser\NodeTraverser->traverseArray(Array)
#9 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/PhpDocument.php(205): PhpParser\NodeTraverser->traverse(Array)
#10 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/PhpDocument.php(119): LanguageServer\PhpDocument->updateContent('<?php\ndeclare(s...')
#11 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(134): LanguageServer\PhpDocument->__construct('file:///home/an...', '<?php\ndeclare(s...', Object(LanguageServer\Index\Index), Object(LanguageServer\Parser), Object(phpDocumentor\Reflection\DocBlockFactory), Object(LanguageServer\DefinitionResolver))
#12 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/src/PhpDocumentLoader.php(113): LanguageServer\PhpDocumentLoader->create('file:///home/an...', '<?php\ndeclare(s...')
#13 [internal function]: LanguageServer\PhpDocumentLoader->LanguageServer{closure}()
#14 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/coroutine.php(70): Generator->send('<?php\ndeclare(s...')
#15 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Promise.php(242): Sabre\Event{closure}('<?php\ndeclare(s...')
#16 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(261): Sabre\Event\Promise->Sabre\Event{closure}()
#17 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(215): Sabre\Event\Loop\Loop->runNextTicks()
#18 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/Loop.php(194): Sabre\Event\Loop\Loop->tick(true)
#19 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/sabre/event/lib/Loop/functions.php(122): Sabre\Event\Loop\Loop->run()
#20 /home/andrejs/.vscode/extensions/felixfbecker.php-intellisense-1.1.1/vendor/felixfbecker/language-server/bin/php-language-server.php(102): Sabre\Event\Loop\run()
#21 {main}
I work on a big project which includes lots of files. Which can have a lot of issue in them and make it really slow to run.
How can I tell it folders not to search? Or if there is a way can it be added to the documentation.
I'm getting the following notification on top:
The PHP Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted.
My output window shows:
[Info - 5:49:53 PM] Connection to server got closed. Server will restart.
[Info - 5:49:53 PM] Connection to server got closed. Server will restart.
[Info - 5:49:53 PM] Connection to server got closed. Server will restart.
[Info - 5:49:54 PM] Connection to server got closed. Server will restart.
[Error - 5:49:54 PM] Connection to server got closed. Server will not be restarted.
EDIT: Just noticed that you closed issues relating to these problems while mentioning the WIP state. However, this extension is publicly available, and it is not mentioned it doesn't work out-of-the-box.
As discussed extensively in felixfbecker/php-language-server#31 we need to talk to the server through a socket on Windows if we want to allow tasks to run between commands from the client.
For this, php-intellisense needs an OS switch to decide which means of communication to use.
Here is my hacky implementation so far. It currently always uses a socket, still needs the OS switch.
'use strict';
var path = require('path');
var child_process_1 = require('child_process');
var vscode = require('vscode');
var vscode_languageclient_1 = require('vscode-languageclient');
var semver = require('semver');
var net = require('net');
function activate(context) {
// Check if PHP is available and version is ^7.0.0
child_process_1.execFile('php', ['--version'], function (err, stdout, stderr) {
if (err) {
if (err.code === 'ENOENT') {
vscode.window.showErrorMessage('PHP executable not found. You need PHP 7 installed and in your PATH');
}
else {
vscode.window.showErrorMessage('Error spawning PHP: ' + err.message);
console.error(err);
}
return;
}
// Parse version and discard OS info like 7.0.8--0ubuntu0.16.04.2
var version = stdout.toString().match(/^PHP ([^\s]+)/)[1].split('-')[0];
// Convert PHP prerelease format like 7.0.0rc1 to 7.0.0-rc1
if (!/^\d+.\d+.\d+$/.test(version)) {
version = version.replace(/(\d+.\d+.\d+)/, '$1-');
}
if (semver.lt(version, '7.0.0')) {
vscode.window.showErrorMessage('The language server needs at least PHP 7 installed and in your PATH. Version found: ' + version);
return;
}
var serverOptions = function () {
return new Promise(function(resolve, reject) {
var childProcess;
var pipeServer = net.createServer((pipe) => {
// 'connection' listener
console.log('PHP process connected');
pipe.on('end', () => {
console.log('PHP process disconnected');
});
pipeServer.close();
resolve({
reader: pipe,
writer: pipe
});
});
var listener = pipeServer.listen(0, '127.0.0.1', function() {
var address = '127.0.0.1:' + pipeServer.address().port;
// The server is implemented in PHP
var serverPath = context.asAbsolutePath(path.join('vendor', 'felixfbecker', 'language-server', 'bin', 'php-language-server.php'));
childProcess = child_process_1.spawn('php', [serverPath, '--tcp', address]);
childProcess.stderr.on('data', function (chunk) {
console.error(chunk + '');
});
childProcess.stdout.on('data', function (chunk) {
console.log(chunk + '');
});
});
});
};
// Options to control the language client
var clientOptions = {
// Register the server for php documents
documentSelector: ['php']
};
// Create the language client and start the client.
var disposable = new vscode_languageclient_1.LanguageClient('PHP Language Client', serverOptions, clientOptions).start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable);
});
}
exports.activate = activate;
//# sourceMappingURL=extension.js.map
From @tungvn on October 31, 2016 3:31
OS: Window 10
VS Code: 1.6.1
When I click some warnings, vscode return an error "Unable to open 'common.php': File not found (e:\path\to\common\file\common.php)."
Copied from original issue: felixfbecker/php-language-server#130
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.