Skip to content

Commit fa7bead

Browse files
committed
fix some typo and naming convention
1 parent 532db51 commit fa7bead

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

Main.cs

+16-16
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ namespace Flow.Plugin.VSCodeWorkspaces
1919

2020
public class Main : IPlugin, IPluginI18n, ISettingProvider, IContextMenu
2121
{
22-
internal static PluginInitContext _context { get; private set; }
22+
internal static PluginInitContext Context { get; private set; }
2323

2424
private static Settings _settings;
2525

2626
public string Name => GetTranslatedPluginTitle();
2727

2828
public string Description => GetTranslatedPluginDescription();
2929

30-
private VSCodeInstance defaultInstalce;
30+
private VSCodeInstance _defaultInstance;
3131

3232
private readonly VSCodeWorkspacesApi _workspacesApi = new();
3333

@@ -39,10 +39,10 @@ public List<Result> Query(Query query)
3939
var workspaces = new List<VsCodeWorkspace>();
4040

4141
// User defined extra workspaces
42-
if (defaultInstalce != null)
42+
if (_defaultInstance != null)
4343
{
4444
workspaces.AddRange(_settings.CustomWorkspaces.Select(uri =>
45-
VSCodeWorkspacesApi.ParseVSCodeUri(uri, defaultInstalce)));
45+
VSCodeWorkspacesApi.ParseVSCodeUri(uri, _defaultInstance)));
4646
}
4747

4848
// Search opened workspaces
@@ -95,9 +95,9 @@ public List<Result> Query(Query query)
9595
}
9696
catch (Win32Exception)
9797
{
98-
var name = $"{_context.CurrentPluginMetadata.Name}";
98+
var name = $"{Context.CurrentPluginMetadata.Name}";
9999
string msg = Resources.OpenFail;
100-
_context.API.ShowMsg(name, msg, string.Empty);
100+
Context.API.ShowMsg(name, msg, string.Empty);
101101
hide = false;
102102
}
103103

@@ -113,7 +113,7 @@ public List<Result> Query(Query query)
113113
{
114114
results = results.Where(r =>
115115
{
116-
r.Score = _context.API.FuzzySearch(query.Search, r.Title).Score;
116+
r.Score = Context.API.FuzzySearch(query.Search, r.Title).Score;
117117
return r.Score > 0;
118118
}).ToList();
119119
}
@@ -129,8 +129,8 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
129129

130130
if (ws.WorkspaceLocation != WorkspaceLocation.Local)
131131
{
132-
title = ws.Lable != null
133-
? $"{ws.Lable}"
132+
title = ws.Label != null
133+
? $"{ws.Label}"
134134
: $"{title}{(ws.ExtraInfo != null ? $" - {ws.ExtraInfo}" : string.Empty)} ({typeWorkspace})";
135135
}
136136

@@ -150,7 +150,7 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
150150
var modifierKeys = c.SpecialKeyState.ToModifierKeys();
151151
if (modifierKeys == System.Windows.Input.ModifierKeys.Control)
152152
{
153-
_context.API.OpenDirectory(SystemPath.RealPath(ws.RelativePath));
153+
Context.API.OpenDirectory(SystemPath.RealPath(ws.RelativePath));
154154
return true;
155155
}
156156

@@ -172,9 +172,9 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
172172
}
173173
catch (Win32Exception)
174174
{
175-
var name = $"{_context.CurrentPluginMetadata.Name}";
175+
var name = $"{Context.CurrentPluginMetadata.Name}";
176176
string msg = Resources.OpenFail;
177-
_context.API.ShowMsg(name, msg, string.Empty);
177+
Context.API.ShowMsg(name, msg, string.Empty);
178178
}
179179

180180
return false;
@@ -185,17 +185,17 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
185185

186186
public void Init(PluginInitContext context)
187187
{
188-
_context = context;
188+
Context = context;
189189
_settings = context.API.LoadSettingJsonStorage<Settings>();
190190

191191
VSCodeInstances.LoadVSCodeInstances();
192192

193193
// Prefer stable version, or the first one we got
194-
defaultInstalce = VSCodeInstances.Instances.Find(e => e.VSCodeVersion == VSCodeVersion.Stable) ??
194+
_defaultInstance = VSCodeInstances.Instances.Find(e => e.VSCodeVersion == VSCodeVersion.Stable) ??
195195
VSCodeInstances.Instances.FirstOrDefault();
196196
}
197197

198-
public Control CreateSettingPanel() => new SettingsView(_context, _settings);
198+
public Control CreateSettingPanel() => new SettingsView(Context, _settings);
199199

200200
public void OnCultureInfoChanged(CultureInfo newCulture)
201201
{
@@ -225,7 +225,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
225225
TitleToolTip = Resources.OpenFolderSubTitle,
226226
Action = c =>
227227
{
228-
_context.API.OpenDirectory(SystemPath.RealPath(ws.RelativePath));
228+
Context.API.OpenDirectory(SystemPath.RealPath(ws.RelativePath));
229229
return true;
230230
},
231231
ContextData = ws,

RemoteMachinesHelper/VSCodeRemoteMachinesApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public List<VSCodeRemoteMachine> Machines
6161
catch (Exception ex)
6262
{
6363
var message = $"Failed to deserialize ${vscode_settings}";
64-
Main._context.API.LogException("VSCodeWorkSpaces", message, ex);
64+
Main.Context.API.LogException("VSCodeWorkSpaces", message, ex);
6565
}
6666
}
6767
}

WorkspacesHelper/VSCodeWorkspace.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public record VsCodeWorkspace
1616

1717
public PathString FolderName { get; init; }
1818

19-
public string Lable { get; init; }
19+
public string Label { get; init; }
2020

2121
public string ExtraInfo { get; init; }
2222

WorkspacesHelper/VSCodeWorkspacesApi.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public List<VsCodeWorkspace> Workspaces
9696
catch (Exception ex)
9797
{
9898
var message = $"Failed to deserialize ${vscodeStorage}";
99-
Main._context.API.LogException("VSCodeWorkspaceApi", message, ex);
99+
Main.Context.API.LogException("VSCodeWorkspaceApi", message, ex);
100100
}
101101
}
102102

@@ -149,7 +149,7 @@ private VsCodeWorkspace ParseWorkspaceEntry(JsonElement workspaceInfo, VSCodeIns
149149
var matchGroup = WorkspaceLabelParser.Match(labelString);
150150
workspace = workspace with
151151
{
152-
Lable = $"{matchGroup.Groups[2]} {matchGroup.Groups[1]}",
152+
Label = $"{matchGroup.Groups[2]} {matchGroup.Groups[1]}",
153153
WorkspaceType = WorkspaceType.Workspace
154154
};
155155
}
@@ -176,7 +176,7 @@ private VsCodeWorkspace ParseFolderEntry(JsonElement folderUri, VSCodeInstance v
176176
var matchGroup = WorkspaceLabelParser.Match(labelString);
177177
workspace = workspace with
178178
{
179-
Lable = $"{matchGroup.Groups[2]} {matchGroup.Groups[1]}",
179+
Label = $"{matchGroup.Groups[2]} {matchGroup.Groups[1]}",
180180
WorkspaceType = WorkspaceType.Workspace
181181
};
182182
}

0 commit comments

Comments
 (0)