@@ -19,15 +19,15 @@ namespace Flow.Plugin.VSCodeWorkspaces
19
19
20
20
public class Main : IPlugin , IPluginI18n , ISettingProvider , IContextMenu
21
21
{
22
- internal static PluginInitContext _context { get ; private set ; }
22
+ internal static PluginInitContext Context { get ; private set ; }
23
23
24
24
private static Settings _settings ;
25
25
26
26
public string Name => GetTranslatedPluginTitle ( ) ;
27
27
28
28
public string Description => GetTranslatedPluginDescription ( ) ;
29
29
30
- private VSCodeInstance defaultInstalce ;
30
+ private VSCodeInstance _defaultInstance ;
31
31
32
32
private readonly VSCodeWorkspacesApi _workspacesApi = new ( ) ;
33
33
@@ -39,10 +39,10 @@ public List<Result> Query(Query query)
39
39
var workspaces = new List < VsCodeWorkspace > ( ) ;
40
40
41
41
// User defined extra workspaces
42
- if ( defaultInstalce != null )
42
+ if ( _defaultInstance != null )
43
43
{
44
44
workspaces . AddRange ( _settings . CustomWorkspaces . Select ( uri =>
45
- VSCodeWorkspacesApi . ParseVSCodeUri ( uri , defaultInstalce ) ) ) ;
45
+ VSCodeWorkspacesApi . ParseVSCodeUri ( uri , _defaultInstance ) ) ) ;
46
46
}
47
47
48
48
// Search opened workspaces
@@ -95,9 +95,9 @@ public List<Result> Query(Query query)
95
95
}
96
96
catch ( Win32Exception )
97
97
{
98
- var name = $ "{ _context . CurrentPluginMetadata . Name } ";
98
+ var name = $ "{ Context . CurrentPluginMetadata . Name } ";
99
99
string msg = Resources . OpenFail ;
100
- _context . API . ShowMsg ( name , msg , string . Empty ) ;
100
+ Context . API . ShowMsg ( name , msg , string . Empty ) ;
101
101
hide = false ;
102
102
}
103
103
@@ -113,7 +113,7 @@ public List<Result> Query(Query query)
113
113
{
114
114
results = results . Where ( r =>
115
115
{
116
- r . Score = _context . API . FuzzySearch ( query . Search , r . Title ) . Score ;
116
+ r . Score = Context . API . FuzzySearch ( query . Search , r . Title ) . Score ;
117
117
return r . Score > 0 ;
118
118
} ) . ToList ( ) ;
119
119
}
@@ -129,8 +129,8 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
129
129
130
130
if ( ws . WorkspaceLocation != WorkspaceLocation . Local )
131
131
{
132
- title = ws . Lable != null
133
- ? $ "{ ws . Lable } "
132
+ title = ws . Label != null
133
+ ? $ "{ ws . Label } "
134
134
: $ "{ title } { ( ws . ExtraInfo != null ? $ " - { ws . ExtraInfo } " : string . Empty ) } ({ typeWorkspace } )";
135
135
}
136
136
@@ -150,7 +150,7 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
150
150
var modifierKeys = c . SpecialKeyState . ToModifierKeys ( ) ;
151
151
if ( modifierKeys == System . Windows . Input . ModifierKeys . Control )
152
152
{
153
- _context . API . OpenDirectory ( SystemPath . RealPath ( ws . RelativePath ) ) ;
153
+ Context . API . OpenDirectory ( SystemPath . RealPath ( ws . RelativePath ) ) ;
154
154
return true ;
155
155
}
156
156
@@ -172,9 +172,9 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
172
172
}
173
173
catch ( Win32Exception )
174
174
{
175
- var name = $ "{ _context . CurrentPluginMetadata . Name } ";
175
+ var name = $ "{ Context . CurrentPluginMetadata . Name } ";
176
176
string msg = Resources . OpenFail ;
177
- _context . API . ShowMsg ( name , msg , string . Empty ) ;
177
+ Context . API . ShowMsg ( name , msg , string . Empty ) ;
178
178
}
179
179
180
180
return false ;
@@ -185,17 +185,17 @@ private static Result CreateWorkspaceResult(VsCodeWorkspace ws)
185
185
186
186
public void Init ( PluginInitContext context )
187
187
{
188
- _context = context ;
188
+ Context = context ;
189
189
_settings = context . API . LoadSettingJsonStorage < Settings > ( ) ;
190
190
191
191
VSCodeInstances . LoadVSCodeInstances ( ) ;
192
192
193
193
// 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 ) ??
195
195
VSCodeInstances . Instances . FirstOrDefault ( ) ;
196
196
}
197
197
198
- public Control CreateSettingPanel ( ) => new SettingsView ( _context , _settings ) ;
198
+ public Control CreateSettingPanel ( ) => new SettingsView ( Context , _settings ) ;
199
199
200
200
public void OnCultureInfoChanged ( CultureInfo newCulture )
201
201
{
@@ -225,7 +225,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
225
225
TitleToolTip = Resources . OpenFolderSubTitle ,
226
226
Action = c =>
227
227
{
228
- _context . API . OpenDirectory ( SystemPath . RealPath ( ws . RelativePath ) ) ;
228
+ Context . API . OpenDirectory ( SystemPath . RealPath ( ws . RelativePath ) ) ;
229
229
return true ;
230
230
} ,
231
231
ContextData = ws ,
0 commit comments