How to choose the definitions in PhpStorm? - phpstorm

In PhpStorm 2020.1. There are multiple declarations of \Spider.
The default declaration is the first declaration. How to change the default declaration?

At the moment, there's no such feature: https://youtrack.jetbrains.com/issue/WI-17646
The only way you can affect resolution is by excluding the folder that has unnecessary declarations from indexing (Settings/Preferences | Directories), or by marking the files that has those declaration as text ones.

Related

Is there any way to quickly add class to an HTML element in JetBrains IDEs?

I am trying PhpStorm and I coming over from VS Code.
I am used to adding classes and ids to my html elements like this:
element.class or element#id. I got very used to it and now I very much miss it.
Is there any similar way to add classes and ids to html elements in PhpStorm?
It's called Emmet and it is supported in JetBrains IDEs (IDEA based at least).
Just press Tab (default shortcut, can be changed in Settings/Preferences | Editor | Emmet) to expand the sequence, e.g. p.red[TAB] to make <p class="red">[CARET]</p>
https://www.jetbrains.com/help/phpstorm/using-zen-coding-support.html

Sphinx RTD theme: Change color of inline code

I use Sphinx with the Read the Docs theme. For small inline code snippets, such as the mention of a single variable among a piece of text, I use double backticks to format the code as what's called "inline literals" in the documentation.
Is this the proper way to format inline code snippets?
Unlike proper code blocks, no language specific syntax highlighting is performed on the inline code snippets (that's fine). As seen in the linked documentation above (see the below screen shot), all such "inline literals" are colored red.
How can I change this color to something else?
I'm only concerned with the HTML output of Sphinx.
I found a solution, though it involves changing the Sphinx RTD theme source code.
The HTML coloring used by the RTD theme is specified in sphinx_rtd_theme/static/css/theme.css, with the sphinx_rtd_theme directory located in the site-packages directory of the Python installation. The red color used is #e74c3c and the specific place which sets this color for inline literals is
literal{color:#e74c3c}
Changing this color does exactly what I want. Making changes directly to theme_css feels wrong though. The specific change takes place on line 4, which is over 100000 characters wide! Clearly this file is generated from other files. I guess the proper solution involves performing the change do one of these (to me unknown) files.
Edit: Proper solution
With a custom .css file, the colors of the inline literals can be set using
code.literal {
color: #404040 !important;
background-color: #fbfbfb !important;
}
The name of a .css file containing the above should be added to html_css_files in the Sphinx conf.py, i.e.
# conf.py
html_css_files = ['custom.css']

Color/highlight or Add an icon to a specific file under project files

I have a very important file at the level of my project which is called veiw.yml. I would like to color/highlight or put an icon on it, in order to make it more attrective for me. In other words I want color or add an icon on one of my yml file at the level of my project files, that match the exactly regex expression ^views.yml$.
Is there any way I could do the trick with phpstorm or change the phpstorm Atom Material Icons plugin configuration to add another icon to his iconslist?
Any idea, help would be appreciated.
There are many options that can be used based on what exactly you want to achieve (why you need to highlight such file -- maybe you do not need highlighting but want something else and you do not know about such possibility):
Just add the desired file(s) or folder(s) to the Favorites and use it instead of locating that file in a Project tree all the time.
NOTE: Bookmarks have now replaced Favorites that existed in earlier versions of the IDE.
You can bookmark specific file with Mnemonic Bookmark (0..9 mainly) and then open such a file with just one key press from anywhere. This will also add a special mark next to the file name.
NOTE: this is a per file thingy, no patterns.
https://www.jetbrains.com/help/phpstorm/bookmarks.html#add-mnemonic-line-bookmark
https://www.jetbrains.com/help/phpstorm/bookmarks.html#navigate-bookmarks
If it has to be a different color in the Project view panel... then just define custom scope at Settings/Preferences | Appearance & Behavior | Scopes and then (once scope is fully saved) associate that scope with specific color at Settings/Preferences | Appearance & Behavior | File Colors (ensure that appropriate checkbox is selected, which is by default).
You will now have different backgrounds under such files in the Project View panel and other lists where file names are used.
https://www.jetbrains.com/help/phpstorm/configuring-scopes-and-file-colors.html
https://www.jetbrains.com/help/phpstorm/settings-file-colors.html
ProjectTree Color Highlighter plugin (https://plugins.jetbrains.com/plugin/13951-projecttree-color-highlighter) -- allows assigning custom colors to custom files.
NOTE: does not support patterns, only manually assigning files. Therefore this can be treated as a Plus or as a Minus, depending on your needs.
Extra Icons plugin (https://plugins.jetbrains.com/plugin/11058-extra-icons). It allows assigning custom file icons based on folder or file name patterns. You can even bring your own icons.
NOTE: From the 2022.1 version it is a paid plugin now (only $5 USD per year but still).

PhpStorm html class name folding

PhpStorm has great code folding features, but I need to know:
If there is any way to fold html classes names in code like style inline attribute values?
Because, If I'm going to use some libs like MDL, it could be alooooooot of unnecessary html class declarations and I want to keep it folded.
Like this one:
There is no such option for class attribute collapsing -- only for HTML's 'style' attribute.
All available option can be found in Settings/Preferences | Editor | General | Code Folding
Consider submitting new Feature Request ticket to the Issue Tracker at https://youtrack.jetbrains.com/issues/WEB (but check for existing tickets first).

phpstorm french characters formating issue

I'm using PHPstorm 6.
When i try to format my code which contains french characters, i got a issue like you see on the pictures.
NB : i got this just when i put my text into a tag like :
<span>génie Informatique</span>
So before formatting i was this :
And after formatting i got this
Thanks
What kind of file is that -- HTML?
In any case: you do have light green background between the tags. This suggests that you have another language injected between those tags (Language Injection functionality), which may use completely different formatting rules (not HTML -- e.g. JavaScript or whatever you may have injected there).
Possible solution:
Place cursor somewhere between such tags, Alt+Enter (or click on light bulb icon) and use "Uninject Language" option.
Alternatively: Settings | Language Injections -- find and disable (or even delete) offending entry there (will be "global" or "project" type in last column).