File tree 2 files changed +18
-14
lines changed
src/PowerShellEditorServices
2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 10
10
11
11
namespace Microsoft . PowerShell . EditorServices . Console
12
12
{
13
+ using Microsoft . PowerShell . EditorServices . Session ;
13
14
using System ;
15
+ using System . Globalization ;
14
16
using System . Management . Automation ;
15
17
using System . Security ;
16
18
@@ -264,10 +266,23 @@ public async Task<SecureString> ReadSecureLine(CancellationToken cancellationTok
264
266
265
267
private void WritePromptStringToHost ( )
266
268
{
269
+ string promptString = this . powerShellContext . PromptString ;
270
+
271
+ // Update the stored prompt string if the session is remote
272
+ if ( this . powerShellContext . CurrentRunspace . Location == RunspaceLocation . Remote )
273
+ {
274
+ promptString =
275
+ string . Format (
276
+ CultureInfo . InvariantCulture ,
277
+ "[{0}]: {1}" ,
278
+ this . powerShellContext . CurrentRunspace . Runspace . ConnectionInfo != null
279
+ ? this . powerShellContext . CurrentRunspace . Runspace . ConnectionInfo . ComputerName
280
+ : this . powerShellContext . CurrentRunspace . SessionDetails . ComputerName ,
281
+ promptString ) ;
282
+ }
283
+
267
284
// Write the prompt string
268
- this . WriteOutput (
269
- this . powerShellContext . PromptString ,
270
- false ) ;
285
+ this . WriteOutput ( promptString , false ) ;
271
286
}
272
287
273
288
private void WriteDebuggerBanner ( DebuggerStopEventArgs eventArgs )
Original file line number Diff line number Diff line change @@ -1367,17 +1367,6 @@ private SessionDetails GetSessionDetailsInRunspace(Runspace runspace)
1367
1367
}
1368
1368
} ) ;
1369
1369
1370
- if ( this . CurrentRunspace != null &&
1371
- this . CurrentRunspace . Location == RunspaceLocation . Remote )
1372
- {
1373
- sessionDetails . PromptString =
1374
- string . Format (
1375
- CultureInfo . InvariantCulture ,
1376
- "[{0}]: {1}" ,
1377
- runspace . ConnectionInfo . ComputerName ,
1378
- sessionDetails . PromptString ) ;
1379
- }
1380
-
1381
1370
return sessionDetails ;
1382
1371
}
1383
1372
You can’t perform that action at this time.
0 commit comments