PHP extensions for vscode can't handle code - php

I would love to switch from Sublime to VSCode completely. While developing Go is a great experience, PHP is not much fun with some libraries.
At work, we use the OXID e-Commerce solution for many projects. The biggets has more than 150MB in PHP code.
The two big PHP extensions (the ones by Felix Becker and Hvy Industries) both fail to work properly with OXID. I tried to let both index for a whole weekend, but I get no results except 100% CPU load. I think I know why, I can try to elaborate if someone is interested.
All I really miss/need is a simple "Go to definition". In Sublime, I have this simple "right click -> go to definition" which lists all func/method definitions with this name. It's not perfect, but better than nothing. Is there something similar to this for VSCode? Or anybody who had more luck with OXID projects and VSCode?

Related

howto set up autocomplete for php in eclipse similar to java

i'm pretty new to php development and want to start using an IDE with syntax checking and autocompletion.
I'm used to programming java with eclipse and thought that the PDT provides similiar functionality.
In java if i type in for example: "new Arr" and press ctrl+space autocomplete suggests a list of possibilities with "new ArrayList()" on top.
but if i try the same in a php project, for example with "new mysq" and ctrl+space i get nothing. I would expect to get "new mysqli()" or similar recommended.
Is the described functionality not included in PDT? Or did i configure something wrong?
I did the "right click on project-> configure-> Add php support" but it didn't change anything.
If you would like to have some basic auto complete feature you can use NotePad++ (download) for a quick and easy starter. This is a really great minimal program that can be used very efficiently to code in many different languages. It provides huge ammount of different functions. It is a must have tool for any developer.
I used Notepad++ to write ten thousands of lines of PHP code, it worked really great for me.
Otherwise PDT also supports autocomplete. Make sure that you have a PHP project added and then your are in a PHP file (.php extension). If you have Java autocomplete working in the same project then I think that you are in a Java project, try adding a PHP project, then a new PHP source file. Then PHP autocomplete should be working well in this source file.
Make sure also that you have PHP perspective selected.
I hope you can get by now starting using PHP! Have luck and good times using this great language!
I found the solution in this question: Why does Eclipse code completion not work on some projects?
I had to manually add this:
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
to the buildpath file of my project.

Eclipse PDT content assist for PHP just stopps working randomly

My problem is, that my Eclipse PDT randomly looses PHP content assist. It happened about a dozen times now and I can't figure out, what causes this. It used to happen about once in two weeks. I install a plugin or just close Eclipse and sometimes, when I start it up next time, it looses basic PHP assit, like "in_array()". But all project specific assistance works fine though.
I went through a lot of tips, checking my window > prefs > php content assist, checking if PHP support is added to the project, checking my project's .buildpath, making a clean build, starting Eclipse with -clean option. These things just don't help.
What I used to do (and will do now) is to restore an Eclipse backup, meaning I have to restore my pdt_workspace and my Eclipse install folder both or PHP assist will not work. I've tried restoring parts of these folders or just on of these, but it seems, I have to restore both of them to get content assist back. I went through this a dozen times now, so fortunately I make weekly backups. ;-)
I don't know, what makes these problems happen. Does anyone have some similar problem or any idea about this?
/sorry for bad english/
UPDATE:
I don't know what's going on really, but I got PHP assist working again, two times. First time it started working I've been a lot of install/uninstall and it just came back working. But I've lost it again for no reason. This time, I've uninstalled Yiiclipse and Zen Coding plugin and PHP assist started working. But I reinstalled them and PHP assist is still working! WTF?!
I can't see any logic in this....
I managed to solve my problem. After a lot of testing I ended up removing Zen Coding and Yiiclipse both and doing a clean + build on all projects. This seem to solve my problems and give back PHP code assist.
The downside is, I don't have Yiiclipse and Zen Coding now....
Well, after much grief with this I opened up Eclipse, and right click the project, go to Add PHP support... and voilá. That did the trick.
I experienced this issue due to Upgrade from Helios -> Luna & Content Assist, Key references, variables etc. suddenly stopped working. This was due to incompatible db structure in h2 database from older one.
To resolve this, just remove the data or files from :
<your workspace directory>/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2

Why notepad++ autocomplete doesn't work with function arguments?

