microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
test-microbuild1

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/debuggingConfiguration/configurationProviders/runConfigProvider.ts

94lines · modeblame

5471436aRedMickey5 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 { MultiStepInput, InputStep } from "../multiStepInput";
5import {
6DebugConfigurationState,
7platformTypeRunPickConfig,
8DEBUG_TYPES,
9DebugScenarioType,
10} from "../debugConfigTypesAndConstants";
11import { PlatformType } from "../../launchArgs";
12import { ILaunchRequestArgs } from "../../../debugger/debugSessionBase";
09f6024fHeniker4 years ago13import { BaseConfigProvider } from "./baseConfigProvider";
5471436aRedMickey5 years ago14
15export class RunConfigProvider extends BaseConfigProvider {
16constructor() {
17super();
18this.maxStepCount = 2;
19}
20
21public async buildConfiguration(
22input: MultiStepInput<DebugConfigurationState>,
23state: DebugConfigurationState,
24): Promise<InputStep<DebugConfigurationState> | void> {
25state.config = {};
26const config: Partial<ILaunchRequestArgs> = {
27name: "Run application",
28request: "launch",
29type: DEBUG_TYPES.REACT_NATIVE,
30cwd: "${workspaceFolder}",
31enableDebug: false,
32};
33
34state.scenarioType = DebugScenarioType.RunApp;
35
36await this.configurationProviderHelper.selectPlatform(
37input,
38config,
39platformTypeRunPickConfig,
401,
41this.maxStepCount,
42);
43
44Object.assign(state.config, config);
45
008d88e5RedMickey4 years ago46if (state.config.platform !== PlatformType.Exponent) {
0d77292aJiglioNero4 years ago47return async () => {
48await this.configureApplicationType(input, state.config);
49if (
50state.config.platform === PlatformType.iOS &&
51state.config.type === DEBUG_TYPES.REACT_NATIVE_DIRECT
52) {
53this.maxStepCount = 3;
54await this.configureUseHermesEngine(input, state.config);
55// Direct iOS debugging using ios-webkit-debug-proxy is supported
56// only with applications running on the device
57if (state.config.useHermesEngine === false) {
58state.config.target = "device";
6f9a0779JiglioNero5 years ago59}
0d77292aJiglioNero4 years ago60}
61};
5471436aRedMickey5 years ago62}
09f6024fHeniker4 years ago63
64return;
5471436aRedMickey5 years ago65}
66
67private async configureApplicationType(
68input: MultiStepInput<DebugConfigurationState>,
69config: Partial<ILaunchRequestArgs>,
70): Promise<InputStep<DebugConfigurationState> | void> {
71await this.configurationProviderHelper.selectApplicationType(
72input,
73config,
742,
75this.maxStepCount,
76);
77}
6f9a0779JiglioNero5 years ago78
79private async configureUseHermesEngine(
80input: MultiStepInput<DebugConfigurationState>,
81config: Partial<ILaunchRequestArgs>,
82): Promise<InputStep<DebugConfigurationState> | void> {
83delete config.useHermesEngine;
84await this.configurationProviderHelper.shouldUseHermesEngine(
85input,
86config,
873,
88this.maxStepCount,
89);
90if (config.useHermesEngine) {
91delete config.useHermesEngine;
92}
93}
5471436aRedMickey5 years ago94}