Skip to content

Commit 0a6e4ff

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 83271b6 commit 0a6e4ff

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
@@ -68,9 +68,10 @@ public async Task ExecuteAsync(LaunchItem item)
6868

6969
case LaunchItemType.VsCommand:
7070
// Special handling for debug commands
71-
if (item.Target.Equals("Debug.Start", StringComparison.OrdinalIgnoreCase))
71+
if (item.Target.Equals("Debug.Start", StringComparison.OrdinalIgnoreCase) ||
72+
item.Target.Equals("Debug.StartWithoutDebugging", StringComparison.OrdinalIgnoreCase))
7273
{
73-
await ToggleDebugAsync();
74+
await ToggleDebugAsync(item.Target);
7475
}
7576
else
7677
{
@@ -151,14 +152,14 @@ private async Task ToggleToolWindowAsync(LaunchItem item)
151152
await VS.Commands.ExecuteAsync(item.Target);
152153
}
153154

154-
private async Task ToggleDebugAsync()
155+
private async Task ToggleDebugAsync(string startCommand)
155156
{
156157
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
157158

158159
var dte = await _package.GetServiceAsync(typeof(DTE)) as DTE2;
159160
if (dte == null)
160161
{
161-
await VS.Commands.ExecuteAsync("Debug.Start");
162+
await VS.Commands.ExecuteAsync(startCommand);
162163
return;
163164
}
164165

@@ -171,8 +172,8 @@ private async Task ToggleDebugAsync()
171172
}
172173
else
173174
{
174-
// Not debugging - start
175-
await VS.Commands.ExecuteAsync("Debug.Start");
175+
// Not debugging - start with the specified command
176+
await VS.Commands.ExecuteAsync(startCommand);
176177
}
177178
}
178179

0 commit comments

Comments
 (0)