@@ -196,11 +196,11 @@ public PowerShellContextService(
196
196
RunspaceChanged += PowerShellContext_RunspaceChangedAsync ;
197
197
ExecutionStatusChanged += PowerShellContext_ExecutionStatusChangedAsync ;
198
198
}
199
+ [ SuppressMessage ( "Design" , "CA1062:Validate arguments of public methods" , Justification = "Checked by Validate call" ) ]
199
200
public static PowerShellContextService Create (
200
201
ILoggerFactory factory ,
201
202
OmniSharp . Extensions . LanguageServer . Protocol . Server . ILanguageServerFacade languageServer ,
202
- HostStartupInfo hostStartupInfo
203
- )
203
+ HostStartupInfo hostStartupInfo )
204
204
{
205
205
var logger = factory . CreateLogger < PowerShellContextService > ( ) ;
206
206
@@ -213,9 +213,9 @@ HostStartupInfo hostStartupInfo
213
213
214
214
EditorServicesPSHostUserInterface hostUserInterface =
215
215
hostStartupInfo . ConsoleReplEnabled
216
- ? ( EditorServicesPSHostUserInterface ) new TerminalPSHostUserInterface ( powerShellContext , hostStartupInfo . PSHost , logger )
216
+ ? ( EditorServicesPSHostUserInterface ) new TerminalPSHostUserInterface ( powerShellContext , hostStartupInfo . PSHost , logger )
217
217
: new ProtocolPSHostUserInterface ( languageServer , powerShellContext , logger ) ;
218
-
218
+
219
219
EditorServicesPSHost psHost =
220
220
new EditorServicesPSHost (
221
221
powerShellContext ,
@@ -224,13 +224,12 @@ HostStartupInfo hostStartupInfo
224
224
logger ) ;
225
225
226
226
logger . LogTrace ( "Creating initial PowerShell runspace" ) ;
227
- Runspace initialRunspace = PowerShellContextService . CreateRunspace ( psHost , hostStartupInfo . InitialSessionState ) ;
227
+ Runspace initialRunspace = PowerShellContextService . CreateRunspace ( psHost , hostStartupInfo . InitialSessionState ) ;
228
228
powerShellContext . Initialize ( hostStartupInfo , initialRunspace , true , hostUserInterface ) ;
229
229
230
230
return powerShellContext ;
231
231
}
232
- [ SuppressMessage ( "Design" , "CA1062:Validate arguments of public methods" , Justification = "Checked by Validate call" ) ]
233
-
232
+
234
233
/// <summary>
235
234
/// Only used in testing. Creates a Runspace given HostStartupInfo instead of a PSHost.
236
235
/// </summary>
@@ -300,7 +299,7 @@ public void Initialize(
300
299
this . SessionState = PowerShellContextState . NotStarted ;
301
300
this . ConsoleWriter = consoleHost ;
302
301
this . ConsoleReader = consoleHost as IHostInput ;
303
-
302
+
304
303
// Get the PowerShell runtime version
305
304
this . LocalPowerShellVersion =
306
305
PowerShellVersionDetails . GetVersionDetails (
@@ -320,7 +319,7 @@ public void Initialize(
320
319
connectionString : null ) ;
321
320
this . CurrentRunspace = this . initialRunspace ;
322
321
// Respect a user provided bundled module path.
323
- if ( Directory . Exists ( hostStartupInfo . BundledModulePath ) )
322
+ if ( Directory . Exists ( hostStartupInfo . BundledModulePath ) )
324
323
{
325
324
logger . LogTrace ( $ "Using new bundled module path: { hostStartupInfo . BundledModulePath } ") ;
326
325
s_bundledModulePath = hostStartupInfo . BundledModulePath ;
@@ -373,7 +372,7 @@ public void Initialize(
373
372
. PSVariable
374
373
. GetValue ( "Host" )
375
374
as PSHost ;
376
-
375
+
377
376
// Now that the runspace is ready, enqueue it for first use
378
377
this . PromptNest = new PromptNest (
379
378
this ,
@@ -384,14 +383,14 @@ public void Initialize(
384
383
385
384
// Import the PowerShellEditorServices.Commands module into the runspace.
386
385
this . ImportModuleAsync ( s_commandsModulePath ) . GetAwaiter ( ) . GetResult ( ) ;
387
- if ( isPSReadLineEnabled )
386
+ if ( isPSReadLineEnabled )
388
387
{
389
388
// Imports the PSReadLine2 module into the runspace.
390
389
ImportModuleAsync ( s_psReadLineModulePath ) . GetAwaiter ( ) . GetResult ( ) ;
391
390
}
392
391
// TODO: This can be moved to the point after the $psEditor object
393
392
// gets initialized when that is done earlier than LanguageServer.Initialize
394
- foreach ( string module in hostStartupInfo . AdditionalModules )
393
+ foreach ( string module in hostStartupInfo . AdditionalModules )
395
394
{
396
395
this . ImportModuleAsync ( module ) . GetAwaiter ( ) . GetResult ( ) ;
397
396
}
@@ -1697,7 +1696,7 @@ internal static string QuoteEscapeString(string escapedPath)
1697
1696
internal static string WildcardEscapePath ( string path , bool escapeSpaces = false )
1698
1697
{
1699
1698
var sb = new StringBuilder ( ) ;
1700
- for ( int i = 0 ; i < path . Length ; i ++ )
1699
+ for ( int i = 0 ; i < path . Length ; i ++ )
1701
1700
{
1702
1701
char curr = path [ i ] ;
1703
1702
switch ( curr )
@@ -1750,7 +1749,7 @@ internal static string UnescapeWildcardEscapedPath(string wildcardEscapedPath)
1750
1749
}
1751
1750
1752
1751
var sb = new StringBuilder ( wildcardEscapedPath . Length ) ;
1753
- for ( int i = 0 ; i < wildcardEscapedPath . Length ; i ++ )
1752
+ for ( int i = 0 ; i < wildcardEscapedPath . Length ; i ++ )
1754
1753
{
1755
1754
// If we see a backtick perform a lookahead
1756
1755
char curr = wildcardEscapedPath [ i ] ;
@@ -2350,7 +2349,7 @@ private static IEnumerable<string> GetLoadableProfilePaths(ProfilePathInfo profi
2350
2349
yield break ;
2351
2350
}
2352
2351
2353
- foreach ( string path in new [ ] { profilePaths . AllUsersAllHosts , profilePaths . AllUsersCurrentHost , profilePaths . CurrentUserAllHosts , profilePaths . CurrentUserCurrentHost } )
2352
+ foreach ( string path in new [ ] { profilePaths . AllUsersAllHosts , profilePaths . AllUsersCurrentHost , profilePaths . CurrentUserAllHosts , profilePaths . CurrentUserCurrentHost } )
2354
2353
{
2355
2354
if ( path != null && File . Exists ( path ) )
2356
2355
{
0 commit comments