Skip to content

Commit c3cf445

Browse files
committed
Remove command result setting
1 parent 4c11354 commit c3cf445

File tree

8 files changed

+13
-131
lines changed

8 files changed

+13
-131
lines changed

WorkspaceLauncherForVSCode/Classes/SettingsManager.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ public class SettingsManager : JsonSettingsManager
1616

1717
private static string Namespaced(string propertyName) => $"{_namespace}.{propertyName}";
1818

19-
private static readonly List<ChoiceSetSetting.Choice> _commandResultChoices =
20-
[
21-
new ChoiceSetSetting.Choice(Resource.setting_commandResult_option_dismiss_label, nameof(CommandResultType.Dismiss)),
22-
new ChoiceSetSetting.Choice(Resource.setting_commandResult_option_goback_label, nameof(CommandResultType.GoBack)),
23-
new ChoiceSetSetting.Choice(Resource.setting_commandResult_option_keepopen_label, nameof(CommandResultType.KeepOpen)),
24-
];
25-
2619
private static readonly List<ChoiceSetSetting.Choice> _searchByChoices =
2720
[
2821
new ChoiceSetSetting.Choice("Both", nameof(SearchBy.Both)),
@@ -90,12 +83,6 @@ public class SettingsManager : JsonSettingsManager
9083
"Enable custom Visual Studio Code installations found in the PATH",
9184
false);
9285

93-
private readonly ChoiceSetSetting _commandResult = new(
94-
Namespaced(nameof(CommandResult)),
95-
Resource.setting_commandResult_label,
96-
Resource.setting_commandResult_desc,
97-
_commandResultChoices);
98-
9986
private readonly ChoiceSetSetting _searchBy = new(
10087
Namespaced(nameof(SearchBy)),
10188
"Search By",
@@ -158,18 +145,6 @@ public VisualStudioCodeEdition EnabledEditions
158145
}
159146
}
160147

161-
public CommandResultType CommandResult
162-
{
163-
get
164-
{
165-
if (Enum.TryParse<CommandResultType>(_commandResult.Value, out var result))
166-
{
167-
return result;
168-
}
169-
return CommandResultType.Dismiss;
170-
}
171-
}
172-
173148
public SearchBy SearchBy
174149
{
175150
get
@@ -236,7 +211,6 @@ public SettingsManager()
236211
Settings.Add(_enableSystem);
237212
Settings.Add(_enableInsider);
238213
Settings.Add(_enableCustom);
239-
Settings.Add(_commandResult);
240214
Settings.Add(_pageSize);
241215
Settings.Add(_searchBy);
242216
Settings.Add(_vsSecondaryCommand);

WorkspaceLauncherForVSCode/Commands/OpenSolutionCommand.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ public partial class OpenSolutionCommand : InvokableCommand, IHasWorkspace
1414
{
1515
public VisualStudioCodeWorkspace Workspace { get; set; }
1616
private readonly VisualStudioCodePage? page;
17-
private readonly CommandResultType commandResult;
1817
private readonly bool _elevated;
1918

20-
public OpenSolutionCommand(VisualStudioCodeWorkspace workspace, VisualStudioCodePage page, CommandResultType commandResult, bool elevated = false)
19+
public OpenSolutionCommand(VisualStudioCodeWorkspace workspace, VisualStudioCodePage page, bool elevated = false)
2120
{
2221
Workspace = workspace;
2322
this.page = page;
24-
this.commandResult = commandResult;
2523
_elevated = elevated;
2624

2725
if (_elevated)
@@ -62,7 +60,7 @@ public override CommandResult Invoke()
6260
if (window.Title.Contains(solutionName))
6361
{
6462
window.SwitchToWindow();
65-
return PageCommandResultHandler.HandleCommandResult(CommandResultType.Dismiss, page);
63+
return PageCommandResultHandler.HandleCommandResult(page);
6664
}
6765
}
6866

@@ -77,6 +75,6 @@ public override CommandResult Invoke()
7775
Task.Run(() => page.UpdateFrequencyAsync(Workspace.Path));
7876
}
7977

80-
return PageCommandResultHandler.HandleCommandResult(commandResult, page);
78+
return PageCommandResultHandler.HandleCommandResult(page);
8179
}
8280
}

WorkspaceLauncherForVSCode/Commands/OpenVisualStudioCodeCommand.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace WorkspaceLauncherForVSCode.Commands;
1414
internal sealed partial class OpenVisualStudioCodeCommand : InvokableCommand, IHasWorkspace
1515
{
1616
private readonly VisualStudioCodePage page;
17-
private readonly CommandResultType commandResult;
1817
private readonly bool _elevated;
1918

2019
public VisualStudioCodeWorkspace Workspace { get; set; }
@@ -24,12 +23,10 @@ internal sealed partial class OpenVisualStudioCodeCommand : InvokableCommand, IH
2423
/// </summary>
2524
/// <param name="workspace">The Visual Studio Code workspace to open.</param>
2625
/// <param name="page">The Visual Studio Code page instance.</param>
27-
/// <param name="commandResult">The command result setting value.</param>
28-
public OpenVisualStudioCodeCommand(VisualStudioCodeWorkspace workspace, VisualStudioCodePage page, CommandResultType commandResult, bool elevated = false)
26+
public OpenVisualStudioCodeCommand(VisualStudioCodeWorkspace workspace, VisualStudioCodePage page, bool elevated = false)
2927
{
3028
Workspace = workspace;
3129
this.page = page;
32-
this.commandResult = commandResult;
3330
_elevated = elevated;
3431
this.Icon = Classes.Icon.VisualStudioCode;
3532

@@ -86,6 +83,6 @@ public override CommandResult Invoke()
8683
// Update frequency
8784
Task.Run(() => page.UpdateFrequencyAsync(Workspace.Path));
8885

89-
return PageCommandResultHandler.HandleCommandResult(commandResult, page);
86+
return PageCommandResultHandler.HandleCommandResult(page);
9087
}
9188
}

