PhpStorm keyboard shortcut for code inspection recommended resolution? - phpstorm

If you run a code inspection, you might get something like this in the results panel:
Problem synopsis:
Traditional syntax array literal detected (at line 193)
Problem resolution:
Convert Array Syntax To Short
i.e. it's telling you to change array() to []
The 'resolution' is clickable and it'll fix it for you. But is a keyboard shortcut, or a way of shading identical problems (often you get a bunch of them) and having them fixed for you all at once?

You can use f2/Shift+f2 to jump to next/previous error, then hit Alt+Enter, Enter to apply suggested fixes.
Note that there is a Code | Code Cleanup... command that runs inspections against your code and applies quickfixes. But it only includes a small subset of available inspections that are considered 'safe', so that applying hotfixes automatically doesn't break anything

Use standard shortcut: same as for invoking intentions menu (Quick Fix menu) manually in Editor: Alt + Enter (for Windows/Linux, not sure what that would be on Mac)

Also you can take a look at this tool: https://github.com/fabpot/PHP-CS-Fixer

Related

How to stop moving one line down while commenting in PhpStorm?

Whenever I comment (Ctrl + /) in PhpStorm, the IDE automatically moves the pointer one line down. How do I disable that?
You cannot. I mean: there is no option for that.
But you can try a workaround using Macro: https://stackoverflow.com/a/27545802/783119 ... or make a selection (1 symbol anywhere in the line will be enough) before using the shortcut.
Other than that: https://youtrack.jetbrains.com/issue/IDEA-119435 -- watch this ticket (star/vote/comment) to get notified on any progress.
P.S. I personally like current behaviour: it allows me to quickly disable & enable subsequent lines (in any supported language/file format that has line comments) without making any selection.

Is there any shortcut to select entire code block in Atom similar to Option + Up Arrow in PhpStorm

Is there any shortcut to select entire code block in Atom similar to Option + Up Arrow in PhpStorm?
It helps you select the code block and if you press Option + Up Arrow again, it expands the selection to its parent block.
Is there any shortcut or plugin to have that feature? It makes it faster to work with heavy code.
Yes! You want the expand-region plugin, it's great! Add these to your keymap.cson to expand the region with option-up (alt-up on windows) :
'atom-text-editor':
'alt-up': 'expand-region:expand'
'alt-down': 'expand-region:shrink'
Ctrl+Alt+M (Cmd+Ctrl+M on Mac) selects entire code inside the current brackets. It doesn't expand to the parent block though.
If you need that feature, you might want to look for some package. There is select-scope package that claims to add that functionality. I haven't tested if it works. It also doesn't seem to show up on the package list in every atom version.
If you decide to try that package out, you may need to override it's key-binding as it uses Ctrl+S.
This is now built into Atom.
https://blog.atom.io/2018/10/23/atom-1-32.html
Select Larger/Smaller Syntax Node

How to make PhpStorm/WebStorm scope highlighting look more expressive?

When I first learned Java, I was using an IDE called "BlueJ." It had this feature called "Scope Highlighting" which made it very easy to read blocks of code. See picture below:
As you can see on the first picture, on BlueJ the whole Background of a scope is highlighted with one color.
In PhpStorm or even in most of IDE's today, I get only a highlighting for a scope, which I set the cursor on, and only in a very minimalist way, as you can see on the left side of the picture below:
Is there a way, or a Plugin for PhpStorm out there, to get it to look more like BlueJ's scope Highlighting???
Thanks
edit:
What I've have found out so far:
There is something alike for HTML, (Setting>Editor>General>Appearance:Enable HTML/XML tag tree highlighting:Set opacity higher than 0) Then you will get this:
Something like this for the other languages (PHP, JS,...) would make me really happy :)
Maybe you will also like the VSCode extension "Blockman". It highlights nested code blocks based on curly/square/round brackets, html/xml tags and Python/Yaml indentation. (I am the author of Blockman).
.
So far I have found two solutions for this.
The plugin Rainbow Brackets, makes it easier to visually find the corresponding bracket.
Also, it provides the option to highlight the current scope by Ctrl + Right Mouse Click or Ctrl + Shift + Plus. The name of the Shortcut is: Plugins | Rainbow Brackets | Highlight Current Scope and the highlighting looks like this:
The built-in shortcuts to jump to the matching bracket or the one at the code block start/end. Though it does not highlight anything, you can quickly find the matching bracket. Check your ide-settings for the shortcut: Editor Actions | Move Caret to Matching Brace / Editor Actions | Move Caret to Code Block End / Editor Actions | Move Caret to Code Block Start

Sublime Text 2 auto completion popup does not work properly

