views:

54

answers:

2

Hi, Very new to F#. Installed F# 2.0, created a F# Application, with some simple code, compiled it and it works fine. If I hightlight some F# code in VS 2008 and hit Alt+Enter (which every page says do) to get it to run interactively then nothing happens. Any ideas why this shortcut is broken? Is there another way round piping the highlighted code to the FSI?

Thanks

A: 

Probably the shortcut is broken. Some DevExpress tools break it. If that's the case, you need to reassociate Alt+Enter with EditorContextMenus.CodeWindow.SendToInteractive (it might have a slightly different name in VS2008), under Tools->Options->Keyboard.

Mau
Alt-Enter also has a default keybinding in VS, so it may be that it never got reassigned in the first place.
Matthew Scharley
Resharper breaks it too, as alt-enter is auto fix in Resharper, rebinding one or the other as described is the solution.
Robert
+1  A: 

Sometimes I notice that Alt-Enter will only work if the FSI window/pane is already open (Ctrl-Alt-F or View/Other Windows)

Also note than when trying to run applications (i.e. multiple files) from FSI, you can come up against nasty problems with namespaces (see here).

Benjol
Yes, VS2008 and VS2010 have this behavior - make sure that F# Interactive toolwindow is opened before trying the shortcut.
Mitya