Skip to content

show*Message block script execution until message is dismissed #1258

Open
@TylerLeonhardt

Description

@TylerLeonhardt

VSCode changed a few things around with their new messages showing up in the bottom right. It kind of broke us but we can consider it as an opportunity to make the show*Message functions better. Here they are:

    private showInformationMessage(message: string): Thenable<EditorOperationResponse> {
        return vscode.window
                     .showInformationMessage(message)
                     .then((_) => EditorOperationResponse.Completed);
    }

    private showErrorMessage(message: string): Thenable<EditorOperationResponse> {
        return vscode.window
                     .showErrorMessage(message)
                     .then((_) => EditorOperationResponse.Completed);
    }

    private showWarningMessage(message: string): Thenable<EditorOperationResponse> {
        return vscode.window
                     .showWarningMessage(message)
                     .then((_) => EditorOperationResponse.Completed);
    }

They exist in: $psEditor.Window:

$psEditor.Window.showInformationMessage("foo")
$psEditor.Window.showErrorMessage("foo")
$psEditor.Window.showWarningMesssage("foo")

When you run one of these, a message pops up and the script does blocks until the message is dismissed.

Now, we have the ability to take advantage of the new editor features like list options (a message pops op with a choice). We could change the message to being a custom object with the schema of:

{
    message: string,
    items: string[],
    waitForResponse: bool
}

waitForResponse would allow users to just show a message and not wait on it to be dismissed.
items would show options in the message for the user to select

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions