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

Commita4003c1

Browse files
committed
Add 'detach' item for tool window, and give 'attach'/'detach' smart visibility
1 parentc5a6460 commita4003c1

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ module internal Guids =
4848

4949
letguidFsiConsoleCmdSet= Guid("0E455B35-F2EB-431b-A0BE-B268D8A7D17F")
5050
letcmdIDAttachDebugger=0x104
51+
letcmdIDDetachDebugger=0x105
5152
letcmdIDFsiConsoleContextMenu=0x2100
5253

5354
// Command set for SendToInteractive

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@
101101
<CommandName>FSharp.Interactive.AttachDebugger</CommandName>
102102
<ButtonText>Attach Debugger</ButtonText>
103103
</Strings>
104+
<CommandFlag>DynamicVisibility | DefaultInvisible</CommandFlag>
105+
</Button>
106+
107+
<Buttonguid="guidFsiConsoleCmdSet"id="cmdidDetachDebugger"priority="0x0101"type="Button">
108+
<Strings>
109+
<CommandName>FSharp.Interactive.DetachDebugger</CommandName>
110+
<ButtonText>Detach Debugger</ButtonText>
111+
</Strings>
112+
<CommandFlag>DynamicVisibility | DefaultInvisible</CommandFlag>
104113
</Button>
105114

106115
<!-- The following places a button on the F# Editor Context Menu-->
@@ -173,7 +182,10 @@
173182
<CommandPlacementguid="guidFsiConsoleCmdSet"id="cmdidAttachDebugger"priority="0x0700">
174183
<Parentguid="guidFsiConsoleCmdSet"id="FsiConsoleSessionsGrp"/>
175184
</CommandPlacement>
176-
185+
<CommandPlacementguid="guidFsiConsoleCmdSet"id="cmdidDetachDebugger"priority="0x0800">
186+
<Parentguid="guidFsiConsoleCmdSet"id="FsiConsoleSessionsGrp"/>
187+
</CommandPlacement>
188+
177189
<!-- Adds MLSend to the context menu:
178190
<CommandPlacement guid="guidFsiConsoleCmdSet" id="cmdidMLSendSelection" priority="0x0500">
179191
<Parent guid="guidFsiConsoleCmdSet" id="FsiConsoleSessionsGrp"/>
@@ -226,7 +238,10 @@
226238
<KeyBindingguid="guidVSStd97"id="cmdidClearPane"editor="guidFsiToolWindow"key1="C"mod1="Control Alt" />
227239

228240
<!-- CRTL-Alt-D when in FSI ToolWindow is attach debugger-->
229-
<KeyBindingguid="guidFsiConsoleCmdSet"id="cmdidAttachDebugger"editor="guidFsiToolWindow"key1="D"mod1="Control Alt" />
241+
<KeyBindingguid="guidFsiConsoleCmdSet"id="cmdidAttachDebugger"editor="guidFsiToolWindow"key1="D"mod1="Control Alt" />
242+
243+
<!-- CRTL-Shift-D when in FSI ToolWindow is detach debugger-->
244+
<KeyBindingguid="guidFsiConsoleCmdSet"id="cmdidDetachDebugger"editor="guidFsiToolWindow"key1="D"mod1="Control Shift" />
230245
</KeyBindings>
231246

232247
<Symbols>
@@ -263,6 +278,7 @@
263278
<IDSymbolname="FsiConsoleSessionsGrp"value="0x1050" />
264279
<IDSymbolname="cmdidFsiConsole"value="0x101" />
265280
<IDSymbolname="cmdidAttachDebugger"value="0x104" />
281+
<IDSymbolname="cmdidDetachDebugger"value="0x105" />
266282
</GuidSymbol>
267283

268284
<GuidSymbolname="guidFsiConsoleBmp"value="{9074CE8B-8F1E-4c23-8EDC-82C25E0323A8}" >

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,16 @@ type internal FsiToolWindow() as this =
441441
|> Seq.cast<Process>
442442
|> Seq.tryFind(fun p-> p.ProcessID= fsiProcId)
443443

