microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2db9ac850d4b22dd97b01aa5e98bb5b469cddb3a

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/jsDebugConfigAdapter.ts

55lines · modeblame

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