php inspection & code completion not working on 6.02

Hi Guys,

I'm using PHPStorm for years now but haven't upgraded since 4. Now I'm trying 6.0 (and just go the 6.02 upgrade) and I still see the same behaviour

Code insight (not sure if called like that) is working fine, so I can see parameters when typing function calls.

But this is not working:

* code completion (ie, without me hitting ctrl-space to show me that function names that are available - worked just fine in 4.0)
* inspection or php errors, ie undefined variables and other stuff. I can't get this to work at all)

I've played through the settings, and have tried what I can, but I can't get it to work.

As said, it's working fine on 4 and not working on 6. Files are all ending with .php and I haven't seen any instance of above that works in any file that I edit.

It does do the code highlight seeminly correctly, ie, strings, operators, functions etc.

It just doesn't do anything automatic.

Appreciate any help on this matter.

Tom

18 comments
Comment actions Permalink

Hi Thomas,

Without any concrete examples (actual code and screenshot of how it works now) it's hard to say what kind of issues you are actually facing.

  • Code completion -- "Settings | Editor | Code Completion | Autopoup code completion in (ms)" = 0 (and checkbox ticked)
  • Inspections -- no comments without concrete code example. But inspections are configured in "Settings | Inspections | PHP"


I suggest:

  1. Backup your project settings (.idea subfolder in this project) and delete original files
  2. Backup your IDE settings (on Windows 7 it would be in C:\Users\USERNAME\.WebIde60 ) and delete original files. You can also use "File | Export/Import Settings" for backup/restore purposes.
  3. This will allow you to start from scratch so any bad configuration is discarded (you can always restore everything/individual settings back if you are not happy with results)
  4. Launch PhpStorm -- default settings will be used
  5. Open your project (File | Open Directory) and try again
0
Comment actions Permalink

Hi Andriy,

sorry I didn't post examples but it's really straightfoward: It doesn't work. Create a blank php file and write
<?php
die( $idonotexist);
?>

And nothing gets marked in red.

