Opening file in VSCode Explorer using keyboard - visual-studio-code

When I press Command+Shift+E (Mac) to set focus to the explorer in Visual Studio Code, I can navigate using the up and down keys to select a file, but I can't open the file in the editor. I can press Enter to rename it, but I couldn't find a way to open the file using the keyboard. Is there a way?

Correct shortcut to open a file is: CMD+down
Just for the record, this is the standard shortcut in any properly behaving OSX application, for example Finder.app (and it's the reason why Return/Enter renames a file)

Related

Vscode duplicate current open file to new window on right shortcut key

I was using visual studio code and wanted to open the current open file in duplicate window on the right.
Is there a shortcut key for this?
You can use Ctrl+\
This will duplicate the window and open the current file in a window on the right, and you can access the windows using Ctrl+1 and Ctrl+2 to switch between left and right.

Keyboard shortcut to switch from source control "diff" mode back into normal editing?

When I select a file from the source control panel (in my instance I'm using git), it then opens the side-by-side changes for that file.
I'm aware you can edit the file on the right hand side, but is there a quick way to close the open tab and open the original file itself? Preferably a keyboard shortcut.
The shortcut I'm presenting as a solution is slightly long but will work for sure.
As soon as you open the file from the source control panel use the following shortcuts to copy the file's relative path
Windows/Linux ctrl+k Mac cmd+k immediately followed by ctrl+shift+c \ cmd+shift+c
This will copy the relative path of the file
you can then use the command ctrl+f4 / cmd+f4 to close the opened history view of the file
then open the command palette using ctrl+shift+p / cmd+shift+p and remove the > character and paste the relative path of the file using ctrl+v / cmd+v
When you open the file in the diff view take care not to click the cursor within the editor as this will move to editor focus. When in editor focus the command to copy the relative path will not work. However this can be fixed by changing this in the keyboard shortcut settings.

Ctrl + Click to open a file

Is there a way to be able to open file in code by using Ctrl + Click on file name inside the editor without select from files side panel or using quick open panel Ctrl+P
You can open a file from within code via Ctrl + Click as long as you have editor.links set to true in your settings.json.
{
"editor.links": true
}
or
Note: This functionality is not supported for all languages. When I tested it initially I was looking at HTML. Check the extension marketplace and you might find something that supports the language you are using. For example, the Open File From Path extension works for PHP.
For other ones looking for extensions, I suggest this one:
Open file (by Frank Stuetzer)
I was looking for extensions to open files from path in my pipelines written in yaml files and it works pretty well! :)
You just have to position your cursor under the filename and press alt+P (or right click and "open file under cursor")

Visual Studio code always opens the wrong file for me

I have a very weird problem with Visual studio code (Version 1.20.1 (1.20.1)).
In full screen mode on a Mac. (High Sierra) when I double click a file. it always opens the file above it. Meaning that it opens the wrong file (not the one which I double clicked).
Please have a look at this video which I recorded.
https://youtu.be/VG8-AnEpZjY
The video starts with me double click on the file "Tables.scala" but the editor opens the file "ScanFromCassandra" which is above it.
Then I double click Models.scala and it opens the file correctly.
Then I double click Config.scala but the editor opens CommonFlow.scala
This is very very annoying. I don't know if anyone else is facing this issue or not.
Edit:: If I switch off the "open editors" window, then the issue disappears. but I like the "open editors" window. I think the open editors window causes some kind of "jumping" in vscode making it open wrong files.
Actually I figured out the answer after using the editor for some time.
in VSCode when trying to open files in the "explorer" we have to single click on the file name. not double click.
If I single click on the file name it works perfectly.
The problem comes when I double click but that's not required. a single click on the file name to open it works smoothly.

In RubyMine, how to preview a file's contents by selecting it like in Sublime Text?

I'm new to RubyMine 7 on Mac.
I used to use Sublime Text 3 and I love RubyMine so far except its lack of file previewing.
In Sublime Text, when clicking a file in the sidebar (file explorer), the selected file content shows in an editor tab for temporary viewing.
If I select another file, then the same tab changes to the content of the newly selected file.
I've been searching for this preference setting in RubyMine, or in a plugin, but I've had no luck.
A similar feature is "Autoscroll to source" but this feature opens files rather than previewing them.
If anyone knows how to do Sublime Text-like file content previewing in RubyMine, I'd appreciate it.
RubyMine doesn't have a feature exactly like Sublime Text file previewing.
The Quick Definition action can sometimes meet the same need. When invoked on a file, it opens a popup with the file's contents. You can invoke it on a file in the Project or Find pane and probably other panes, dialogs, popups, etc. that list files. (You can also invoke it in an editor on an identifier such as a class, module, or variable; it will show the code that defines the identifier.) Invoke Quick Definition with ⌥-space or ⌘Y in the Mac OS X 10.5+ keymap; use ^⇧I on Windows or check Preferences → Keymap for other keymaps, or use ⇧⌘A qd ⏎. Hit Escape or click outside the popup to close it.
When you invoke Quick Definition on a file in the Project pane and navigate to other files in that pane (with down and up arrows to move between files, and right and left arrows or Enter to open and close directories), the Quick Definition popup will stay open and update to the currently selected file, which is relatively close to Sublime Text file previewing. You can also hit Enter to open a file, F4 to open a file and move focus to the editor, edit the file, ⌘1 to jump back to the Project pane, etc., all with the Quick Definition popup still open, until you choose to close it.
If that isn't close enough, there are two feature requests for Sublime Text-like file previewing in JetBrains IDEs which you can vote for:
Preview currently selected file in project window
File Preview features from Sublime