microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0b26572933760cf0f3452564671b267c7ba394cf

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/jsDebugConfigAdapter.ts

56lines · 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 { IAttachRequestArgs } from "./debugSessionBase";
5
6export class JsDebugConfigAdapter {
7 public static createDebuggingConfigForPureRN(attachArgs: IAttachRequestArgs, cdpProxyPort: number, sessionId: string): any {
8 return Object.assign({}, JsDebugConfigAdapter.getExistingExtraArgs(attachArgs), {
9 type: "pwa-node",
10 request: "attach",
11 name: "Attach",
12 continueOnAttach: true,
13 port: cdpProxyPort,
14 smartStep: false,
15 // The unique identifier of the debug session. It is used to distinguish React Native extension's
16 // debug sessions from other ones. So we can save and process only the extension's debug sessions
17 // in vscode.debug API methods "onDidStartDebugSession" and "onDidTerminateDebugSession".
18 rnDebugSessionId: sessionId,
19 });
20 }
21
22 public static createDebuggingConfigForRNHermes(attachArgs: IAttachRequestArgs, cdpProxyPort: number, sessionId: string): any {
23 return Object.assign({}, JsDebugConfigAdapter.getExistingExtraArgs(attachArgs), {
24 type: "pwa-node",
25 request: "attach",
26 name: "Attach",
27 continueOnAttach: true,
28 port: cdpProxyPort,
29 // The unique identifier of the debug session. It is used to distinguish React Native extension's
30 // debug sessions from other ones. So we can save and process only the extension's debug sessions
31 // in vscode.debug API methods "onDidStartDebugSession" and "onDidTerminateDebugSession".
32 rnDebugSessionId: sessionId,
33 });
34 }
35
36 private static getExistingExtraArgs(attachArgs: IAttachRequestArgs): any {
37 let existingExtraArgs: any = {};
38 if (attachArgs.env) {
39 existingExtraArgs.env = attachArgs.env;
40 }
41 if (attachArgs.envFile) {
42 existingExtraArgs.envFile = attachArgs.envFile;
43 }
44 if (attachArgs.sourceMaps) {
45 existingExtraArgs.sourceMaps = attachArgs.sourceMaps;
46 }
47 if (attachArgs.sourceMapPathOverrides) {
48 existingExtraArgs.sourceMapPathOverrides = attachArgs.sourceMapPathOverrides;
49 }
50 if (attachArgs.skipFiles) {
51 existingExtraArgs.skipFiles = attachArgs.skipFiles;
52 }
53
54 return existingExtraArgs;
55 }
56}
57