Plus of course the boxes are ticked for code completion etc and 0 time out etc. I was trying to avoid the settings reset but maybe I have to :-(

I even just before downloaded Netbeans but I'm not ready yet to revert back to it.

Thanks!

Tom

0
Comment actions Permalink
sorry I didn't post examples but it's really straightfoward: It doesn't work.

Very detailed description indeed.

Create a blank php file and write
<?php
die( $idonotexist);
?>

And nothing gets marked in red.

Works perfectly fine here:

screen01.png

I was trying to avoid the settings reset but maybe I have to :-(

You are licensed user -- right? Do not want to reset -- contact technical support directly ( support@jetbrains.com )  providing your config files AND some simple code example that describes the problem (they need to understand the problem first and then they will look for a solution -- maybe they can manually fix your configuration so no reset will be required)

0
Comment actions Permalink

Thanks.

Sorry for not being more specific. I understand it should work. I'm happy it works for you. but how specific should I be more than the example that I gave which probably displays my problem as specific as anything can.

Thanks for your help and suggestions, though.

Tom

0
Comment actions Permalink

You are there, having the code and seeing the results before your eyes. I'm over here and see nothing of it, have no real clue what you are facing and what steps you have done to resolve it. That's why detailed description of what is going on is very good to have -- simply stating "it does not work" is not very helpful, unfortunately. That's why simple screenshot can be very useful -- in some cases it can reject or confirm specific suggestions straight away.

But I do understand that making detailed description is hard here since you do not know what exactly can be wrong (the possible reasons for such IDE behaviour) and I should have been more easy in my last reply -- sorry about that.


That's why I suggest making full reset as even simple code example does not seem to work properly for you. As mentioned -- you should be able to re-use most of your original config if reset will work for you (you will able to manually copy most of the config files back, just do not do it all at once so you know where the problem may be located).

Who knows -- maybe it actually works ..

  • but just error markers are not visible (for whatever reason, e.g. broken color scheme after upgrade or something -- try default one);
  • or maybe you have disabled inspections for this particular file somehow (the Inspector guy in status bar);
  • or maybe you have Power Save Mode somehow enabled (when inspections are not executed) -- "File | Power Save Mode"
0
Comment actions Permalink

Just to update, deleted the settings and it works now.

Now putting all the settings back.

Thanks,

Tom

0
Comment actions Permalink

Hi Andriy,

sorry, no I've tried all these things... I would have needed to make 10 screenshots to cover all this.

But as my crosspost above, I have deleted the settings, it works now and I'm putting the settings back in.

Cheers,

Tom

0
Comment actions Permalink

Andriy,

but since you seem to be very knowledgable.. is there any way to have SQL autocomplete for columns as well?

I can browse the db in the database window. I can see autocomplete in the terminal of the database thing. But I cannot see any autocompletion (actually, it will render all columns as unknown and mark them as wrong)

Screenshot
http://snag.gy/MB3cj.jpg

I've seen a few posts somewhere where people got this to work but nothing has worked for me.

Cheers,

Tom

0
Comment actions Permalink

It's hard to say for me -- I'm not using it that much. I'm using SQL Server as Database engine and prefer SQL Server Management Studio over what PhpStorm can offer.

Please refer to this blog post -- it should tell you what you may be missing: http://blog.jetbrains.com/webide/2012/11/sql-support-and-database-tools/

Maybe wrong SQL Dialect selected (Settings | SQL Dialects)? Although unlikely.

0
Comment actions Permalink

Andriy,

thanks a lot. Yes of course I have tried that already. I just wonder because it seems to work for some persons but it doesn't for me...

I'll try more things, and thanks a lot for all you input.

It is greatly appreciated.

Thanks,

Tom

0
Comment actions Permalink

Try writing new code in a simple manner, for example (maybe it does not like your formatting? But that would be stupid excuse):

$sql = <<<SQL
INSERT INTO <Ctrl+Space>

SQL;

This seems to work OK for me ... and I have not done anything special (just followed the manual -- got it setup like a year ago or so):
screen01.png

My suggestion: try it in a brand new empty project and try simplest command possible -- maybe you need to refresh schema data in current one (in case if you inherited this from previous version).

If you are using MySQL -- see if quoting column names (surrounding with ` backtick character) will make any difference.

0
Comment actions Permalink

Hi Andriy,

you put me to shame, sorry for my gruntly initial responses yesterday.

But, alas, no, I tried all this to no avail. SQL dialect is set to mysql throughout, ctrl-space only gives me function names or mysql constants.

It's a bit weird because following your example

"INSERT INTO <crtrl-space>

Suggests "ADD" and other things. Not even table names. It does though resolve tables then correctly as it tells me if a table can't be found. But it won't autocomplete me on tables nor fields (also not if they are `'ed)

I'm trying more but I feel that it just perhaps is not supposed to work the way I think.

Cheers,

Tom

0
Comment actions Permalink

Andriy,

I tried all and verified all settings and verified I'm doing things correctly and I do.

I get

* No autocomplete besides mysql function names
* Invalid table names will get marked correctly as unknown
* Columns are all marked as unknown

Cheers,

Tom

0
Comment actions Permalink

Well .. don't know what you are possibly doing wrong (or maybe there is a bug in IDE). Here is what I have done just now .. and it works

1) Created new simple DB with 1 table (just for testing)
DB name: abcd

Table SQL:

delimiter $$

CREATE TABLE `users` (
  `idUser` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `login` varchar(45) NOT NULL,
  `full_name` varchar(100) NOT NULL,
  PRIMARY KEY (`idUser`),
  UNIQUE KEY `idUser_UNIQUE` (`idUser`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8$$


2) Created separate user and password for it; granted access to that DB

3) Created brand new project in PhpStorm. Set SQL Dialect to MySQL in "Settings | SQL Dialects"

4) In PhpStorm -- created new DB Connection using "MySQL Connector / J-5.1.22" driver
screen01.png
5) Told it what schemas to scan
screen02.png
6) Made sure that it found all the tables (only 1 anyway)

7) Start working:
screen03.png


I have attached my test project here -- edit DB connection details so it connects to your sample DB (preferrably add 1-2 more tables to your one .. or add/rename fields, to make sure that IDE fetched your details) and see if it will work for you. If nothing -- check the idea.log file for possible hints (Help | Show Log in ...)



Attachment(s):
mysql.7z.zip
0
Comment actions Permalink

Hi,

thanks for the reply.

My problem is different. Besides, it has changed now.

I now do get bold (=known) column names and tables names but no autocomplete still but in the console I do get autocomplete. Don't know what caused all this, but perhaps me removing the database and readding it solved something.

So now seemingly the only missing thing is autocomplete of anything related mysql in the code editor (as while in the mysql console edtior I do get autocomplete)

I've tried normal statements as I write them in the code, as well as

<<<SQL
BLAH
SQL;

which also doesn't work and yes it's all set to "mysql".

It'll be a major speedup to have autocomplete working for sql queries in the code editor and hopefully somehow this can be done.

Cheers,

Tom

PS: btw what is this <<<SQL thing, it would make my code completely unreadable if I had to use it...

0
Comment actions Permalink
PS: btw what is this <<<SQL thing, it would make my code completely unreadable if I had to use it...

Standard HEREDOC syntax?  http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc


In this particular case SQL language is automatically injected there because of "SQL" identifier (e.g. for JavaScript injection you can use "JS", "CSS" for CSS etc) -- see "Settings | Language Injections" for details.

It's not necessary to use it -- IDE should recognize sql syntax even in normal strings, just in this case it is guaranteed to have proper language injection (will work even if you use rare/non-standard sql command, like EXEC for example).

0
Comment actions Permalink

Please attach log files (Help/Show Log).
They may contain some exception stacktraces we can base our investigation on.

0

Please sign in to leave a comment.