Skip to content

Commit 3667e80

Browse files
committed
Remove now-unused async console operations
1 parent 174fc77 commit 3667e80

File tree

5 files changed

+16
-328
lines changed

5 files changed

+16
-328
lines changed

src/PowerShellEditorServices/Services/PowerShell/Console/ConsoleProxy.cs

+6-93
Original file line numberDiff line numberDiff line change
@@ -47,120 +47,33 @@ public static ConsoleKeyInfo ReadKey(bool intercept, CancellationToken cancellat
4747
s_consoleProxy.ReadKey(intercept, cancellationToken);
4848

4949
/// <summary>
50-
/// Obtains the next character or function key pressed by the user asynchronously.
51-
/// Does not block when other console API's are called.
52-
/// </summary>
53-
/// <param name="intercept">
54-
/// Determines whether to display the pressed key in the console window. <see langword="true" />
55-
/// to not display the pressed key; otherwise, <see langword="false" />.
56-
/// </param>
57-
/// <param name="cancellationToken">The CancellationToken to observe.</param>
58-
/// <returns>
59-
/// A task that will complete with a result of the key pressed by the user.
60-
/// </returns>
61-
public static Task<ConsoleKeyInfo> ReadKeyAsync(bool intercept, CancellationToken cancellationToken) =>
62-
s_consoleProxy.ReadKeyAsync(intercept, cancellationToken);
63-
64-
/// <summary>
65-
/// Obtains the horizontal position of the console cursor. Use this method
66-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
67-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
68-
/// on Unix platforms.
50+
/// Obtains the horizontal position of the console cursor. TODO: Is this still necessary?
6951
/// </summary>
7052
/// <returns>The horizontal position of the console cursor.</returns>
71-
public static int GetCursorLeft() =>
72-
s_consoleProxy.GetCursorLeft();
53+
public static int GetCursorLeft() => s_consoleProxy.GetCursorLeft();
7354

7455
/// <summary>
75-
/// Obtains the horizontal position of the console cursor. Use this method
76-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
77-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
78-
/// on Unix platforms.
56+
/// Obtains the horizontal position of the console cursor. TODO: Is this still necessary?
7957
/// </summary>
8058
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
8159
/// <returns>The horizontal position of the console cursor.</returns>
8260
public static int GetCursorLeft(CancellationToken cancellationToken) =>
8361
s_consoleProxy.GetCursorLeft(cancellationToken);
8462

8563
/// <summary>
86-
/// Obtains the horizontal position of the console cursor. Use this method
87-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
88-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
89-
/// on Unix platforms.
90-
/// </summary>
91-
/// <returns>
92-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
93-
/// <see cref="Task{T}.Result" /> property will return the horizontal position
94-
/// of the console cursor.
95-
/// </returns>
96-
public static Task<int> GetCursorLeftAsync() =>
97-
s_consoleProxy.GetCursorLeftAsync();
98-
99-
/// <summary>
100-
/// Obtains the horizontal position of the console cursor. Use this method
101-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
102-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
103-
/// on Unix platforms.
104-
/// </summary>
105-
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
106-
/// <returns>
107-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
108-
/// <see cref="Task{T}.Result" /> property will return the horizontal position
109-
/// of the console cursor.
110-
/// </returns>
111-
public static Task<int> GetCursorLeftAsync(CancellationToken cancellationToken) =>
112-
s_consoleProxy.GetCursorLeftAsync(cancellationToken);
113-
114-
/// <summary>
115-
/// Obtains the vertical position of the console cursor. Use this method
116-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
117-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
118-
/// on Unix platforms.
64+
/// Obtains the vertical position of the console cursor. TODO: Is this still necessary?
11965
/// </summary>
12066
/// <returns>The vertical position of the console cursor.</returns>
121-
public static int GetCursorTop() =>
122-
s_consoleProxy.GetCursorTop();
67+
public static int GetCursorTop() => s_consoleProxy.GetCursorTop();
12368

12469
/// <summary>
125-
/// Obtains the vertical position of the console cursor. Use this method
126-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
127-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
128-
/// on Unix platforms.
70+
/// Obtains the vertical position of the console cursor. TODO: Is this still necessary?
12971
/// </summary>
13072
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
13173
/// <returns>The vertical position of the console cursor.</returns>
13274
public static int GetCursorTop(CancellationToken cancellationToken) =>
13375
s_consoleProxy.GetCursorTop(cancellationToken);
13476

135-
/// <summary>
136-
/// Obtains the vertical position of the console cursor. Use this method
137-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
138-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
139-
/// on Unix platforms.
140-
/// </summary>
141-
/// <returns>
142-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
143-
/// <see cref="Task{T}.Result" /> property will return the vertical position
144-
/// of the console cursor.
145-
/// </returns>
146-
public static Task<int> GetCursorTopAsync() =>
147-
s_consoleProxy.GetCursorTopAsync();
148-
149-
/// <summary>
150-
/// Obtains the vertical position of the console cursor. Use this method
151-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
152-
/// pending calls to <see cref="IConsoleOperations.ReadKeyAsync(bool, CancellationToken)" />
153-
/// on Unix platforms.
154-
/// </summary>
155-
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
156-
/// <returns>
157-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
158-
/// <see cref="Task{T}.Result" /> property will return the vertical position
159-
/// of the console cursor.
160-
/// </returns>
161-
public static Task<int> GetCursorTopAsync(CancellationToken cancellationToken) =>
162-
s_consoleProxy.GetCursorTopAsync(cancellationToken);
163-
16477
/// <summary>
16578
/// This method is sent to PSReadLine as a workaround for issues with the System.Console
16679
/// implementation. Functionally it is the same as System.Console.ReadKey,

src/PowerShellEditorServices/Services/PowerShell/Console/IConsoleOperations.cs

+4-85
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.Threading;
6-
using System.Threading.Tasks;
76

87
namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Console
98
{
@@ -30,109 +29,29 @@ internal interface IConsoleOperations
3029
ConsoleKeyInfo ReadKey(bool intercept, CancellationToken cancellationToken);
3130

3231
/// <summary>
33-
/// Obtains the next character or function key pressed by the user asynchronously.
34-
/// Does not block when other console API's are called.
35-
/// </summary>
36-
/// <param name="intercept">
37-
/// Determines whether to display the pressed key in the console window. <see langword="true" />
38-
/// to not display the pressed key; otherwise, <see langword="false" />.
39-
/// </param>
40-
/// <param name="cancellationToken">The CancellationToken to observe.</param>
41-
/// <returns>
42-
/// A task that will complete with a result of the key pressed by the user.
43-
/// </returns>
44-
Task<ConsoleKeyInfo> ReadKeyAsync(bool intercept, CancellationToken cancellationToken);
45-
46-
/// <summary>
47-
/// Obtains the horizontal position of the console cursor. Use this method
48-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
49-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
50-
/// on Unix platforms.
32+
/// Obtains the horizontal position of the console cursor.
5133
/// </summary>
5234
/// <returns>The horizontal position of the console cursor.</returns>
5335
int GetCursorLeft();
5436

5537
/// <summary>
56-
/// Obtains the horizontal position of the console cursor. Use this method
57-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
58-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
59-
/// on Unix platforms.
38+
/// Obtains the horizontal position of the console cursor. TODO: Is this still necessary?
6039
/// </summary>
6140
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
6241
/// <returns>The horizontal position of the console cursor.</returns>
6342
int GetCursorLeft(CancellationToken cancellationToken);
6443

6544
/// <summary>
66-
/// Obtains the horizontal position of the console cursor. Use this method
67-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
68-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
69-
/// on Unix platforms.
70-
/// </summary>
71-
/// <returns>
72-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
73-
/// <see cref="Task{T}.Result" /> property will return the horizontal position
74-
/// of the console cursor.
75-
/// </returns>
76-
Task<int> GetCursorLeftAsync();
77-
78-
/// <summary>
79-
/// Obtains the horizontal position of the console cursor. Use this method
80-
/// instead of <see cref="System.Console.CursorLeft" /> to avoid triggering
81-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
82-
/// on Unix platforms.
83-
/// </summary>
84-
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
85-
/// <returns>
86-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
87-
/// <see cref="Task{T}.Result" /> property will return the horizontal position
88-
/// of the console cursor.
89-
/// </returns>
90-
Task<int> GetCursorLeftAsync(CancellationToken cancellationToken);
91-
92-
/// <summary>
93-
/// Obtains the vertical position of the console cursor. Use this method
94-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
95-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
96-
/// on Unix platforms.
45+
/// Obtains the vertical position of the console cursor. TODO: Is this still necessary?
9746
/// </summary>
9847
/// <returns>The vertical position of the console cursor.</returns>
9948
int GetCursorTop();
10049

10150
/// <summary>
102-
/// Obtains the vertical position of the console cursor. Use this method
103-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
104-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
105-
/// on Unix platforms.
51+
/// Obtains the vertical position of the console cursor. TODO: Is this still necessary?
10652
/// </summary>
10753
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
10854
/// <returns>The vertical position of the console cursor.</returns>
10955
int GetCursorTop(CancellationToken cancellationToken);
110-
111-
/// <summary>
112-
/// Obtains the vertical position of the console cursor. Use this method
113-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
114-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
115-
/// on Unix platforms.
116-
/// </summary>
117-
/// <returns>
118-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
119-
/// <see cref="Task{T}.Result" /> property will return the vertical position
120-
/// of the console cursor.
121-
/// </returns>
122-
Task<int> GetCursorTopAsync();
123-
124-
/// <summary>
125-
/// Obtains the vertical position of the console cursor. Use this method
126-
/// instead of <see cref="System.Console.CursorTop" /> to avoid triggering
127-
/// pending calls to <see cref="ReadKeyAsync(bool, CancellationToken)" />
128-
/// on Unix platforms.
129-
/// </summary>
130-
/// <param name="cancellationToken">The <see cref="CancellationToken" /> to observe.</param>
131-
/// <returns>
132-
/// A <see cref="Task{T}" /> representing the asynchronous operation. The
133-
/// <see cref="Task{T}.Result" /> property will return the vertical position
134-
/// of the console cursor.
135-
/// </returns>
136-
Task<int> GetCursorTopAsync(CancellationToken cancellationToken);
13756
}
13857
}

src/PowerShellEditorServices/Services/PowerShell/Console/IReadLine.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using System;
54
using System.Security;
65
using System.Threading;
76

0 commit comments

Comments
 (0)