I got problem with jQuery Snippet that i installed throughout package control. After installation I do not have popup with jQuery code hints and intalisance. Look at this video:
http://code.tutsplus.com/courses/perfect-workflow-in-sublime-text-2/lessons/adding-snippets-through-package-control
On 0:50 after typing . he got popup with code hints - I don't have this one. I have to type . on and then press Tab to display popup with snippet...
And yes, I'm in JavaScript file and I got default settings.
And after . he also got all jQuery functions like add or addClass. I do not have this one even if I press Ctrl+Space.
If you hit CTRL-SPACE you'll get the dropdown of available completions for what you've just typed.
http://www.sublimetext.com/docs/2/tab_completion.html
If you want the autocomplete dropdown to appear as you type then add this line to your User Preferences.sublime-settings file:
{
"auto_complete_selector": "source, text"
}
That should do what you're looking for :-)
Consider changing User Settings to the following:
{
// By default, auto complete will commit the current completion on enter.
// This setting can be used to make it complete on tab instead.
// Completing on tab is generally a superior option, as it removes
// ambiguity between committing the completion and inserting a newline.
"auto_complete_commit_on_tab": true,
// Controls if auto complete is shown when snippet fields are active.
// Only relevant if auto_complete_commit_on_tab is true.
"auto_complete_with_fields": true,
// As Richard Jordan suggested, this item
// controls what scopes auto complete will be triggered in
"auto_complete_selector": "source, text"
}
Open your User Settings by pressing Cmd+, on Mac or Ctrl+, on Windows
And if you want to fully grasp Sublime Text 2, I do recommend this course: Perfect Workflow in Sublime Text. It used to be free by the time I first posted this answer. I still recommend it anyways.
Which OS are you using? I'm guessing Windows.
The problem here seems to be that the jQuery snippets in the available plugins have <tabTrigger> attributes that start either with a $ or a ., which causes trouble.
Try the following: Find the jQuery package that contains those snippets (Under Preferences -> Browse Packages) and open the .sublime-snippet file of a snippet that doesn't work properly. The one you named in your post would be defined in the file event-on.sublime-snippet.
Find the line
<tabTrigger>.on</tabTrigger>
and remove the . as follows
<tabTrigger>on</tabTrigger>
Save and return to your .js file. Now see if the snippet shows up when you type o. This works for me.
I guess this is a bug in Sublime Text 2 for Windows (maybe Linux, too?), since it obviously works fine on OS X as we see in the video course you've linked.
There was an issue created on GitHub on this specific package and I now commented this info. I guess the only way to get this working is to have snippets that do not start with special characters.
I also filed a bug for Sublime Text on Userecho.
The creator of the video is using SublimeCodeIntel. What you see at 00:50 isn't Sublime Text 2's autocompletion popup, it's SublimeCodeIntel's import autocompletion popup:
Imports autocomplete - Shows autocomplete with the available modules/symbols in real time.
See the Github page for more information.

Is there a Surround With for aptana studio plugin?

Is there some way to get "surround with" in the Aptana perspective in Eclipse like you have in the Java perspective. I would love to be able to surround text with html tags like eg: <div></div> with a keyboard shortcut. Is there some way of doing that with the snippets rubles?
Thanks,
You can do this with AutoHotKey, which has the added benefit of being available across all apps. I have a script which launches a 'surround' menu when I select some text and press CTRL+SHIFT+C
To use it, install AutoHotKey, and create a new .txt file with the following code, and replace the extension with .ahk
http://pastebin.com/48ipiXsG
At the top of the file you'll find a number of groups of items, in the following format
<h1>~<h1>##</h1>
the ~ character divides the name of the function and the function content. The bit before ~ is what appears on your menu, and after the ~ is the code. ## represents where your selected text will go. So if you select the text 'AutoHotKey' and press CTRL+SHIFT+C, and then select <h1> from the menu, it'll replace the with <h1>AutoHotKey</h1>
There are several menus in the script, set up to launch based on what app you press CTRL+SHIFT+C in. For example, I get different shortcuts if I'm in Visual Studio than if I'm in SQL Server. You can modify these easily enough, but the generic menu should work fine for you. Feel free to chop and change but you have to leave GENERIC at the top of the script.
PS: I use this script everyday, and there is one small bug. The script saves whatever you have in the clipboard in a variable, and then writes it back to the clipboard when it's done. Sometimes, instead of surrounding text it replaces it with whatever you had in the clipboard. This is easily undone with CTRL-Z and usually works the second time you try it. I've never been able to figure out what causes this, maybe some autohotkey heads can help out?
PPS : This script is based on some other scripts from the AHK forums, including this one
http://www.autohotkey.com/docs/scripts/FavoriteFolders.htm
So you may find comments that don't make sense. I've seen a few references to the middle click, as the script above uses the middle mouse button instead of CTRL+SHIFT+C.