444+
letdebuggerIsRunning()=
445+
letdte= provider.GetService(typeof<DTE>):?> DTE
446+
dte.Debugger.DebuggedProcesses<>null&& dte.Debugger.DebuggedProcesses.Count>0
447+
444448
letattachDebugger()=
445449
letfsiProcId= sessions.ProcessID
446450
letdte= provider.GetService(typeof<DTE>):?> DTE
447451

448452
// only attach if no other debugging happening
449-
if dte.Debugger.CurrentProcess=nullthen
453+
if dte.Debugger.DebuggedProcesses=null|| dte.Debugger.DebuggedProcesses.Count=0then
450454
letfsiProc=
451455
if dte.Debugger.LocalProcesses=nullthen Noneelse
452456
dte.Debugger.LocalProcesses
@@ -466,6 +470,10 @@ type internal FsiToolWindow() as this =
466470
attachDebugger()
467471
showNoActivate()
468472

473+
letonDetachDebugger(sender:obj)(args:EventArgs)=
474+
detachDebugger()
475+
showNoActivate()
476+
469477
letsendTextToFSI text=
470478
try
471479
showNoActivate()
@@ -637,6 +645,7 @@ type internal FsiToolWindow() as this =
637645
addCommand Guids.guidInteractiveCommands Guids.cmdIDSessionInterrupt onInterrupt None
638646
addCommand Guids.guidInteractiveCommands Guids.cmdIDSessionRestart onRestart None
639647
addCommand Guids.guidFsiConsoleCmdSet Guids.cmdIDAttachDebugger onAttachDebugger None
648+
addCommand Guids.guidFsiConsoleCmdSet Guids.cmdIDDetachDebugger onDetachDebugger None
640649

641650
addCommand Guids.guidInteractiveShell Guids.cmdIDSendSelection onMLSend None
642651
addCommand Guids.guidInteractive Guids.cmdIDDebugSelection onMLDebugSelection None
@@ -659,6 +668,18 @@ type internal FsiToolWindow() as this =
659668
context.AddAttribute(VSUSERCONTEXTATTRIBUTEUSAGE.VSUC_Usage_LookupF1,"Keyword","VS.FSharpInteractive")|> ignore
660669
|_-> Debug.Assert(false)
661670

671+
member__.QueryCommandStatus(guidCmdGroup:Guid,nCmdId:uint32)=
672+
match()with
673+
|_when guidCmdGroup= Guids.guidFsiConsoleCmdSet&& nCmdId= uint32 Guids.cmdIDAttachDebugger->
674+
if debuggerIsRunning()then Some(OLECMDF.OLECMDF_INVISIBLE)
675+
else Some(OLECMDF.OLECMDF_SUPPORTED||| OLECMDF.OLECMDF_ENABLED)
676+
677+
|_when guidCmdGroup= Guids.guidFsiConsoleCmdSet&& nCmdId= uint32 Guids.cmdIDDetachDebugger->
678+
if getDebugAttachedFSIProcess()|> Option.isSomethen Some(OLECMDF.OLECMDF_SUPPORTED||| OLECMDF.OLECMDF_ENABLED)
679+
else Some(OLECMDF.OLECMDF_INVISIBLE)
680+
681+
|_-> None
682+
662683
interface ITestVFSIwith
663684
/// Send a string; the ';;' will be added to the end; does not interact with history
664685
memberthis.SendTextInteraction(s:string)=
@@ -711,6 +732,15 @@ type internal FsiToolWindow() as this =
711732
ifnot(wpfTextView.HasAggregateFocus)|| isFocusedElementInterceptsCommandRouting()then
712733
(int Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED)
713734
else
735+
let mutableallHandled=true
736+
for i=0to((int cCmds)-1)do
737+
match this.QueryCommandStatus(guid, prgCmds.[i].cmdID)with
738+
| Some(commandStatus)->
739+
prgCmds.[i].cmdf<- uint32 commandStatus
740+
| None->
741+
allHandled<-false
742+
743+
if allHandledthen0else
714744
lettarget:IOleCommandTarget=upcast commandService
715745
target.QueryStatus(&guid, cCmds, prgCmds, pCmdText)
716746

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp