From b616a7d55d400513cd633fb2b36c0e5c86ab255b Mon Sep 17 00:00:00 2001 From: xnkevinnguyen Date: Thu, 20 Feb 2020 17:06:26 -0800 Subject: [PATCH] Send stacktrace message from adapter --- src/view/App.tsx | 20 ++++++++++++++------ src/view/constants.ts | 4 ++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/view/App.tsx b/src/view/App.tsx index b0d26112d..9c4e0802a 100644 --- a/src/view/App.tsx +++ b/src/view/App.tsx @@ -3,7 +3,11 @@ import * as React from "react"; import "./App.css"; -import { DEVICE_LIST_KEY, VSCODE_MESSAGES_TO_WEBVIEW } from "./constants"; +import { + DEVICE_LIST_KEY, + VSCODE_MESSAGES_TO_WEBVIEW, + DEBUG_COMMANDS, +} from "./constants"; import { Device } from "./container/device/Device"; interface IState { @@ -48,11 +52,15 @@ class App extends React.Component<{}, IState> { handleMessage = (event: any): void => { const message = event.data; console.log(JSON.stringify(message)); - if ( - message.command === VSCODE_MESSAGES_TO_WEBVIEW.SET_DEVICE && - message.active_device !== this.state.currentDevice - ) { - this.setState({ currentDevice: message.active_device }); + switch (message.command) { + case VSCODE_MESSAGES_TO_WEBVIEW.SET_DEVICE: + if (message.active_device !== this.state.currentDevice) { + this.setState({ currentDevice: message.active_device }); + } + break; + case DEBUG_COMMANDS.CONTINUE: + case DEBUG_COMMANDS.STACK_TRACE: + break; } }; } diff --git a/src/view/constants.ts b/src/view/constants.ts index c754441e7..3b2159aa1 100644 --- a/src/view/constants.ts +++ b/src/view/constants.ts @@ -67,5 +67,9 @@ export enum WEBVIEW_MESSAGES { export enum VSCODE_MESSAGES_TO_WEBVIEW { SET_DEVICE = "set-device", } +export enum DEBUG_COMMANDS { + STACK_TRACE = "stackTrace", + CONTINUE = "continue", +} export default CONSTANTS;