WorkspaceLauncherForVSCode/Commands/PageCommandResultHandler.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace WorkspaceLauncherForVSCode.Commands;
77

88
public static class PageCommandResultHandler
99
{
10-
public static CommandResult HandleCommandResult(CommandResultType resultType, VisualStudioCodePage? page)
10+
public static CommandResult HandleCommandResult(VisualStudioCodePage? page)
1111
{
1212
if (page != null)
1313
{
@@ -19,11 +19,6 @@ public static CommandResult HandleCommandResult(CommandResultType resultType, Vi
1919
}
2020
}
2121

22-
return resultType switch
23-
{
24-
CommandResultType.GoBack => CommandResult.GoBack(),
25-
CommandResultType.KeepOpen => CommandResult.KeepOpen(),
26-
_ => CommandResult.Dismiss(),
27-
};
22+
return CommandResult.Dismiss();
2823
}
2924
}

WorkspaceLauncherForVSCode/Enums/CommandResultType.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

WorkspaceLauncherForVSCode/Properties/Resource.Designer.cs

Lines changed: 0 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WorkspaceLauncherForVSCode/Properties/Resource.resx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,6 @@
174174
<data name="setting_tagType_option_typeandtarget_label" xml:space="preserve">
175175
<value>Type &amp; Target</value>
176176
</data>
177-
<data name="setting_commandResult_label" xml:space="preserve">
178-
<value>Command Result Action</value>
179-
</data>
180-
<data name="setting_commandResult_desc" xml:space="preserve">
181-
<value>What should happen after opening a Visual Studio Code workspace</value>
182-
</data>
183-
<data name="setting_commandResult_option_dismiss_label" xml:space="preserve">
184-
<value>Dismiss</value>
185-
</data>
186-
<data name="setting_commandResult_option_goback_label" xml:space="preserve">
187-
<value>Go Back</value>
188-
</data>
189-
<data name="setting_commandResult_option_keepopen_label" xml:space="preserve">
190-
<value>Keep Open</value>
191-
</data>
192177
<data name="setting_pageSize_label" xml:space="preserve">
193178
<value>Page Size</value>
194179
</data>

WorkspaceLauncherForVSCode/Workspaces/WorkspaceItemFactory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static ListItem Create(
3939
switch (workspace.WorkspaceType)
4040
{
4141
case WorkspaceType.Solution:
42-
command = new OpenSolutionCommand(workspace, page, settingsManager.CommandResult);
42+
command = new OpenSolutionCommand(workspace, page);
4343
icon = Classes.Icon.VisualStudio;
4444
workspace.WindowsPath = workspace.Path;
4545
details = new Details
@@ -56,7 +56,7 @@ public static ListItem Create(
5656
}
5757
if (settingsManager.VSSecondaryCommand == SecondaryCommand.OpenAsAdministrator)
5858
{
59-
moreCommands.Add(new CommandContextItem(new OpenSolutionCommand(workspace, page, settingsManager.CommandResult, elevated: true)));
59+
moreCommands.Add(new CommandContextItem(new OpenSolutionCommand(workspace, page, elevated: true)));
6060
if (!string.IsNullOrEmpty(workspace.WindowsPath))
6161
{
6262
moreCommands.Add(new CommandContextItem(new OpenInExplorerCommand(workspace.WindowsPath, workspace)));
@@ -68,11 +68,11 @@ public static ListItem Create(
6868
{
6969
moreCommands.Add(new CommandContextItem(new OpenInExplorerCommand(workspace.WindowsPath, workspace)));
7070
}
71-
moreCommands.Add(new CommandContextItem(new OpenSolutionCommand(workspace, page, settingsManager.CommandResult, elevated: true)));
71+
moreCommands.Add(new CommandContextItem(new OpenSolutionCommand(workspace, page, elevated: true)));
7272
}
7373
break;
7474
default:
75-
command = new OpenVisualStudioCodeCommand(workspace, page, settingsManager.CommandResult);
75+
command = new OpenVisualStudioCodeCommand(workspace, page);
7676
icon = Classes.Icon.VisualStudioCode;
7777
details = new Details
7878
{
@@ -105,7 +105,7 @@ public static ListItem Create(
105105
{
106106
if (settingsManager.VSCodeSecondaryCommand == SecondaryCommand.OpenAsAdministrator)
107107
{
108-
moreCommands.Add(new CommandContextItem(new OpenVisualStudioCodeCommand(workspace, page, settingsManager.CommandResult, elevated: true)));
108+
moreCommands.Add(new CommandContextItem(new OpenVisualStudioCodeCommand(workspace, page, elevated: true)));
109109
if (!string.IsNullOrEmpty(workspace.WindowsPath))
110110
{
111111
moreCommands.Add(new CommandContextItem(new OpenInExplorerCommand(workspace.WindowsPath, workspace)));
@@ -117,7 +117,7 @@ public static ListItem Create(
117117
{
118118
moreCommands.Add(new CommandContextItem(new OpenInExplorerCommand(workspace.WindowsPath, workspace)));
119119
}
120-
moreCommands.Add(new CommandContextItem(new OpenVisualStudioCodeCommand(workspace, page, settingsManager.CommandResult, elevated: true)));
120+
moreCommands.Add(new CommandContextItem(new OpenVisualStudioCodeCommand(workspace, page, elevated: true)));
121121
}
122122
}
123123
else

0 commit comments

Comments
 (0)