3

TL;DR: how can I send a selection from the C# editor to the C# Interactive window?

The C# Interactive help screen (after typing #help) shows a bunch of keyboard shortcuts, among which:

Ctrl-K, Ctrl-Enter Paste the selection at the end of interactive buffer, leave caret at the end of input.
Ctrl-E, Ctrl-Enter Paste and execute the selection before any pending input in the interactive buffer.

The first of these, Ctrl-K, Ctrl-Enter always gives:

The key combination (Ctrl+K, Ctrl+Enter) is bound to command (.InteractiveConsole.CopyToInteractive) which is not currently available.

The message suggests it is bound correctly, but it never sends anything to the C# Interactive window, regardless of me having the focus on a C# source file and an active selection.

The second command, Ctrl-E, Ctrl-Enter always shows: The key combination (Ctrl+E, Ctrl+Enter) is not a command.

How do I use this key combination (send current selection to C# Interactive) correctly? What am I missing here? Can I use a different key combination or binding?

Abel
  • 56,041
  • 24
  • 146
  • 247
  • 1
    "The second command, `Ctrl-E, Ctrl-Enter` always shows The key combination (Ctrl+E, Ctrl+Enter) is not a command" -- For me this is because that key binding does not exist. Go to `Tools->Options-Envrionment->Keyboard`, look for "InteractiveConsole.ExecuteInInteractive": the default is `Ctrl+E, E`, and it works for me. I added a binding for `Ctrl+E, Ctrl+Enter` and it also works. So this issue is just that `#help` has the keybindings hardcoded and it does not look up what the *actual* binding is and display it to you. – Quantic Jan 06 '17 at 17:54
  • 2
    @Quantic, tx (sorry I missed your comment earlier), indeed `Ctrl+E, E` seems to be the default binding **and that one works!**. Must be a bug then that CSI shows something else (even if hardcoded, it ought to be hardcoded with the defaults, I'd say). Still wondering about the other one. – Abel Jan 09 '17 at 15:45
  • Note that I did I try changing the "InteractiveConsole.CopyToInteractive" keybindings with no luck, and I tried changing the source from "Text Editor" to "CSharp Editor" and "Global", also with no luck. It appears that the "which is not currently available" message occurs when the destination "thing" (window in this case, I think) isn't found, so I'm assuming there's a bug in that command where it's not finding the interactive window correctly unlike the "ExecuteInInteractive" command which finds it fine. – Quantic Jan 09 '17 at 16:02
  • @Quantic, tx for researching this further. I should probably report it somewhere at-microsoft. – Abel Jan 09 '17 at 16:46

0 Answers0