Command vs. Immediate Window in Visual Studio - visual-studio-2010

The Command Window and the Immediate Window seem to do very similar things (for example, I can display variables in both windows by typing ? myVariable). What are the differences and why does Visual Studio include both?

They do different things.
Immediate window:
The Immediate window is used at design time to debug and evaluate expressions, execute statements, print variable values, and so forth. It allows you to enter expressions to be evaluated or executed by the development language during debugging.
Command window:
The Command window is used to execute commands or aliases directly in the Visual Studio integrated development environment (IDE). You can execute both menu commands and commands that do not appear on any menu.
The immediate window is a debugging aid.
The command window lets you execute commands (say menu items) at any time.
Though they share some functionality they each have a separate focus.

Adding to the "difference"
Immediate window: has all the functionality of the Command Window as long as it starts with ">".
Command window: does not have other functionality since it can't start with anything but ">".
P.S. Visual Studio includes both as in developing mode you can use practically only Command Window, since you need the debugging mode to be active in order to use the functionalities of the Immediate Window(which at any time can use the Command Window).
In short, have Command Window in Developing Mode and Immediate Window in Debugging Mode.

Related

Use ctrl-j and ctrl-k to navigate menus in Visual studio

I normally use vim, but sometimes it's convenient to use Visual Studio 19.
I'm trying to keep my keybindings as consistent as possible between the two.
In vim I use ctrl-p to open a file by typing its name. I switched visual studio to use the vscode keymap defaults to get this behavior (vscode also uses ctrl-p for searching by filename). However, when using the dropdown list for this search, I'd like to be able to highlight a different item by using ctl-j and ctrl-k to move up and down, similar to how fzf works in vim.
Is this a key binding I can set, and if so, what is it called?
I used AutoHotKey with this script
#NoEnv
#SingleInstance, force
#Warn
;#IfWinActive, ahk_exe devenv.exe
^h::Send {Left}
^j::Send {Down}
^k::Send {Up}
^l::Send {Right}
Capslock::Esc
;:#IfWinActive
if you want it only to happen when you have vs2019 up, then uncoment the #IfWinActive, by removing the ; , however, I want to be able to use the bindings whenever, not just in VS
You can compile the script and then put them into your start up by pressing Win-R to open the run command dialog, then entering in
shell:startup
and it will open an explorer window to your startup, just drop the exe in there afterwards, and it should start up every time.
you can also create hotkeys for doing other things, like added my VS path to my PATH environment variable, then had autohotkey assign Win-S to open up devenv.exe with this script.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %userprofile% ; Ensures a consistent starting directory.
#s::
Run, *RunAs devenv.exe
Return

How can I get command history for console-based debugging in PyCharm?

When I use PyCharm I find myself frequently trying out pieces of code interactively. So far, my workflow has been to use pdbfor this and set a breakpoint as pdb.set_trace, which then drops me into the console.
However, for PyCharm the resulting console has no command history - the up arrow instead moves the cursor upwards into the previous output, which is a pain to use.
I realize there's also the built-in debugger that has a console with history, but getting there involves more clicks (run the debugger, switch to Console tab and clicking on "Show Python Prompt").
There is a built-in console that does have a command history (Tools > Python Console), however, unfortunately that's not the console that's being run for pdbbreak points. Is it possible to get PyCharm to use a different console for pdb?
No, it's not possible. PyCharm has no control over what happens when you invoke pdb.set_trace().

What is the difference between Immediate Window and Command Window in VisualStudio?

In VisualStudio the Immediate Window is used to debug and evaluate expressions, execute statements, print variable values, and so forth. It allows you to enter expressions to be evaluated or executed by the development language during debugging. (see MSDN)
The Command Window is used to execute commands or aliases directly in the Visual Studio integrated development environment (IDE). (see MSDN too)
Knowing that we can execute the Command Window commands from the Immediate Window by preceding the command by ">"
My question is what's the difference then, why they are both their ? Are there additions in the Command Window that are not accessible or available in the Immediate Window ? Can I just keep using the Immediate Window for both purposes ? (I mean is it just sufficient and enough ?).

Xamarin Studio fails to execute code with login shell in Mac Terminal

I'm new to Xamarin on the Mac, and I'm running into some issues running my code. I don't think it should matter, but I'm using the D language plugin to develop my code.
When Terminal is set to Shells open with: Default login shell (which is zsh in my case, but bash results in the same issue), hitting the execute button causes Xamarin Studio to pop up a Terminal window which closes before it can do anything, and then Xamarin Studio reports Cannot execute "blah". ScriptError. I added an infinite loop at the beginning of my program to make sure the shell isn't exiting because the program terminated quickly, and sure enough the program seems not to be starting at all.
If I instead tell Terminal Shells open with: Command (complete path): /opt/local/bin/zsh, the terminal happily opens up and the window is named correctly as "Xamarin Studio External Console" but of course nothing is executed except for the shell itself.
Any way to debug or fix this would be greatly appreciated!
MonoDevelop/XamarinStudio uses xterm by default. Dunno if that piece of info might help.

Opening console applications in powershell

I'm currently developing a win32 console application, and wondering if there is any way to make visual studio open it in powershell instead of cmd.exe when I'm debugging it.
All I really want is a better shell, where I can copy/paste etc. without clicking.
Thanks
I think you're mixing up the NT console subsystem (an app framework offerring common services) with cmd.exe (an application consuming those services.) When visuals studio runs a console application, it's not actually running CMD. CMD is a console application itself, no different than the app you are trying to debug, therefore running your application "in powershell" is equally as mistaken a concept.
If you mean trying to run it in PowerShell ISE, this is impossible. ISE is a Windows Application (NT GUI subsystem), which is an entirely different subsystem than that of the console.
-Oisin
You can try this.
Go to properties of your console project.
In Debug tab select Start external program and enter path to powershell.exe (C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe)
Enter ".\YourApp.exe" into Command line arguments
This starts your app in powershell. However it breaks a lot of things (like debugging, ...)
In Visual Studio goto Tools > External Tools...
In this window you can change the Title to Powershell. Set the Powershell Startup to execute and the check the output window box and it will dump all the output that would typically goto cmd into Powershell.
This link will explain it a little bit more for you.

Resources