Skip to content

Commit c343949

Browse files
committed
feat(debug): add start without debugging button
Add a separate button for Debug.StartWithoutDebugging alongside the existing debug button. Both buttons toggle to a stop icon when a session is active.
1 parent 10b7cc2 commit c343949

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

src/CodingWithCalvin.LaunchyBar/Models/LaunchyBarConfiguration.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ public static LaunchyBarConfiguration CreateDefault()
7272
Order = 3
7373
},
7474
new()
75+
{
76+
Id = "start-without-debugging",
77+
Name = "Start Without Debugging",
78+
IconPath = "KnownMonikers.RunOutline",
79+
Type = LaunchItemType.VsCommand,
80+
Target = "Debug.StartWithoutDebugging",
81+
Position = LaunchItemPosition.Top,
82+
Order = 4
83+
},
84+
new()
7585
{
7686
Id = "terminal",
7787
Name = "Terminal",

src/CodingWithCalvin.LaunchyBar/Services/DebugStateService.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ private void UpdateDebugIcon(bool isDebugging)
6161
debugItem.IconPath = isDebugging ? "KnownMonikers.Stop" : "KnownMonikers.Run";
6262
debugItem.Name = isDebugging ? "Stop Debugging" : "Start Debugging";
6363
}
64+
65+
var startWithoutDebuggingItem = _configurationService.Configuration.Items
66+
.FirstOrDefault(i => i.Id == "start-without-debugging" || i.Target == "Debug.StartWithoutDebugging");
67+
68+
if (startWithoutDebuggingItem != null)
69+
{
70+
startWithoutDebuggingItem.IconPath = isDebugging ? "KnownMonikers.Stop" : "KnownMonikers.RunOutline";
71+
startWithoutDebuggingItem.Name = isDebugging ? "Stop Debugging" : "Start Without Debugging";
72+
}
6473
}
6574

6675
public void Dispose()

src/CodingWithCalvin.LaunchyBar/Services/LaunchService.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ public async Task ExecuteAsync(LaunchItem item)
7171

7272
case LaunchItemType.VsCommand:
7373
// Special handling for debug commands
74-
if (item.Target.Equals("Debug.Start", StringComparison.OrdinalIgnoreCase))
74+
if (item.Target.Equals("Debug.Start", StringComparison.OrdinalIgnoreCase) ||
75+
item.Target.Equals("Debug.StartWithoutDebugging", StringComparison.OrdinalIgnoreCase))
7576
{
76-
await ToggleDebugAsync();
77+
await ToggleDebugAsync(item.Target);
7778
}
7879
else
7980
{
@@ -201,14 +202,14 @@ private async Task HideOtherToolWindowsAsync(LaunchItem currentItem)
201202
}
202203
}
203204

204-
private async Task ToggleDebugAsync()
205+
private async Task ToggleDebugAsync(string startCommand)
205206
{
206207
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
207208

208209
var dte = await _package.GetServiceAsync(typeof(DTE)) as DTE2;
209210
if (dte == null)
210211
{
211-
await VS.Commands.ExecuteAsync("Debug.Start");
212+
await VS.Commands.ExecuteAsync(startCommand);
212213
return;
213214
}
214215

@@ -221,8 +222,8 @@ private async Task ToggleDebugAsync()
221222
}
222223
else
223224
{
224-
// Not debugging - start
225-
await VS.Commands.ExecuteAsync("Debug.Start");
225+
// Not debugging - start with the specified command
226+
await VS.Commands.ExecuteAsync(startCommand);
226227
}
227228
}
228229

0 commit comments

Comments
 (0)