How to switch to source code in PhpStorm? - phpstorm

I want to be able to quickly switch to the code editor window in PhpStorm. I've found "jump to source" hotkey, but it works that way: if I have some folder selected in my directory tree ("Project", on the left side) and I use the hotkey (F4 by default) I won't get switched. Also, if some other file has been selected in directory tree I'll get switched to the code of the selected file. However, I just want to emit clicking on the editor field using mouse. Just switch.

However, I just want to emit clicking on the editor field using mouse. Just switch.
Just Esc -- that's it.

Related

How to disable dialog that shows on pasting code in NetBeans?

When I paste a piece of code in the current HTML file NetBeans (12.5) always shows me the following dialog:
So, I need to press Esc every time. How to disable this dialog not to show it?
Displaying the Completion Window for HTML files is enabled by default, but it is easy to disable it:
Select Tools > Options > Editor
Select HTML from the Language droplist
Uncheck the Auto Popup Completion Window checkbox
Click Apply
Notes:
The change is immediately effective.
There are several other checkboxes in that same Options dialog (as shown above) which allow the Completion Window to still popup in specific situations.
Similar functionality for the Completion Window is also provided for some other languages, such as Java, JavaScript and PHP. Just select other languages from the Language drop list to see what functionality is available.

How can I move focus from any other tool window to text editor in PhpStorm?

For an example after I go to the Project tab with Alt+1 shortcut and open specific file with pressing Enter I then want to go and edit content with single shortcut. Is there any way to do it?
There is couple of things that I can use, but neither does exactly what I want:
Ctrl+Tab - that opens the switcher and selects next file in switcher instead of allowing me to edit file with single Ctrl+Tab
Ctrl+E or Ctrl+Shift+E do different things but basically the result is simmilar as above
What I want is to simply edit the file after opening it with keyboard from Projects tab (without using mouse).
How can I move focus from any other tool window to text editor in PhpStorm?
Just press Esc key.
Works in every tool window. For built-in Terminal though you can (may have to) configure different shortcut for such action (as Esc can be needed there).
For an example after I go to the Project tab with Alt+1 shortcut and open specific file with pressing Enter I then want to go and edit content with single shortcut. Is there any way to do it?
Use F4 for that (action is available in context menu and called Jump to Source).
Ctrl+Tab - that opens the switcher and selects next file in switcher instead of allowing me to edit file with single Ctrl+Tab
Just press and release it quickly: it works just like Alt + Tab on Windows. If you keep modifier key pressed (Ctrl in this particular case) it will keep the Switcher window opened.

Recording the change in DOM structure in Chrome

Is there any tool to record the change of DOM by Javascript and then re-run it slowly to debug ? Basically I want to log the html source code every second and then go through them one by one to see how the javascript is changing the page.
There is huge javascript which is difficult for me to understand. It is minified. I am only interested in watching how that script changes the state of a particular node in DOM. The changes are very fast and I want to observe it slowly.
Update:
I can add break point to pause execution of javascript whenever a dom element changes. But as I have said the element is changed too frequently. It there is something like "pause execution of JS when the number changes % 100 == 0" it would serve the requirement well
You can set breakpoints in the Chrome dev tools, which will pause all script execution on that page and give you time to examine everything.
To open the dev tools, press F12 or CtrlShiftI on Windows, or CmdOptI on Mac.
Go to the "Elements" tab, right-click on the element you want to observe, select "Break on...", and choose the events on which you want to pause.
Then let the script run, and a dark overlay should appear, saying "Paused in debugger".
If not selected automatically already, go to the "Sources" tab in the dev tools.
From there you can see the entire call stack, and see and modify all global and local variables and closures.
With F8 you can resume script execution (until the next breakpoint), and with F11 you can step forward into the next function.
Of course you can still use the console and the "Elements" tab while the page is paused.
If you need finer breakpoints, you can set a breakpoint in the source code, or replace a function in some object reference.
To set a breakpoint in the source, find your script in the "Sources" tab, prettify it via the {} button at the bottom left, and click a line number in the script. The line number should get a blue arrow after that.
To set a breakpoint by replacing a function, you'll need some object reference to work with.
Let's say we're working with jQuery, so we have a $ variable, which has a .ajax() method. We can inject a breakpoint there by doing the following:
var oldAjax = $.ajax;
$.ajax = function()
{
debugger;
return oldAjax.apply($, arguments);
};
If there is no object like $, to which you have access from the console, you can still use it, if you can set a breakpoint so that such an object will show up somewhere in the variable scope of one of the invoked functions.
From there you can right-click the value of the variable, select "Store as Global Variable" and then proceed with the method above, just using temp1 instead of $.

Linking project window with editor in PhpStorm

Is it possible to link project window/bar with editor? In eclipse there is button in project window called "link with editor". I would like to have exactly the same thing in PhpStorm.
Explanation:
Current active file opened in editor is automatically highlighted in project tree. If I change active file in editor to another, without even touching project window, it should change highlighted file as well. It should also keep current active file highlighted all the time if possible.
I didn't found such option in PhpStorm. If there is no such thing in PhpStorm, maybe there is plugin for that?
Just enable "Autoscroll from Source" in Project View side panel options (under "cog" icon or via right click on panel header/title)

PhpStorm - Highlight active file in project navigator

Does anyone know how to highlight the current file in the project navigator, or a hotkey to expand folders to the active file?
I have looked around and couldn't find anything that points to this as an option.
Here is a nice feature: Autoscroll to Source and Autoscroll from Source.
It is available in all IntelliJ products .
On Demand
Should be used if you do not like when your Project View panel gets changed/moves without your consent.
Navigate | Select in... | Project View
Alt+F1, 1 for Windows/Linux
⌥+F1, 1 (or fn+⌥ Opt+F1, 1) for Mac OS
You may also click on "target like" icon on actual Project View panel with your mouse:
If you wish to use shorter/single shortcut instead of standard 2-step shortcut:
install "Extra Actions" plugin
assign custom shortcut to newly provided "Select in Project" action
As of some 2017.x version (or maybe even 2016.x) the IDE has own dedicated Select in Project View action (so no need for additional plugin). You can find it in Keymap under the Other branch (hint: use search box to narrow the list).
Automatically
Can be used if you do not mind (or even want) to have Project View panel keep focused on currently edited file (so it scrolls/moves up and down/expands when needed).
NOTE: with frequently switching between the files (e.g. CSS & HTML) when you have a lot of files in your project such "scrolling" may become quite annoying pretty fast (especially if such files are located in the invisible-right-now part of the project tree).
Activate Autoscroll from Source option in Project View panel (right click on tool window header bar/title or use menu under "gear" icon):
In modern versions (2020.3 and newer) that option was renamed and is now called Always Select Opened File:
Just click the circular icon (with tooltip Scroll from Source) to navigate in the project directory tree and highlight the corresponding active file in the PhpStorm editor.
On PhpStorm 2020.3 you have to click the cog icon in the project pane and select Always Select Opened Files:
The above answers are all valid but unfortunately you'll have to enable them for each project.
There's a plugin from Jetbrains that will enable this behaviour by default for all new projects.
http://plugins.jetbrains.com/plugin/7575?pr=