-
Notifications
You must be signed in to change notification settings - Fork 237
PSReadLine integration (WIP) #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
SeeminglyScience
wants to merge
5
commits into
PowerShell:2.0.0
from
SeeminglyScience:integrate-psreadline
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7ca8b9b
Add infrastructure for managing context
SeeminglyScience 59bfa3b
Console related classes changes
SeeminglyScience 21e6b5f
Rewrite command invocation operations for PSRL
SeeminglyScience fa2faba
Rewrite direct SessionStateProxy calls
SeeminglyScience 94cfdfd
Resolve merge conflicts
SeeminglyScience File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1463,6 +1463,15 @@ private static async Task DelayThenInvokeDiagnostics( | |
catch (TaskCanceledException) | ||
{ | ||
// If the task is cancelled, exit directly | ||
foreach (var script in filesToAnalyze) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment needs to be updated. |
||
{ | ||
await PublishScriptDiagnostics( | ||
script, | ||
script.SyntaxMarkers, | ||
correctionIndex, | ||
eventSender); | ||
} | ||
|
||
return; | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.PowerShell.EditorServices.Console | ||
{ | ||
internal static class ConsoleProxy | ||
{ | ||
private static IConsoleOperations s_consoleProxy; | ||
|
||
static ConsoleProxy() | ||
{ | ||
// Maybe we should just include the RuntimeInformation package for FullCLR? | ||
#if CoreCLR | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
s_consoleProxy = new WindowsConsoleOperations(); | ||
return; | ||
} | ||
|
||
s_consoleProxy = new UnixConsoleOperations(); | ||
#else | ||
s_consoleProxy = new WindowsConsoleOperations(); | ||
#endif | ||
} | ||
|
||
public static Task<ConsoleKeyInfo> ReadKeyAsync(CancellationToken cancellationToken) => | ||
s_consoleProxy.ReadKeyAsync(cancellationToken); | ||
|
||
public static int GetCursorLeft() => | ||
s_consoleProxy.GetCursorLeft(); | ||
|
||
public static int GetCursorLeft(CancellationToken cancellationToken) => | ||
s_consoleProxy.GetCursorLeft(cancellationToken); | ||
|
||
public static Task<int> GetCursorLeftAsync() => | ||
s_consoleProxy.GetCursorLeftAsync(); | ||
|
||
public static Task<int> GetCursorLeftAsync(CancellationToken cancellationToken) => | ||
s_consoleProxy.GetCursorLeftAsync(cancellationToken); | ||
|
||
public static int GetCursorTop() => | ||
s_consoleProxy.GetCursorTop(); | ||
|
||
public static int GetCursorTop(CancellationToken cancellationToken) => | ||
s_consoleProxy.GetCursorTop(cancellationToken); | ||
|
||
public static Task<int> GetCursorTopAsync() => | ||
s_consoleProxy.GetCursorTopAsync(); | ||
|
||
public static Task<int> GetCursorTopAsync(CancellationToken cancellationToken) => | ||
s_consoleProxy.GetCursorTopAsync(cancellationToken); | ||
|
||
/// <summary> | ||
/// On Unix platforms this method is sent to PSReadLine as a work around for issues | ||
/// with the System.Console implementation for that platform. Functionally it is the | ||
/// same as System.Console.ReadKey, with the exception that it will not lock the | ||
/// standard input stream. | ||
/// </summary> | ||
/// <param name="intercept"> | ||
/// Determines whether to display the pressed key in the console window. | ||
/// true to not display the pressed key; otherwise, false. | ||
/// </param> | ||
/// <returns> | ||
/// An object that describes the ConsoleKey constant and Unicode character, if any, | ||
/// that correspond to the pressed console key. The ConsoleKeyInfo object also describes, | ||
/// in a bitwise combination of ConsoleModifiers values, whether one or more Shift, Alt, | ||
/// or Ctrl modifier keys was pressed simultaneously with the console key. | ||
/// </returns> | ||
internal static ConsoleKeyInfo UnixReadKey(bool intercept, CancellationToken cancellationToken) | ||
{ | ||
try | ||
{ | ||
return ((UnixConsoleOperations)s_consoleProxy).ReadKey(intercept, cancellationToken); | ||
} | ||
catch (OperationCanceledException) | ||
{ | ||
return default(ConsoleKeyInfo); | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mistake, must have done a vim line join and didn't notice.