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

Commitd2e1591

Browse files
committed
Add back keyboard shortcut and command handling for 'Send line to interactive'
1 parent647787a commitd2e1591

File tree

5 files changed

+43
-18
lines changed

5 files changed

+43
-18
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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ 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+
| FsiEditorSendAction.ExecuteSelection-> window.MLSendSelection(sender, e)
79+
| FsiEditorSendAction.ExecuteLine-> window.MLSendLine(sender, e)
80+
| FsiEditorSendAction.DebugSelection-> window.MLDebugSelection(sender, e)
81+
|_-> ignore()// appease 'missing match case' warning
7982
)
8083

8184
letAddReferencesToFSI(this:Package)references=

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ module internal Locals =
7474
openUtil
7575
openLocals
7676

77-
// consumed by C#, so enumtype used instead ofunion
77+
// consumed by C#, so enumtypes used instead ofunions
7878
typeinternalFsiDebuggerState=
7979
| NotRunning=0
8080
| AttachedToFSI=1
8181
| AttachedNotToFSI=2
8282

83+
typeinternalFsiEditorSendAction=
84+
| ExecuteSelection=0
85+
| ExecuteLine=1
86+
| DebugSelection=2
87+
8388
[<Guid("dee22b65-9761-4a26-8fb2-759b971d6dfc")>]//REVIEW: double check fresh guid! IIRC it is.
8489
typeinternalFsiToolWindow()as this=
8590
inherit ToolWindowPane(null)
@@ -563,14 +568,12 @@ type internal FsiToolWindow() as this =
563568

564569
executeTextNoHistory interaction
565570

566-
letsendSelectionToFSI dbgBreak=
571+
letsendSelectionToFSIselectLinedbgBreak=
567572
try
568-
// REVIEW: See supportWhenFSharpDocument for alternative way of obtaining selection, via IVs APIs.
569-
// Change post CTP.
570573
letdte= provider.GetService(typeof<DTE>):?> DTE
571574
letactiveD= dte.ActiveDocument
572575
match activeD.Selectionwith
573-
|:? TextSelectionas selectionwhen selection.Text=""->
576+
|:? TextSelectionas selectionwhenselectLine||selection.Text=""->
574577
selection.SelectLine()
575578
showNoActivate()
576579
executeInteraction dbgBreak(System.IO.Path.GetDirectoryName(activeD.FullName)) activeD.FullName selection.TopLine selection.Text
@@ -587,13 +590,16 @@ type internal FsiToolWindow() as this =
587590
// REVIEW: log error into Trace.
588591
// Example errors include no active document.
589592

590-
letonMLSend(sender:obj)(e:EventArgs)=
591-
sendSelectionToFSIfalse
593+
letonMLSendSelection(sender:obj)(e:EventArgs)=
594+
sendSelectionToFSIfalsefalse
595+
596+
letonMLSendLine(sender:obj)(e:EventArgs)=
597+
sendSelectionToFSItruefalse
592598

593-
letonMLDebug(sender:obj)(e:EventArgs)=
599+
letonMLDebugSelection(sender:obj)(e:EventArgs)=
594600
if checkDebuggability()then
595601
attachDebugger()
596-
sendSelectionToFSItrue
602+
sendSelectionToFSIfalsetrue
597603

598604
/// Handle UP and DOWN. Cycle history.
599605
letonHistory(sender:obj)(e:EventArgs)=
@@ -631,8 +637,9 @@ type internal FsiToolWindow() as this =
631637
do this.BitmapIndex<-0
632638
do this.Caption<- VFSIstrings.SR.fsharpInteractive()
633639

634-
memberthis.MLSend(obj,e)= onMLSend obj e
635-
memberthis.MLDebug(obj,e)= onMLDebug obj e
640+
memberthis.MLSendSelection(obj,e)= onMLSendSelection obj e
641+
memberthis.MLSendLine(obj,e)= onMLSendLine obj e
642+
memberthis.MLDebugSelection(obj,e)= onMLDebugSelection obj e
636643

637644
memberthis.GetDebuggerState()=
638645
let(state,_)= getDebuggerState()
@@ -709,8 +716,10 @@ type internal FsiToolWindow() as this =
709716
addCommand Guids.guidFsiConsoleCmdSet Guids.cmdIDAttachDebugger onAttachDebugger None
710717
addCommand Guids.guidFsiConsoleCmdSet Guids.cmdIDDetachDebugger onDetachDebugger None
711718

712-
addCommand Guids.guidInteractiveShell Guids.cmdIDSendSelection onMLSend None
713-
addCommand Guids.guidInteractive Guids.cmdIDDebugSelection onMLDebug None
719+
addCommand Guids.guidInteractiveShell Guids.cmdIDSendSelection onMLSendSelection None
720+
addCommand Guids.guidInteractiveShell Guids.cmdIDSendLine onMLSendLine None
721+
722+
addCommand Guids.guidInteractive Guids.cmdIDDebugSelection onMLDebugSelection None
714723

715724
addCommand guidVSStd2KCmdID(int32 VSConstants.VSStd2KCmdID.UP) onHistory(Some supportWhenInInputArea)
716725
addCommand guidVSStd2KCmdID(int32 VSConstants.VSStd2KCmdID.DOWN) onHistory(Some supportWhenInInputArea)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp