I'm having an issue with IntelliJ, that I cannot seem to find a solution for myself. I have not changed any settings, yet when I started my IDE this morning, all Inspections and other highlighting has disappeared.
By highlighting, I mean stuff like variable names becoming purple, static finals shown with italic text, etc.
Inheritance seems to be broken as well, in that an implementing method links to the implemented interface method, but interface methods do not link to the implementing method.
My search for this tells me that there is an icon for this in the bottom right. That's set to "Inspections", and under configuration, it seems like everything is set to default.
Is there some way to un-break my IDE?
Another solution:
File -> Power Save mode
It needs to be disabled.
The (or at least one) answer to this is:
File -> Invalidate Caches
Make sure the folder the code is in is marked as the sources root. If it's not marked as the sources root, syntax highlighting will be very limited.
To mark a directory as the sources root, right click the directory, then navigate down to "Mark directory as" and select "Sources root."
Related
I'm using PhpStorm over 3 months and it's a good IDE. I do not know what I've clicked yesterday but since yesterday I have issue with code completion in CSS mainly.
On the screen I have VS Code and PhpStorm and also I've opened the same project.
In VS Code it works perfectly. In PhpStorm it doesn't. I tried some Google First Aid like clear cache, update the IDE, turn On/Off Safe mode etc. but nothing changed.
My Code Completion settings:
Based on your PhpStorm editor area screenshot (many thanks for that BTW: not many people do post it even if asked), all your CSS files are treated as a Plain Text. It's rather unlikely to be a glitch, more like accidental settings change.
Settings/Preferences | Plugins -- make sure that CSS plugin is enabled. If not -- enable and restart the IDE.
If still the same: Settings/Preferences | Editor | File Types -- locate "Cascading style sheet" entry and make sure that it has *.css pattern there.
If not there -- it's possible that you have somehow reassigned it to "Text" file type. If it's there -- just add *.css to Cascading style sheet patterns (it will remove it from Text when doing that).
If still nothing: you would need to provide more/new screenshots.
I could swear that this wasn't the behavior on an older version. Is there any way to make it so the File... action only displays actual files, and not directories? It's incredibly frustrating to have to always be suggested a directory first instead of a file, since (in my opinion) jumping to a directory is totally useless - all it does is scroll you in the folder/projects view to that directory..
Edit: IntelliJ version is: IntelliJ IDEA 2017.3.2, Build #IU-173.4127.27.
As explained in comments on the Youtrack issue I opened, this is now intended behavior due to the directory being a better match than the file (case sensitivity).
This is resolved for me with these possible solutions:
Use Navigate > Class instead, as suggested by glytching. Works well for most purposes since it handles many languages just fine.
Type a . to ignore directories. This, for me, is easier to incorporate into muscle memory than hitting Shift to capitalize or hitting Up/Down to scroll around the list of suggestions.
CLion 2016.2 helpfully detects potential errors in the file you're editing, which can be seen in the validation bar to the right of the code.
That's just a single file though, is there a way (like a tool window) to get a list of all such warnings in the whole project, or specific parts of it?
Bonus points if it also lists warnings and errors from the compiler, though that's less important, because the compiler output already includes any it found.
Yes, it is possible. The feature you are looking for is called the Inspector.
Do: Find Action... | Inspect Code. It will show a pop-up that will allow you to select the scope: file, whole project, custom, and the Inspection profile (you can choose the type of errors you want to see):
After clicking OK, this is an example of the output, that you can navigate with the mouse or with keyboard shortcuts:
In version 2017.2, I have it under Code | Inspect Code....
You can also right click a folder in Project view and select Inspect Code... there to be able to check only that folder.
So I pressed something by mistake (was in a flyout menu so not sure what it was) and now one of my folders is red.
This is what a regular directory looks like:
It means Excluded Root and is explained in IntelliJ IDEA Docs as:
Excluded roots are ones that IntelliJ IDEA "partially ignores".
Very limited coding assistance is provided for files in excluded
folders. Classes contained in excluded folders don't appear in code
completion suggestion lists, references to such classes are shown in
the editor as unresolved. When searching, IntelliJ IDEA doesn't look
in excluded folders, etc.
Here is a complete list of IntelliJ symbols and icons for future reference.
You can cancel the exclusion by right clicking the directory in project view and selecting Mark Directory As/Cancel Exclusion.
As a side note, if the folder itself is "grey" but the directory name is "red" apparently that means "a git root" or some odd. update: it's actually brown and means "unversioned - File exists locally, but is not in the repository, and is not scheduled for adding." see the key here. If you're using the "night" theme then it shows up as looking way closer to red than brown.
I am trying to exclude a particular file in my project from being compiled.
According to the Intellij IDEA documentation you do this by "marking the file as plain text".
However, the context menu in the project view where this functionality is supposedly located has no such action. I am using version 13.02 of Intellij. Here is what my context menu looks like:
Under File > Settings > Build, Execution, Deployment > Compiler > Excludes, add an entry.
Any attempts to run a path specified here will result in a ClassNotFoundException, and a very important class indicator as well.
Just to compound on Makoto's answer (would comment but don't have reputation), it looks like this feature does not apply to classes (.java) or assets (images)...for these types of files, it looks like you will need to actually go to the compiler and explicitly state that the file(s) should be excluded.
However, for .htm, .xml, or really anything that isn't a class or asset you will find and can use the 'Mark as plain text' option.
Edit: It looks like you can also go to the 'Messages Make' error / warnings view and Exclude from there, a little less work IMHO.
The answer that #Makoto has given is pretty much the way to go, but in case that you are like me and you get easily both distracted and frustrated looking for that menu, you could use this shortcut:
press ctrl + shift + a , and in the input box that appears type excludes, and select the first item that appears.