Skip to content

Improve ConvertTo-SplatExpression error message when cursor position is not within a command. #27

Description

@SeeminglyScience

Right now the error message is this:

ConvertTo-SplatExpression : Unable to find an AST of type 'CommandAst' at the specified location.
At line:1 char:1
+ ConvertTo-SplatExpression
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [ConvertTo-SplatExpression], ArgumentException
+ FullyQualifiedErrorId : MissingAst,ConvertTo-SplatExpression

Which is pretty meaningless to most people. Should be something like "Unable to determine which command to splat. Ensure the cursor is placed within a command and try again."

I should also check for active selections and look for CommandAst's anywhere within.

Thank you @jkavanagh58!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions