Skip to content

Improvements to REPL execution #105

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

Merged
merged 10 commits into from
Jan 5, 2016
Merged

Improvements to REPL execution #105

merged 10 commits into from
Jan 5, 2016

Conversation

daviwil
Copy link
Contributor

@daviwil daviwil commented Jan 5, 2016

These changes vastly improve the current state of execution of commands in the REPL both while running inside and outside of the debugger. The biggest change is that we now show the PowerShell prompt in the REPL output. We also can now stream the results of commands run in the debugger console so that the user doesn't have to wait to see output until the command finishes. Lastly, we now handle RuntimeExceptions correctly sending the error output to the host.

This change causes RuntimeExceptions thrown during
PowerShellContext.ExecuteCommand calls to be written to the host.
Previously these error messages were not being written so users did not
see error output for any commands using the "-ErrorAction Stop" parameter.
This change fixes a REPL execution bug in the LanguageServer which caused
a NullReferenceException when the executed command failed due to an
exception.  The offending code was removed.
This change fixes an issue in PowerShellContext which causes a
RunspaceHandle to not be disposed if an exception is thrown during command
execution.  A 'finally' block is now used to properly dispose of the
RunspaceHandle so that future command executions can proceed.
This change improves the REPL such that the current 'prompt' function is
executed and its result written to the host after the user executes a
command.  Existing tests which deal with console output are also updated
to reflect these changes.

Resolves #84.
This change adds a new parameter to PowerShellContext.ExecuteScriptString
which causes the executed script string to be echoed to the host.  This is
useful for "run selection" operations where some selected text is executed
in the REPL.
This change adds the next 'context' parameter to EvaluateRequest, allowing
the debug adapter client to identify whether an 'evaluate' request will be
used for evaluating an expression for value display or REPL execution.
This allows us to write out REPL command output only when expressions are
being evaluated in that context.
This change updates the way we execute commands in the debugger which need
to have their output streamed to the console.  Previously the command
execution would just evaluate the expression and return the results
without writing them to the host.  Now for PowerShell v4/5 users, the output
can be streamed as the command is being executed.  For PowerShell v3 users
the output will be written after the command fully completes executing.
This change fixes the current PowerShellVersionTests to use an absolute
path to the version-specific PowerShell reference assembly.  The relative
path which was being used somehow caused MSBuild to use the in-box
PowerShell v5 assemblies since the HintPath couldn't be found.  This
caused the tests for PowerShell 3 and 4 to pass even though they should be
failing.

This change also includes some fixes to existing code that is incompatible
with PowerShell 3 and 4.
@daviwil daviwil force-pushed the daviwil/repl-improvements branch from 594b13e to 3044b62 Compare January 5, 2016 21:14
This change adds helpful log messages to identify the version of both the
host and the PowerShell runtime on the local machine.
daviwil added a commit that referenced this pull request Jan 5, 2016
@daviwil daviwil merged commit 3c5cceb into master Jan 5, 2016
@daviwil daviwil deleted the daviwil/repl-improvements branch January 5, 2016 22:07
TylerLeonhardt pushed a commit to TylerLeonhardt/PowerShellEditorServices that referenced this pull request Feb 26, 2019
…asks-for-pester340

Updates the examples\.vscode\tasks.json file for Pester 3.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants