microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
866e020b2c664db8b8c5bf972901bc2fc25ddd93

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/debuggingConfiguration/debugConfigTypesAndConstants.ts

280lines · 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
4import { PlatformType } from "../launchArgs";
5import { ILaunchRequestArgs } from "../../debugger/debugSessionBase";
6import { IWDPHelper } from "../../debugger/direct/IWDPHelper";
7import * as vscode from "vscode";
8import * as nls from "vscode-nls";
9nls.config({
10 messageFormat: nls.MessageFormat.bundle,
11 bundleFormat: nls.BundleFormat.standalone,
12})();
13const localize = nls.loadMessageBundle();
14
15export interface DebugConfigurationState {
16 config: Partial<ILaunchRequestArgs>;
17 scenarioType: DebugScenarioType;
18 folder?: vscode.WorkspaceFolder;
19 token?: vscode.CancellationToken;
20}
21
22export type DebugConfigurationQuickPickItem = vscode.QuickPickItem & { type: string };
23
24export enum DebugScenarioType {
25 RunApp = "runapp",
26 DebugApp = "debugapp",
27 AttachApp = "attachapp",
28}
29
30export const DEBUG_TYPES = {
31 REACT_NATIVE: "reactnative",
32 REACT_NATIVE_DIRECT: "reactnativedirect",
33};
34
35export const platformTypeRunPickConfig: DebugConfigurationQuickPickItem[] = [
36 {
37 label: "Android",
38 type: PlatformType.Android,
39 },
40 {
41 label: "iOS",
42 type: PlatformType.iOS,
43 },
44 {
45 label: "MacOS",
46 type: PlatformType.macOS,
47 },
48 {
49 label: "Windows",
50 type: PlatformType.Windows,
51 },
52];
53
54export const platformTypeDebugPickConfig: DebugConfigurationQuickPickItem[] = [
55 ...platformTypeRunPickConfig,
56 {
57 label: "Exponent",
58 type: PlatformType.Exponent,
59 },
60];
61
62export const platformTypeDirectPickConfig: DebugConfigurationQuickPickItem[] = [
63 {
64 label: "Hermes engine - Experimental",
65 type: "",
66 },
67 {
68 label: "Direct iOS - Experimental",
69 type: PlatformType.iOS,
70 },
71];
72
73export const appTypePickConfig: DebugConfigurationQuickPickItem[] = [
74 {
75 label: "Application in direct mode",
76 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
77 },
78 {
79 label: "Classic application",
80 type: DEBUG_TYPES.REACT_NATIVE,
81 },
82];
83
84export const shouldUseHermesEngine: DebugConfigurationQuickPickItem[] = [
85 {
86 label: "Yes",
87 type: "yes",
88 },
89 {
90 label: "No",
91 type: "no",
92 },
93];
94
95export const expoHostTypePickConfig: DebugConfigurationQuickPickItem[] = [
96 {
97 label: "Tunnel",
98 description: localize(
99 "expoHostTypeTunnel",
100 "Allows to deploy and debug an application by means of Expo cloud services",
101 ),
102 type: "tunnel",
103 },
104 {
105 label: "LAN",
106 description: localize(
107 "expoHostTypeLAN",
108 "Allows to deploy and install an application via your LAN",
109 ),
110 type: "lan",
111 },
112 {
113 label: "Local",
114 description: localize(
115 "expoHostTypeLocal",
116 "Allows to debug an application on an emulator or an Android device without network connection",
117 ),
118 type: "local",
119 },
120];
121
122export const DEBUG_CONFIGURATION_NAMES = {
123 ATTACH_TO_HERMES_APPLICATION_EXPERIMENTAL: "Attach to Hermes application - Experimental",
124 ATTACH_TO_DIRECT_IOS_EXPERIMENTAL: "Attach to Direct iOS - Experimental",
125 ATTACH_TO_PACKAGER: "Attach to packager",
126 DEBUG_ANDROID: "Debug Android",
127 DEBUG_IOS: "Debug iOS",
128 DEBUG_WINDOWS: "Debug Windows",
129 DEBUG_MACOS: "Debug macOS",
130 DEBUG_IN_EXPONENT: "Debug in Exponent",
131 DEBUG_ANDROID_HERMES_EXPERIMENTAL: "Debug Android Hermes - Experimental",
132 DEBUG_DIRECT_IOS_EXPERIMENTAL: "Debug Direct iOS - Experimental",
133 DEBUG_IOS_HERMES_EXPERIMENTAL: "Debug iOS Hermes - Experimental",
134 DEBUG_MACOS_HERMES_EXPERIMENTAL: "Debug macOS Hermes - Experimental",
135 DEBUG_WINDOWS_HERMES_EXPERIMENTAL: "Debug Windows Hermes - Experimental",
136 RUN_ANDROID: "Run Android",
137 RUN_IOS: "Run iOS",
138 RUN_ANDROID_HERMES_EXPERIMENTAL: "Run Android Hermes - Experimental",
139 RUN_IOS_HERMES_EXPERIMENTAL: "Run iOS Hermes - Experimental",
140 RUN_DIRECT_IOS_EXPERIMENTAL: "Run Direct iOS - Experimental",
141};
142
143export const debugConfigurations: Record<string, vscode.DebugConfiguration> = {
144 [DEBUG_CONFIGURATION_NAMES.ATTACH_TO_HERMES_APPLICATION_EXPERIMENTAL]: {
145 name: DEBUG_CONFIGURATION_NAMES.ATTACH_TO_HERMES_APPLICATION_EXPERIMENTAL,
146 cwd: "${workspaceFolder}",
147 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
148 request: "attach",
149 },
150 [DEBUG_CONFIGURATION_NAMES.ATTACH_TO_DIRECT_IOS_EXPERIMENTAL]: {
151 name: DEBUG_CONFIGURATION_NAMES.ATTACH_TO_DIRECT_IOS_EXPERIMENTAL,
152 cwd: "${workspaceFolder}",
153 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
154 request: "attach",
155 platform: PlatformType.iOS,
156 useHermesEngine: false,
157 port: IWDPHelper.iOS_WEBKIT_DEBUG_PROXY_DEFAULT_PORT, // 9221
158 },
159 [DEBUG_CONFIGURATION_NAMES.ATTACH_TO_PACKAGER]: {
160 name: DEBUG_CONFIGURATION_NAMES.ATTACH_TO_PACKAGER,
161 cwd: "${workspaceFolder}",
162 type: DEBUG_TYPES.REACT_NATIVE,
163 request: "attach",
164 },
165 [DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID]: {
166 name: DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID,
167 cwd: "${workspaceFolder}",
168 type: DEBUG_TYPES.REACT_NATIVE,
169 request: "launch",
170 platform: PlatformType.Android,
171 },
172 [DEBUG_CONFIGURATION_NAMES.DEBUG_IOS]: {
173 name: DEBUG_CONFIGURATION_NAMES.DEBUG_IOS,
174 cwd: "${workspaceFolder}",
175 type: DEBUG_TYPES.REACT_NATIVE,
176 request: "launch",
177 platform: PlatformType.iOS,
178 },
179 [DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS]: {
180 name: DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS,
181 cwd: "${workspaceFolder}",
182 type: DEBUG_TYPES.REACT_NATIVE,
183 request: "launch",
184 platform: PlatformType.Windows,
185 },
186 [DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS]: {
187 name: DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS,
188 cwd: "${workspaceFolder}",
189 type: DEBUG_TYPES.REACT_NATIVE,
190 request: "launch",
191 platform: PlatformType.macOS,
192 },
193 [DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT]: {
194 name: DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT,
195 cwd: "${workspaceFolder}",
196 type: DEBUG_TYPES.REACT_NATIVE,
197 request: "launch",
198 platform: PlatformType.Exponent,
199 },
200 [DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES_EXPERIMENTAL]: {
201 name: DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES_EXPERIMENTAL,
202 cwd: "${workspaceFolder}",
203 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
204 request: "launch",
205 platform: PlatformType.Android,
206 },
207 [DEBUG_CONFIGURATION_NAMES.DEBUG_DIRECT_IOS_EXPERIMENTAL]: {
208 name: DEBUG_CONFIGURATION_NAMES.DEBUG_DIRECT_IOS_EXPERIMENTAL,
209 cwd: "${workspaceFolder}",
210 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
211 request: "launch",
212 platform: PlatformType.iOS,
213 useHermesEngine: false,
214 target: "device",
215 port: IWDPHelper.iOS_WEBKIT_DEBUG_PROXY_DEFAULT_PORT, // 9221
216 },
217 [DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES_EXPERIMENTAL]: {
218 name: DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES_EXPERIMENTAL,
219 cwd: "${workspaceFolder}",
220 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
221 request: "launch",
222 platform: PlatformType.iOS,
223 },
224 [DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES_EXPERIMENTAL]: {
225 name: DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES_EXPERIMENTAL,
226 cwd: "${workspaceFolder}",
227 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
228 request: "launch",
229 platform: PlatformType.macOS,
230 },
231 [DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES_EXPERIMENTAL]: {
232 name: DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES_EXPERIMENTAL,
233 cwd: "${workspaceFolder}",
234 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
235 request: "launch",
236 platform: PlatformType.Windows,
237 },
238 [DEBUG_CONFIGURATION_NAMES.RUN_ANDROID]: {
239 name: DEBUG_CONFIGURATION_NAMES.RUN_ANDROID,
240 cwd: "${workspaceFolder}",
241 type: DEBUG_TYPES.REACT_NATIVE,
242 request: "launch",
243 platform: PlatformType.Android,
244 enableDebug: false,
245 },
246 [DEBUG_CONFIGURATION_NAMES.RUN_IOS]: {
247 name: DEBUG_CONFIGURATION_NAMES.RUN_IOS,
248 cwd: "${workspaceFolder}",
249 type: DEBUG_TYPES.REACT_NATIVE,
250 request: "launch",
251 platform: PlatformType.iOS,
252 enableDebug: false,
253 },
254 [DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES_EXPERIMENTAL]: {
255 name: DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES_EXPERIMENTAL,
256 cwd: "${workspaceFolder}",
257 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
258 request: "launch",
259 platform: PlatformType.Android,
260 enableDebug: false,
261 },
262 [DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES_EXPERIMENTAL]: {
263 name: DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES_EXPERIMENTAL,
264 cwd: "${workspaceFolder}",
265 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
266 request: "launch",
267 platform: PlatformType.iOS,
268 enableDebug: false,
269 },
270 [DEBUG_CONFIGURATION_NAMES.RUN_DIRECT_IOS_EXPERIMENTAL]: {
271 name: DEBUG_CONFIGURATION_NAMES.RUN_DIRECT_IOS_EXPERIMENTAL,
272 cwd: "${workspaceFolder}",
273 type: DEBUG_TYPES.REACT_NATIVE_DIRECT,
274 request: "launch",
275 platform: PlatformType.iOS,
276 enableDebug: false,
277 useHermesEngine: false,
278 target: "device",
279 },
280};