Shortcut toggle between debug configuration - visual-studio-code

has anyout anyone found a way (shortcut or navigation) without using the mouse to select different configurations before starting the debugger.
Is it also possible, when debugging multiple configurations, to select them without using the mouse.
Thank you.

Part (to start debug) is done with 1.10.1
https://code.visualstudio.com/updates/v1_10#_debugging
Ability to select and start a launch using keyboard The option to
launch debug configurations using just the keyboard (no mouse gesture
necessary) was added, as per this request. It works similarly to
running tasks, with an ability to launch a debugging session from the
Command Palette. The keyword 'debug ' or the command Debug: Select and
Start Debugging from the Command Palette is used to select and launch
a configuration from launch.json.

You can register a custom keybinding for
command: workbench.action.debug.selectandstart
when: !inDebugMode

Related

How to show both internal terminal and debug console in vscode?

I need to debug a program on a server and would like to still have its output in GDB.
The following "works" in general:
manual started (terminal) task that opens a ssh connection, does the necessary pre-setup (server-side scripts), then runs gdbserver --multi :12345
GDB debug configuration that runs in attach mode and executes the appropriate command chain "set sysroot remote:", "target extended-remote myserver:12345", "set remote exec-file /path/to/myfile", "run"
I know see the program running and stopping on the breakpoint, see the program's output in the integrated terminal and can toggle to the debugging console. But how can I see both the debugging console and the integrated terminal at once?
If somehow possible I'd like to not use an external window for one of those, as there are multiple vscode instances open - each connecting to a different server - and multiple windows "mgically" belonging to each other would make debugging harder together - the integrated option solves this problem completely.
The Views and Panels (Problems - Terminal - Output - Debug console) can be moved.
Click on the header/Tab of the View/Panel and drag the mouse to the new location.
The mouse pointer will change if it is possible to drop it.
You can restore a panel/view to the original location from the context menu on the top-bar.
I have looked in the doc but could not find any mentioning of this. It was mentioned in one of the Release notes.

VS Code Terminal Not Allowing Typing

My VS code terminal was working fine, until one day when I tried to work on a project, that was still open in VS code, my terminal didn't allow me to type any commands. I couldn't type anything. This is the screen that I get.
Okay, for those of you struggling with the same problem, I've managed to solve it by clicking on the drop-down menu that says powershell and changing it to cmd.
this happened to me and simply
close vs code
right click on it
run as administrator
open the terminal and it will work
this problem happened when I changed the default path of CMD
For me, I tried using Powershell/CMD/Bash and I was having errors/blank terminal. I found typing echo hello and pressing CTRL + C made it appear. So in fact, everything was working, my terminal was just blank/glitched out, but was really accepting input.
I had a similar issue when running ionic serve command which runs the development server on the localhost. I paid attention after executing the command above, and it said:
Use Ctrl+C to quit this process
Pressing Ctrl+C then displays:
Terminate batch job (Y/N)?
Type Y or y
then the command prompt is shown again!
Here is a sample terminal window - trimmed for brevity:
For who has this problem using React. This happens when you start a live version using npm start. The terminal that handles the live version of the app cannot be used for anything else.
So to continue using the terminal you need to open a new terminal to use in parallel. To do so just click on the plus icon in the top right corner of the terminal panel then choose the "Power Shell" option. This will open a new terminal without restarting visual studio.
In Mac, when working with Python, this helped me: instead of clicking on the "Run Code" option, click on "Run Python file", in the right corner.
For Ubuntu users this is solved by this solution:
File -> Preferences -> Setting -> Features -> Terminal -> Inherit Env
I found two vscode on my desktop, I opened the other one and it worked. Looks like I updated it but the older one didn't disappear.
If typing Ctrl+C can help to get out of this frozen state, that will be easier to do with VSCode 1.64 (Jan. 2022)
The terminal can type the answer for you.
Terminal -- Auto-reply
The terminal is now able to automatically reply when a specific sequences of characters is received.
A good example of where this is useful, which is also the only default case, is the Windows batch script message Terminate batch job (Y/N)? after hitting Ctrl+C when running a batch script.
This typically just ends up causing problems for the user.
The terminal will now automatically reply with Y and enter (\r) which makes Ctrl+C in Windows feel much better.
Pressing Ctrl+C will immediately reply to the question and return to the prompt:
Theme: Sapphire
The feature was made generically so you can setup custom replies for other thing, just be careful when doing this as you are sending text to the process automatically.
For example you could use it to automatically update Oh My Zsh when prompted:
"terminal.integrated.autoReplies": {
"[Oh My Zsh] Would you like to check for updates? [Y/n]": "Y\r"
}
If you use Clink and enable their similar feature, you can disable it in Clink or in VS Code by setting the reply to null to avoid the two features conflicting with each other:
"terminal.integrated.autoReplies": {
"Terminate batch job (Y/N)": null
}
Go to terminal, preferences, settings.
Check "run code in terminal"
Restart VS.
I changed from bash to powershell in terminal first but the command prompt still not shown.
Then I navigate to File -> Perferences -> Settings and it starts working (command prompt shown)
This seems to just be a display problem. It happened to me when I changed my display settings for desktop icon and app scaling settings.
I managed to fix the problem by simply restarting my computer and re-opening VS code
I had the same problem ... In my case just run vs-code as administrator and works

