microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dev/v-peq/removeNode10TodoComments

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/commands/debugScenario.ts

340lines · 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 assert = require("assert");
5import * as nls from "vscode-nls";
6import * as vscode from "vscode";
7import { ErrorHelper } from "../../common/error/errorHelper";
8import { InternalErrorCode } from "../../common/error/internalErrorCode";
9import { AppLauncher } from "../appLauncher";
10import {
11 debugConfigurations,
12 DEBUG_CONFIGURATION_NAMES,
13} from "../debuggingConfiguration/debugConfigTypesAndConstants";
14import { Command } from "./util/command";
15
16nls.config({
17 messageFormat: nls.MessageFormat.bundle,
18 bundleFormat: nls.BundleFormat.standalone,
19})();
20const localize = nls.loadMessageBundle();
21
22const startDebug = (debugConfig: typeof debugConfigurations[string], project: AppLauncher) => {
23 assert(
24 debugConfig,
25 new Error(
26 localize(
27 "CouldNotFindPredefinedDebugConfig",
28 "Couldn't find predefined debugging configuration by name '{0}'",
29 debugConfig.name,
30 ),
31 ),
32 );
33
34 debugConfig.isDynamic = true;
35 void vscode.debug.startDebugging(project.getWorkspaceFolder(), debugConfig);
36};
37
38export class AttachHermesApplication extends Command {
39 codeName = "debugScenario.attachHermesApplication";
40 label = "";
41 error = ErrorHelper.getInternalError(
42 InternalErrorCode.DebuggingCommandFailed,
43 DEBUG_CONFIGURATION_NAMES.ATTACH_TO_HERMES_APPLICATION,
44 );
45
46 async baseFn(): Promise<void> {
47 assert(this.project);
48 startDebug(
49 debugConfigurations[DEBUG_CONFIGURATION_NAMES.ATTACH_TO_HERMES_APPLICATION],
50 this.project,
51 );
52 }
53}
54
55export class AttachDirectIosExperimental extends Command {
56 codeName = "debugScenario.attachDirectIosExperimental";
57 label = "";
58 error = ErrorHelper.getInternalError(
59 InternalErrorCode.DebuggingCommandFailed,
60 DEBUG_CONFIGURATION_NAMES.ATTACH_TO_DIRECT_IOS_EXPERIMENTAL,
61 );
62
63 async baseFn(): Promise<void> {
64 assert(this.project);
65 startDebug(
66 debugConfigurations[DEBUG_CONFIGURATION_NAMES.ATTACH_TO_DIRECT_IOS_EXPERIMENTAL],
67 this.project,
68 );
69 }
70}
71
72export class AttachToPackager extends Command {
73 codeName = "debugScenario.attachToPackager";
74 label = "";
75 error = ErrorHelper.getInternalError(
76 InternalErrorCode.DebuggingCommandFailed,
77 DEBUG_CONFIGURATION_NAMES.ATTACH_TO_PACKAGER,
78 );
79
80 async baseFn(): Promise<void> {
81 assert(this.project);
82 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.ATTACH_TO_PACKAGER], this.project);
83 }
84}
85
86export class DebugAndroid extends Command {
87 codeName = "debugScenario.debugAndroid";
88 label = "";
89 error = ErrorHelper.getInternalError(
90 InternalErrorCode.DebuggingCommandFailed,
91 DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID,
92 );
93
94 async baseFn(): Promise<void> {
95 assert(this.project);
96 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID], this.project);
97 }
98}
99
100export class DebugIos extends Command {
101 codeName = "debugScenario.debugIos";
102 label = "";
103 error = ErrorHelper.getInternalError(
104 InternalErrorCode.DebuggingCommandFailed,
105 DEBUG_CONFIGURATION_NAMES.DEBUG_IOS,
106 );
107
108 async baseFn(): Promise<void> {
109 assert(this.project);
110 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IOS], this.project);
111 }
112}
113
114export class DebugWindows extends Command {
115 codeName = "debugScenario.debugWindows";
116 label = "";
117 error = ErrorHelper.getInternalError(
118 InternalErrorCode.DebuggingCommandFailed,
119 DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS,
120 );
121
122 async baseFn(): Promise<void> {
123 assert(this.project);
124 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS], this.project);
125 }
126}
127
128export class DebugMacos extends Command {
129 codeName = "debugScenario.debugMacos";
130 label = "";
131 error = ErrorHelper.getInternalError(
132 InternalErrorCode.DebuggingCommandFailed,
133 DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS,
134 );
135
136 async baseFn(): Promise<void> {
137 assert(this.project);
138 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS], this.project);
139 }
140}
141
142export class DebugInExponent extends Command {
143 codeName = "debugScenario.debugInExponent";
144 label = "";
145 error = ErrorHelper.getInternalError(
146 InternalErrorCode.DebuggingCommandFailed,
147 DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT,
148 );
149
150 async baseFn(): Promise<void> {
151 assert(this.project);
152 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT], this.project);
153 }
154}
155
156export class DebugInHermesExponent extends Command {
157 codeName = "debugScenario.debugInHermesExponent";
158 label = "";
159 error = ErrorHelper.getInternalError(
160 InternalErrorCode.DebuggingCommandFailed,
161 DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT_HERMES,
162 );
163
164 async baseFn(): Promise<void> {
165 assert(this.project);
166 startDebug(
167 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT_HERMES],
168 this.project,
169 );
170 }
171}
172
173export class DebugInExponentWeb extends Command {
174 codeName = "debugScenario.debugInExponentWeb";
175 label = "";
176 error = ErrorHelper.getInternalError(
177 InternalErrorCode.DebuggingCommandFailed,
178 DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT_WEB,
179 );
180
181 async baseFn(): Promise<void> {
182 assert(this.project);
183 startDebug(
184 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT_WEB],
185 this.project,
186 );
187 }
188}
189
190export class DebugAndroidHermes extends Command {
191 codeName = "debugScenario.debugAndroidHermes";
192 label = "";
193 error = ErrorHelper.getInternalError(
194 InternalErrorCode.DebuggingCommandFailed,
195 DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES,
196 );
197
198 async baseFn(): Promise<void> {
199 assert(this.project);
200 startDebug(
201 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES],
202 this.project,
203 );
204 }
205}
206
207export class DebugDirectIosExperimental extends Command {
208 codeName = "debugScenario.debugDirectIosExperimental";
209 label = "";
210 error = ErrorHelper.getInternalError(
211 InternalErrorCode.DebuggingCommandFailed,
212 DEBUG_CONFIGURATION_NAMES.DEBUG_DIRECT_IOS_EXPERIMENTAL,
213 );
214
215 async baseFn(): Promise<void> {
216 assert(this.project);
217 startDebug(
218 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_DIRECT_IOS_EXPERIMENTAL],
219 this.project,
220 );
221 }
222}
223
224export class DebugIosHermes extends Command {
225 codeName = "debugScenario.debugIosHermes";
226 label = "";
227 error = ErrorHelper.getInternalError(
228 InternalErrorCode.DebuggingCommandFailed,
229 DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES,
230 );
231
232 async baseFn(): Promise<void> {
233 assert(this.project);
234 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES], this.project);
235 }
236}
237
238export class DebugMacosHermes extends Command {
239 codeName = "debugScenario.debugMacosHermes";
240 label = "";
241 error = ErrorHelper.getInternalError(
242 InternalErrorCode.DebuggingCommandFailed,
243 DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES,
244 );
245
246 async baseFn(): Promise<void> {
247 assert(this.project);
248 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES], this.project);
249 }
250}
251
252export class DebugWindowsHermes extends Command {
253 codeName = "debugScenario.debugWindowsHermes";
254 label = "";
255 error = ErrorHelper.getInternalError(
256 InternalErrorCode.DebuggingCommandFailed,
257 DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES,
258 );
259
260 async baseFn(): Promise<void> {
261 assert(this.project);
262 startDebug(
263 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES],
264 this.project,
265 );
266 }
267}
268
269export class RunAndroid extends Command {
270 codeName = "debugScenario.runAndroid";
271 label = "";
272 error = ErrorHelper.getInternalError(
273 InternalErrorCode.DebuggingCommandFailed,
274 DEBUG_CONFIGURATION_NAMES.RUN_ANDROID,
275 );
276
277 async baseFn(): Promise<void> {
278 assert(this.project);
279 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_ANDROID], this.project);
280 }
281}
282
283export class RunIos extends Command {
284 codeName = "debugScenario.runIos";
285 label = "";
286 error = ErrorHelper.getInternalError(
287 InternalErrorCode.DebuggingCommandFailed,
288 DEBUG_CONFIGURATION_NAMES.RUN_IOS,
289 );
290
291 async baseFn(): Promise<void> {
292 assert(this.project);
293 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_IOS], this.project);
294 }
295}
296
297export class RunAndroidHermes extends Command {
298 codeName = "debugScenario.runAndroidHermes";
299 label = "";
300 error = ErrorHelper.getInternalError(
301 InternalErrorCode.DebuggingCommandFailed,
302 DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES,
303 );
304
305 async baseFn(): Promise<void> {
306 assert(this.project);
307 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES], this.project);
308 }
309}
310
311export class RunIosHermes extends Command {
312 codeName = "debugScenario.runIosHermes";
313 label = "";
314 error = ErrorHelper.getInternalError(
315 InternalErrorCode.DebuggingCommandFailed,
316 DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES,
317 );
318
319 async baseFn(): Promise<void> {
320 assert(this.project);
321 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES], this.project);
322 }
323}
324
325export class RunDirectIosExperimental extends Command {
326 codeName = "debugScenario.runDirectIosExperimental";
327 label = "";
328 error = ErrorHelper.getInternalError(
329 InternalErrorCode.DebuggingCommandFailed,
330 DEBUG_CONFIGURATION_NAMES.RUN_DIRECT_IOS_EXPERIMENTAL,
331 );
332
333 async baseFn(): Promise<void> {
334 assert(this.project);
335 startDebug(
336 debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_DIRECT_IOS_EXPERIMENTAL],
337 this.project,
338 );
339 }
340}