microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.11.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/commands/debugScenario.ts

326lines · 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 assert from "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 AttachHermesApplicationExperimental extends Command {
39 codeName = "debugScenario.attachHermesApplicationExperimental";
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.debugInHermesExponentExperimental";
158 label = "";
159 error = ErrorHelper.getInternalError(
160 InternalErrorCode.DebuggingCommandFailed,
161 DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT_HERMES_EXPERIMENTAL,
162 );
163
164 async baseFn(): Promise<void> {
165 assert(this.project);
166 startDebug(
167 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IN_EXPONENT_HERMES_EXPERIMENTAL],
168 this.project,
169 );
170 }
171}
172
173export class DebugAndroidHermesExperimental extends Command {
174 codeName = "debugScenario.debugAndroidHermesExperimental";
175 label = "";
176 error = ErrorHelper.getInternalError(
177 InternalErrorCode.DebuggingCommandFailed,
178 DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES,
179 );
180
181 async baseFn(): Promise<void> {
182 assert(this.project);
183 startDebug(
184 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_ANDROID_HERMES],
185 this.project,
186 );
187 }
188}
189
190export class DebugDirectIosExperimental extends Command {
191 codeName = "debugScenario.debugDirectIosExperimental";
192 label = "";
193 error = ErrorHelper.getInternalError(
194 InternalErrorCode.DebuggingCommandFailed,
195 DEBUG_CONFIGURATION_NAMES.DEBUG_DIRECT_IOS_EXPERIMENTAL,
196 );
197
198 async baseFn(): Promise<void> {
199 assert(this.project);
200 startDebug(
201 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_DIRECT_IOS_EXPERIMENTAL],
202 this.project,
203 );
204 }
205}
206
207export class DebugIosHermesExperimental extends Command {
208 codeName = "debugScenario.debugIosHermesExperimental";
209 label = "";
210 error = ErrorHelper.getInternalError(
211 InternalErrorCode.DebuggingCommandFailed,
212 DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES,
213 );
214
215 async baseFn(): Promise<void> {
216 assert(this.project);
217 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_IOS_HERMES], this.project);
218 }
219}
220
221export class DebugMacosHermesExperimental extends Command {
222 codeName = "debugScenario.debugMacosHermesExperimental";
223 label = "";
224 error = ErrorHelper.getInternalError(
225 InternalErrorCode.DebuggingCommandFailed,
226 DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES_EXPERIMENTAL,
227 );
228
229 async baseFn(): Promise<void> {
230 assert(this.project);
231 startDebug(
232 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_MACOS_HERMES_EXPERIMENTAL],
233 this.project,
234 );
235 }
236}
237
238export class DebugWindowsHermesExperimental extends Command {
239 codeName = "debugScenario.debugWindowsHermesExperimental";
240 label = "";
241 error = ErrorHelper.getInternalError(
242 InternalErrorCode.DebuggingCommandFailed,
243 DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES_EXPERIMENTAL,
244 );
245
246 async baseFn(): Promise<void> {
247 assert(this.project);
248 startDebug(
249 debugConfigurations[DEBUG_CONFIGURATION_NAMES.DEBUG_WINDOWS_HERMES_EXPERIMENTAL],
250 this.project,
251 );
252 }
253}
254
255export class RunAndroid extends Command {
256 codeName = "debugScenario.runAndroid";
257 label = "";
258 error = ErrorHelper.getInternalError(
259 InternalErrorCode.DebuggingCommandFailed,
260 DEBUG_CONFIGURATION_NAMES.RUN_ANDROID,
261 );
262
263 async baseFn(): Promise<void> {
264 assert(this.project);
265 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_ANDROID], this.project);
266 }
267}
268
269export class RunIos extends Command {
270 codeName = "debugScenario.runIos";
271 label = "";
272 error = ErrorHelper.getInternalError(
273 InternalErrorCode.DebuggingCommandFailed,
274 DEBUG_CONFIGURATION_NAMES.RUN_IOS,
275 );
276
277 async baseFn(): Promise<void> {
278 assert(this.project);
279 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_IOS], this.project);
280 }
281}
282
283export class RunAndroidHermesExperimental extends Command {
284 codeName = "debugScenario.runAndroidHermesExperimental";
285 label = "";
286 error = ErrorHelper.getInternalError(
287 InternalErrorCode.DebuggingCommandFailed,
288 DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES,
289 );
290
291 async baseFn(): Promise<void> {
292 assert(this.project);
293 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_ANDROID_HERMES], this.project);
294 }
295}
296
297export class RunIosHermesExperimental extends Command {
298 codeName = "debugScenario.runIosHermesExperimental";
299 label = "";
300 error = ErrorHelper.getInternalError(
301 InternalErrorCode.DebuggingCommandFailed,
302 DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES,
303 );
304
305 async baseFn(): Promise<void> {
306 assert(this.project);
307 startDebug(debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_IOS_HERMES], this.project);
308 }
309}
310
311export class RunDirectIosExperimental extends Command {
312 codeName = "debugScenario.runDirectIosExperimental";
313 label = "";
314 error = ErrorHelper.getInternalError(
315 InternalErrorCode.DebuggingCommandFailed,
316 DEBUG_CONFIGURATION_NAMES.RUN_DIRECT_IOS_EXPERIMENTAL,
317 );
318
319 async baseFn(): Promise<void> {
320 assert(this.project);
321 startDebug(
322 debugConfigurations[DEBUG_CONFIGURATION_NAMES.RUN_DIRECT_IOS_EXPERIMENTAL],
323 this.project,
324 );
325 }
326}
327