Visual Studio Code view command run by last input - visual-studio-code

I'm trying to figure out which editor command is used when I press keys in different contexts. For example, I want to know which editor command is run when I press DownArrow while the quick fix widget is open, as shown:
How can I find out which command is run when I press a key in VS Code? The Keyboard Shortcuts search-by-key capability does not solve my problem.

Related

How to Show Code Runner Shortcut In VS Code

How can I show the Code Runner shortcut in Visual Studio Code if I mistakenly hid it?"
I was using Visual Studio Code and I accidentally hid the Code Runner shortcut. Is there a way to show it again? I have tried searching in the keyboard shortcuts settings but can't seem to find it. Any help would be appreciated (P.S I Know Many Of You will Say Use a Shortcut Key, or Reinstall the CodeRunner & VS Code But All Is Not Working)
How Can I get Code runner Shortcut Again
Make sure that you enabled your "Code Runner" extension
Go to the top right corner of VS Code to find a button that looks like three dots (...)
Right click on it and press "Run Code"
The Run Code button should reappear now

Alt-based shortcuts in VS Code's intergrated terminal

My shell is configured to have Alt+n and Alt+p navigate in history (technically, using zsh's history-beginning-search-forward and history-beginning-search-backward).
I used to be able to use these shortcuts in VS Code's integrated terminal, but since I upgraded to VS Code 1.74.1, the Alt+n and Alt+p seem to be catched by VS Code before reaching my shell (the cursor changes to a cross to allow rectangular selection when I press Alt, which I guess is the cause). I do have "terminal.integrated.sendKeybindingsToShell": true and "terminal.integrated.allowMnemonics": false in my settings to avoid interference between VS Code and the Alt key, and I couldn't find another setting to change the behavior. Surprisingly, the Alt+a command is passed to the shell, so some Alt-based shortcuts are passed to the shell, but not all.
Is it possible to configure VS Code to send Alt+n and Alt+p to my shell?
As a workaround, using Alt+Shift+n and Alt+Shift+p seem to work, but that's one extra key to teach my fingers to use :-(.

How do I switch terminals in Visual Studio code using a keyboard shortcut?

I would like to be able to switch between terminal panes in VSCode using a keyboard shortcut. I am on a Mac.
I have opened keyboard shortcuts (Commandkey+K, Commandkey+S) and found the workbench.action.terminal.focusNextPane setting:
where it states quite clearly what the keyboard shortcut should be (option+command+downarrow or option+command+leftarrow) but neither of those work. They DO work when focus is in the editor and I want to switch between panes there, but not working when the focus in the terminal.
Not sure what I'm doing wrong but I hope I'm missing something obvious. Can anyone explain?
The commands you are looking at (Terminal: Focus Next Pane and Terminal: Focus Previous Pane) are to switch between split terminal panes.
The commands to switch between terminals are:
Terminal: Focus Next Terminal
workbench.action.terminal.focusNext
Terminal: Focus Previous Terminal
workbench.action.terminal.focusPrevious
both of which are unbound by default.

VS code: Pressing tab key for auto-completion would exit terminal

In my VS code terminal, pressing tab key for auto-completion would exit the terminal and select other components of VS code. How can I stop it? I was testing different shortcuts. I must have accidentally done something wrong.
Find the answer here. https://code.visualstudio.com/docs/editor/accessibility#_tab-trapping
Click Tab move focus in the center of the bottom bar.

How to run the select code in VScode?

I want to run the select code of python in VScode. Till now, I have to copy the code and paste it in the terminal below to run. The system is mac OS.
So is there any way to run the code directly after I selected the code? For example, like the shortcuts.
Thanks.
There is no default keybindings for command "Run Selected Text in Active Terminal", but you can create one.
Press Ctrl+K, Ctrl+S to open File → Preferences → Keyboard Shortcuts.
Search for workbench.action.terminal.runSelectedText in keybindings.
Press the icon on the left to open a windnow with this message "Press desired key combination..." and make your choice. (I've pressed Ctrl+Alt+R - as this combination was not used yet.)
Press Enter to store your keybinding.
Tested on VSCode 1.30.2 on Windows 10 Pro.
#yanachen, this is now possible in VS Code. All you need to do is:
1. Ensure python is running in the VS Code terminal window
2. Select the text you wish to execute in python
3. Invoke the command 'workbench.action.terminal.runSelectedText' as defined in the following link:
https://code.visualstudio.com/docs/editor/integrated-terminal#_key-bindings
Now it's supported by default shortcut "shift" + "enter".
select the proper code snippet
press "shift" + "enter"
Here is the setting for running selection in "interactive window."
In my VS Code (version 1.56.2), I do the following things: go to Settings, search for interactive window, in the resulting left panel choose Jupyter, and finally check the box next to Jupyter: Send selection to interactive window. That's it. One more step for some users (including me) is to modify the keybinding for running selection to your preference. For example, got to keyboard shortcuts, type run selection, you should see a list of keybindings and you may need to redefine them if conflicts exist.
Some language specific extensions have already an existing keybinding.
On Windows, for the PowerShell extension it is currently F8 to run the selected text.
Install the vscode extension Node.js Exec. then select the block of code you want to run and press f8. worked for me.