How to stop/disable PyUnit when using PyDev

I would like to have PyUnit stop showing up each time I hit CtrlF11. It's distracting and I don't understand it's output anyways, nor did I (knowingly) elect to enable it. I can't find anything in PyDev settings.
Ctrl + F11 has actually nothing to do with PyUnit. It is a key binding that per default runs the script you last launched. In your case the last launch you made must have been a PyUnit launch. If you would have launched the script with Run As then this would be launched if you press Ctrl + F11.
This could be a possible solution to your problem:
Remove the PyUnit launcher from Run History (Run -> Run Configurations and then delete the the configurations listed below Python unittest.
Hope that helped!
Cherio Woltan
Actually, in the PyDev > PyUnit settings (in the same screen you've shown), if you uncheck the 'show the results in the unittest results view', it should do what you want (i.e.: stop showing the PyUnit view)... or that's not what you wanted?

Are there any good ssh consoles for Eclipse?

I'm looking for a good ssh console plugin for Eclipse, and can't find much at all. Would anyone have some good leads on one?
If you don't like the ssh.shells or ssh.terminals subsystems in Eclipse RSE, try using the Terminal View instead.
Open up Window -> Show View -> Other (or press Shift+Alt+Q then Q)
Type Terminal in the search box
Select the Terminal view listed under the Terminal folder
You'll see a window that looks similar to RSE's ssh.terminals subsystem... but with some extra buttons on the top right.
How to use it:
To fix the scrolling issue (ie: for programs like top), click the Scroll Lock button at the right.
For extra Terminal window tabs, click the down arrow on the New Terminal Connection button
To change the current terminal window's settings, use the Settings button.
If you really like the annoying command input box at the bottom, you can toggle it on and off with the appropriate button.
Change the Background Color:
For some reason, the default setting is to use a terribly hard to see white background. To change this:
Go to Window -> Preferences
Type Terminal in the search box at the top left, or select Terminal on the left.
Check the box that says Invert terminal colors
You can also configure a larger terminal buffer or connection timeouts here
Click Apply
Now the terminal should have a black background! If you want a local terminal, you can enable ssh on your local machine, and connect to localhost.
In Eclipse 3.4.1, there is the Remote Systems Explorer perspective that allows you to create and connect to SSH terminals (here)
There are plugins that exist that allow you up open WinSCP or Putty from within Eclipse.
I would advise maybe doing a search for "putty eclipse plugin" or similar
You can also try the Terminal plug-in for Eclipse
This plug-in provides a fully-working, command-line terminal to
Eclipse 3.7 or later (yes, even 4.2!) It works on Linux and MacOS
only.
More info at: http://alexruiz.developerblogs.com/?p=2428

Eclipse - Running programs not in the native eclipse console

I'm currently writing some ncurses code and the native Eclipse (3.2.2) console can't display its graphics. I'd instead like to run the program through xterm. What I want is to be able to start xterm and run from there. I'd prefer to not get involved with any plugins or that jazz. Just something simple.
EDIT
So I have the answer and it was pretty simple...
Run -> External Tools -> External Tools -> New Launch Config...
Then select location of your terminal emulator. /usr/bin/gnome-terminal in my case.
after that set the appropriate arguments. "-e ~/ncurses/start" in my case.
Then make sure you aren't allocating a console by unchecking that option in the "Common" tab.
Annon add to his question:
its a pain to keep switching back and forth from eclipse and the terminal. I'm looking for a way to just hit something like"F5" and have it run my ncurses program in a new xterm terminal process
The simplest way to do that is to report the command line into an external tool configuration, and point eclipse to use a shell (like described in this program)
In the argument, you will add the command line eclipse execute (command line which can be retrieved as mentioned in the second part of this answer below).
Of course, replace 'cmd.exe' by the shell of your choice, and try not setting the 'Allocate Console' checkbox in the Common tab of that external launcher.
To launch through a xterm, without eclipse involved (not what you are asking for, just keep here for archive)
You can launch your program through Eclipse (Run Configurations), and observe through a 'ps' command the exact Java command line used.
Or launch it in debug mode, and right click the task in Debug view and open Properties. It will show the command line, as documented here.
Then launch that command line directly in your console (Eclipse being not involved at all at this point).