From 9ec9f395c780b718d6a2efad912ac1ed5c805463 Mon Sep 17 00:00:00 2001 From: shmck Date: Sun, 12 Jan 2020 19:23:44 -0800 Subject: [PATCH] move notification into status bar --- src/editor/commands.ts | 5 +++-- src/services/notify/index.ts | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/services/notify/index.ts diff --git a/src/editor/commands.ts b/src/editor/commands.ts index 7c529de2..ecbf1153 100644 --- a/src/editor/commands.ts +++ b/src/editor/commands.ts @@ -1,5 +1,6 @@ import * as T from 'typings' import * as vscode from 'vscode' +import notify from '../services/notify' import createTestRunner, { Payload } from '../services/testRunner' import createWebView from '../webview' @@ -56,13 +57,13 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }: testRunner = createTestRunner(config, { onSuccess: (payload: Payload) => { // send test pass message back to client - vscode.window.showInformationMessage('PASS') + notify({ message: 'PASS' }) webview.send({ type: 'TEST_PASS', payload }) // update local storage }, onFail: (payload: Payload, message: string) => { // send test fail message back to client - vscode.window.showWarningMessage(`FAIL ${message}`) + notify({ message: `FAIL ${message}` }) webview.send({ type: 'TEST_FAIL', payload }) }, onError: (payload: Payload) => { diff --git a/src/services/notify/index.ts b/src/services/notify/index.ts new file mode 100644 index 00000000..6b9176f1 --- /dev/null +++ b/src/services/notify/index.ts @@ -0,0 +1,11 @@ +import * as vscode from 'vscode' + +interface Props { + message: string +} + +const notify = ({ message }: Props) => { + vscode.window.setStatusBarMessage(message, 15000) +} + +export default notify