I checked "Settings > Prefences > Backup/Auto-Completion > Enable Auto-completion on each input" and "Function parameters hint on input" options. I have Notepad++ 5.9 (unicode) version. It auto completes function names but not their arguments. Also i tried re-install. I know it has this feature but not working. Any idea why?
I mean it auto completes print_r when i write "pri" but i want it to work like in the image;
http://i51.tinypic.com/3322auc.jpg
Hmm, this is not an answer to your question but I want to share it anyway.
I have used Notepad++ for years. I didn't like Eclipse and NetBeans is just so damn slow.
I never used the auto complete function for anything.
Notepad++ can't really do any code analysis, it can only give you auto-completion on the known PHP functions.
I've since switched to an IDE that does full code analysis and can do auto-completion for your own code as well.
Notepad++ is great if you just want to write something real quick. It's also a great tool if you want to learn about PHP since it doesn't do auto-completion very well ;) but if you really want to be productive when you're working on a large application I recommend you use an IDE that does code analysis. Productivity is the key here. I spend less time looking through files and more time actually writing code, which is great! :D
Good IDEs for PHP: NetBeans, PHPStorm, Eclipse.
For this feature to work, you need to supply an .xml file which contains the appropriate functions and parameters.
An example for Javascript with installation instructions can be found here.
I have not yet found xml files for PHP (or Python, which I'm looking for). But it seems this can work in npp, you just need to locate the right xml file.
Best of luck!
(Oh, and don't listen to the naysayers who are too quick to give up, npp works fine as an IDE.)
Notepad++ it's very good text editor, but it's not IDE.
Try to use IDE - NetBeans or PhpStorm, and you will get much more than just smart autocomplete.
I have a same question about this, function hint is Ok,but param hints not display until I download a new release of notepad++(a not install release), all is ok. before, I tryed many time, and edit the xml files.
If you will edit you own language, Can copy from a exist language xml ,for cpp.xml in plugins/APIs folder. It's easy to understand its rule.
It is very easy to have a error, if you config file is changed.

Emacs frustration with web development any working dot-files?

I really liked flexibility of emacs but it is really annoying to make it work. I want to use it for web development html, css, javascript, php. I first tried emacs-starter-kit . It didn't included nXhtml. Also C-g key binding does not work (they call it starter kit but basic key command does not work). I think it is mapped for git control. That's a frustration for a beginner. Then I replaced emacs-starter-kit with nXhtml. At least C-g is working. But code completion sucks, M-tab does not work. I tried code completion from nXhtml menu with no success. Also NXhtml mode did'nt colorized my file if css is mixed with html. Isn't it recommended for mixed html, css,php files. So why it doesnt work?. Why Emacs folks do not aware of convention over configuration? Dam! ship it something works! Please help me before I am getting crazy. I use Ubuntu 10.04 and emacs-snaphot-gtk 23.1.50-1. Please guide me step by step with your working dotfile url. Even I accept I am a dummy, it is really annoying and frustrating to use emacs.
Have a look here if you haven't already. You are running Emacs under X. In that case, you should try if Esc-Tab works for code completion. M-Tab might be lost to the X for switching between processes.
Programs like Emacs and Vim demand that you invest time and effort before they start paying off. They pay off really good in terms if not getting in the way of real work. I suggest you to find time to get acquainted with such programs before venting out.

phing and phpUnderControl ... working together

Has anyone got these to work together seemlessly? I have tried, had some success using the plugin at http://phing.info/trac/wiki/Users/Documentation/CruiseControl, but have failed to:
Get the metrics graphs working (nothing appears)
Enable the "PMD" - project mess detection - reports
Are there any other ant-specific commands that must (can) be run in addition to my phing build script?
Also, the front page of the reports section dumps a heap of log information, and I'm trying to get rid of that too.
Cheers for any help ... we are running phing 2.3.0 and phpUnderControl 0.4.7.
Paul
Our application framework makes heavy use of Phing, and we've got that integrated under CI with phpUnderControl. We do have the metrics and PMD working now, and honestly, it was a little bit of an accident that it started working. But we're still missing the code coverage (working on it) and the phpDoc output (working on that too). I'll try to remember to come back and update this when we're done.
I have found that the main reason for the metrics not showing up is an incompatibility with the ez library that phpuc uses for the rendering. You'll get this NullPointerException on the page, right? Then when you try to run a build manually, you'll get this obscure error about index and divide by 0? What's happening is the ez graphics library that ships with phpuc is old, and you have to upgrade it. I hope that's a clue for you. We didn't have trouble with PMD stuff, so I don't know why that wouldn't work for you. If you want to update your question with more specifics, maybe I can elaborate on what's worked for us?
To answer my question, in the end I figured it was easier to just use an ant build script to make everything work.
I think phing is good when starting out, and has an excellent dbdeploy feature (which I use in phpUC), but for getting the metrics and the PHPMD integrated you are better off using ant - the XML is not hard.
Cheers

Categories