Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cb505c

Browse files
committed
Add back keyboard shortcut and command handling for 'Send line to interactive'
fixesdotnet#392closesdotnet#470commita75cb38Author: latkin <latkin@microsoft.com>Date: Tue May 26 13:32:08 2015 -0700 Update w/ code review feedbackcommitd2e1591Author: latkin <latkin@microsoft.com>Date: Fri May 22 16:45:19 2015 -0700 Add back keyboard shortcut and command handling for 'Send line to interactive'
1 parent647787a commit0cb505c

File tree

5 files changed

+50
-21
lines changed

5 files changed

+50
-21
lines changed

‎vsintegration/src/vs/FsPkgs/FSharp.LanguageService/FSharp.LanguageService.Base/ViewFilter.cs‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ protected virtual int QueryCommandStatus(ref Guid guidCmdGroup, uint nCmdId)
436436
{
437437
return(int)OLECMDF.OLECMDF_SUPPORTED|(int)OLECMDF.OLECMDF_ENABLED;
438438
}
439+
elseif(nCmdId==(uint)Microsoft.VisualStudio.VSConstants.VSStd11CmdID.ExecuteLineInInteractive)
440+
{
441+
return(int)OLECMDF.OLECMDF_SUPPORTED|(int)OLECMDF.OLECMDF_ENABLED|(int)OLECMDF.OLECMDF_DEFHIDEONCTXTMENU;
442+
}
439443
}
440444
elseif(guidCmdGroup==guidInteractive)
441445
{
@@ -570,15 +574,20 @@ public virtual bool HandlePreExec(ref Guid guidCmdGroup, uint nCmdId, uint nCmde
570574
{
571575
if(nCmdId==(uint)Microsoft.VisualStudio.VSConstants.VSStd11CmdID.ExecuteSelectionInInteractive)
572576
{
573-
Interactive.Hooks.OnMLSend(GetProjectSystemPackage(),false,null,null);
577+
Interactive.Hooks.OnMLSend(GetProjectSystemPackage(),Interactive.FsiEditorSendAction.ExecuteSelection,null,null);
578+
returntrue;
579+
}
580+
elseif(nCmdId==(uint)Microsoft.VisualStudio.VSConstants.VSStd11CmdID.ExecuteLineInInteractive)
581+
{
582+
Interactive.Hooks.OnMLSend(GetProjectSystemPackage(),Interactive.FsiEditorSendAction.ExecuteLine,null,null);
574583
returntrue;
575584
}
576585
}
577586
elseif(guidCmdGroup==guidInteractive)
578587
{
579588
if(nCmdId==cmdIDDebugSelection)
580589
{
581-
Interactive.Hooks.OnMLSend(GetProjectSystemPackage(),true,null,null);
590+
Interactive.Hooks.OnMLSend(GetProjectSystemPackage(),Interactive.FsiEditorSendAction.DebugSelection,null,null);
582591
returntrue;
583592
}
584593
}

‎vsintegration/src/vs/FsPkgs/FSharp.VS.FSI/fsiBasis.fs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ module internal Guids =
5656
// some commands moved to VS Shell
5757
letguidInteractiveShell= Microsoft.VisualStudio.VSConstants.VsStd11
5858
letcmdIDSendSelection= int Microsoft.VisualStudio.VSConstants.VSStd11CmdID.ExecuteSelectionInInteractive
59+
letcmdIDSendLine= int Microsoft.VisualStudio.VSConstants.VSStd11CmdID.ExecuteLineInInteractive
60+
5961
// some commands not in VS Shell
6062
letguidInteractive= Guid("8B9BF77B-AF94-4588-8847-2EB2BFFD29EB")
6163
letcmdIDDebugSelection=0x01

‎vsintegration/src/vs/FsPkgs/FSharp.VS.FSI/fsiCommands.vsct‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
Ideally, we would bind it for F# only editor.
224224
-->
225225
<KeyBinding guid ="guidVSStd11" id ="cmdidExecuteSelectionInInteractive"editor="GUID_TextEditorFactory"key1="VK_RETURN"mod1="Alt" />
226+
<KeyBinding guid ="guidVSStd11" id ="cmdidExecuteLineInInteractive"editor="GUID_TextEditorFactory"key1="VK_OEM_7"mod1="Alt" />
226227

227228
<!-- CRTL-ALT-F for FSI window - following similar bindings for "other windows"-->
228229
<KeyBindingguid="guidFsiPackageCmdSet"id="cmdidFsiToolWindow"editor="guidVSStd97"key1="F"mod1="Control Alt" />
@@ -294,6 +295,7 @@
294295

295296
<GuidSymbolname="guidVSStd11"value="{D63DB1F0-404E-4B21-9648-CA8D99245EC3}" >
296297
<IDSymbolname="cmdidExecuteSelectionInInteractive" value ="0x018"/>
298+
<IDSymbolname="cmdidExecuteLineInInteractive" value ="0x019"/>
297299
<IDSymbolname="cmdidInteractiveSessionInterrupt" value ="0x01A"/>
298300
<IDSymbolname="cmdidInteractiveSessionRestart" value ="0x01B"/>
299301
</GuidSymbol>

‎vsintegration/src/vs/FsPkgs/FSharp.VS.FSI/fsiPackageHooks.fs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ module internal Hooks =
7272
letprivatewithFSIToolWindow(this:Package)f=
7373
queryFSIToolWindow this f()
7474

75-
letOnMLSend(this:Package)(debug:bool)(sender:obj)(e:EventArgs)=
75+
letOnMLSend(this:Package)(action:FsiEditorSendAction)(sender:obj)(e:EventArgs)=
7676
withFSIToolWindow this(fun window->
77-
if debugthen window.MLDebug(sender, e)
78-
else window.MLSend(sender, e)
77+
match actionwith
78+
| ExecuteSelection-> window.MLSendSelection(sender, e)
79+
| ExecuteLine-> window.MLSendLine(sender, e)
80+
| DebugSelection-> window.MLDebugSelection(sender, e)
7981
)
8082

8183
letAddReferencesToFSI(this:Package)references=

‎vsintegration/src/vs/FsPkgs/FSharp.VS.FSI/fsiSessionToolWindow.fs‎

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ module internal Locals =
7474
openUtil
7575
openLocals
7676

77-
// consumed by C#, so enum type used instead of union
7877
typeinternalFsiDebuggerState=
79-
| NotRunning=0
80-
| AttachedToFSI=1
81-
| AttachedNotToFSI=2
78+
| NotRunning
79+
| AttachedToFSI
80+
| AttachedNotToFSI
81+
82+
typeinternalFsiEditorSendAction=
83+
| ExecuteSelection
84+
| ExecuteLine
85+
| DebugSelection
8286

8387
[<Guid("dee22b65-9761-4a26-8fb2-759b971d6dfc")>]//REVIEW: double check fresh guid! IIRC it is.
8488
typeinternalFsiToolWindow()as this=
@@ -563,14 +567,18 @@ type internal FsiToolWindow() as this =
563567

564568
executeTextNoHistory interaction
565569

566-
letsendSelectionToFSI dbgBreak=
570+
letsendSelectionToFSI action=
571+
letdbgBreak,selectLine=
572+
match actionwith
573+
| ExecuteSelection->false,false
574+
| ExecuteLine->false,true
575+
| DebugSelection->true,false
576+
567577
try
568-
// REVIEW: See supportWhenFSharpDocument for alternative way of obtaining selection, via IVs APIs.
569-
// Change post CTP.
570578
letdte= provider.GetService(typeof<DTE>):?> DTE
571579
letactiveD= dte.ActiveDocument
572580
match activeD.Selectionwith
573-
|:? TextSelectionas selectionwhen selection.Text=""->
581+
|:? TextSelectionas selectionwhenselectLine||selection.Text=""->
574582
selection.SelectLine()
575583
showNoActivate()
576584
executeInteraction dbgBreak(System.IO.Path.GetDirectoryName(activeD.FullName)) activeD.FullName selection.TopLine selection.Text
@@ -587,13 +595,16 @@ type internal FsiToolWindow() as this =
587595
// REVIEW: log error into Trace.
588596
// Example errors include no active document.
589597

590-
letonMLSend(sender:obj)(e:EventArgs)=
591-
sendSelectionToFSIfalse
598+
letonMLSendSelection(sender:obj)(e:EventArgs)=
599+
sendSelectionToFSIExecuteSelection
592600

593-
letonMLDebug(sender:obj)(e:EventArgs)=
601+
letonMLSendLine(sender:obj)(e:EventArgs)=
602+
sendSelectionToFSI ExecuteLine
603+
604+
letonMLDebugSelection(sender:obj)(e:EventArgs)=
594605
if checkDebuggability()then
595606
attachDebugger()
596-
sendSelectionToFSItrue
607+
sendSelectionToFSIDebugSelection
597608

598609
/// Handle UP and DOWN. Cycle history.
599610
letonHistory(sender:obj)(e:EventArgs)=
@@ -631,8 +642,9 @@ type internal FsiToolWindow() as this =
631642
do this.BitmapIndex<-0
632643
do this.Caption<- VFSIstrings.SR.fsharpInteractive()
633644

634-
memberthis.MLSend(obj,e)= onMLSend obj e
635-
memberthis.MLDebug(obj,e)= onMLDebug obj e
645+
memberthis.MLSendSelection(obj,e)= onMLSendSelection obj e
646+
memberthis.MLSendLine(obj,e)= onMLSendLine obj e
647+
memberthis.MLDebugSelection(obj,e)= onMLDebugSelection obj e
636648

637649
memberthis.GetDebuggerState()=
638650
let(state,_)= getDebuggerState()
@@ -709,8 +721,10 @@ type internal FsiToolWindow() as this =
709721
addCommand Guids.guidFsiConsoleCmdSet Guids.cmdIDAttachDebugger onAttachDebugger None
710722
addCommand Guids.guidFsiConsoleCmdSet Guids.cmdIDDetachDebugger onDetachDebugger None
711723

712-
addCommand Guids.guidInteractiveShell Guids.cmdIDSendSelection onMLSend None
713-
addCommand Guids.guidInteractive Guids.cmdIDDebugSelection onMLDebug None
724+
addCommand Guids.guidInteractiveShell Guids.cmdIDSendSelection onMLSendSelection None
725+
addCommand Guids.guidInteractiveShell Guids.cmdIDSendLine onMLSendLine None
726+
727+
addCommand Guids.guidInteractive Guids.cmdIDDebugSelection onMLDebugSelection None
714728

715729
addCommand guidVSStd2KCmdID(int32 VSConstants.VSStd2KCmdID.UP) onHistory(Some supportWhenInInputArea)
716730
addCommand guidVSStd2KCmdID(int32 VSConstants.VSStd2KCmdID.DOWN) onHistory(Some supportWhenInInputArea)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp