microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dev/v-peq/remove-ios-relative-project-path

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/debuggingConfiguration/debugConfigTypesAndConstants.ts

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