microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/extension/debuggingConfiguration/debugConfigTypesAndConstants.ts
119lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | import { PlatformType } from "../launchArgs"; |
| 5 | import { ILaunchRequestArgs } from "../../debugger/debugSessionBase"; |
| 6 | import * as vscode from "vscode"; |
| 7 | import * as nls from "vscode-nls"; |
| 8 | nls.config({ |
| 9 | messageFormat: nls.MessageFormat.bundle, |
| 10 | bundleFormat: nls.BundleFormat.standalone, |
| 11 | })(); |
| 12 | const localize = nls.loadMessageBundle(); |
| 13 | |
| 14 | export interface DebugConfigurationState { |
| 15 | config: Partial<ILaunchRequestArgs>; |
| 16 | scenarioType: DebugScenarioType; |
| 17 | folder?: vscode.WorkspaceFolder; |
| 18 | token?: vscode.CancellationToken; |
| 19 | } |
| 20 | |
| 21 | export type DebugConfigurationQuickPickItem = vscode.QuickPickItem & { type: string }; |
| 22 | |
| 23 | export enum DebugScenarioType { |
| 24 | RunApp = "runapp", |
| 25 | DebugApp = "debugapp", |
| 26 | AttachApp = "attachapp", |
| 27 | } |
| 28 | |
| 29 | export const DEBUG_TYPES = { |
| 30 | REACT_NATIVE: "reactnative", |
| 31 | REACT_NATIVE_DIRECT: "reactnativedirect", |
| 32 | }; |
| 33 | |
| 34 | export const platformTypeRunPickConfig: DebugConfigurationQuickPickItem[] = [ |
| 35 | { |
| 36 | label: "Android", |
| 37 | type: PlatformType.Android, |
| 38 | }, |
| 39 | { |
| 40 | label: "iOS", |
| 41 | type: PlatformType.iOS, |
| 42 | }, |
| 43 | { |
| 44 | label: "MacOS", |
| 45 | type: PlatformType.macOS, |
| 46 | }, |
| 47 | { |
| 48 | label: "Windows", |
| 49 | type: PlatformType.Windows, |
| 50 | }, |
| 51 | ]; |
| 52 | |
| 53 | export const platformTypeDebugPickConfig: DebugConfigurationQuickPickItem[] = [ |
| 54 | ...platformTypeRunPickConfig, |
| 55 | { |
| 56 | label: "Exponent", |
| 57 | type: PlatformType.Exponent, |
| 58 | }, |
| 59 | ]; |
| 60 | |
| 61 | export const platformTypeDirectPickConfig: DebugConfigurationQuickPickItem[] = [ |
| 62 | { |
| 63 | label: "Hermes engine - Experimental", |
| 64 | type: "", |
| 65 | }, |
| 66 | { |
| 67 | label: "Direct iOS - Experimental", |
| 68 | type: PlatformType.iOS, |
| 69 | }, |
| 70 | ]; |
| 71 | |
| 72 | export const appTypePickConfig: DebugConfigurationQuickPickItem[] = [ |
| 73 | { |
| 74 | label: "Application in direct mode", |
| 75 | type: DEBUG_TYPES.REACT_NATIVE_DIRECT, |
| 76 | }, |
| 77 | { |
| 78 | label: "Classic application", |
| 79 | type: DEBUG_TYPES.REACT_NATIVE, |
| 80 | }, |
| 81 | ]; |
| 82 | |
| 83 | export const shouldUseHermesEngine: DebugConfigurationQuickPickItem[] = [ |
| 84 | { |
| 85 | label: "Yes", |
| 86 | type: "yes", |
| 87 | }, |
| 88 | { |
| 89 | label: "No", |
| 90 | type: "no", |
| 91 | }, |
| 92 | ]; |
| 93 | |
| 94 | export const expoHostTypePickConfig: DebugConfigurationQuickPickItem[] = [ |
| 95 | { |
| 96 | label: "Tunnel", |
| 97 | description: localize( |
| 98 | "expoHostTypeTunnel", |
| 99 | "Allows to deploy and debug an application by means of Expo cloud services", |
| 100 | ), |
| 101 | type: "tunnel", |
| 102 | }, |
| 103 | { |
| 104 | label: "LAN", |
| 105 | description: localize( |
| 106 | "expoHostTypeLAN", |
| 107 | "Allows to deploy and install an application via your LAN", |
| 108 | ), |
| 109 | type: "lan", |
| 110 | }, |
| 111 | { |
| 112 | label: "Local", |
| 113 | description: localize( |
| 114 | "expoHostTypeLocal", |
| 115 | "Allows to debug an application on an emulator or an Android device without network connection", |
| 116 | ), |
| 117 | type: "local", |
| 118 | }, |
| 119 | ]; |