Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify basic debug scenarios #1033

Merged
merged 5 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions doc/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ For UWP apps use `windows` target platform in `launch.json` configuration, e.g.:
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "windows",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
"platform": "windows"
}
```

Expand All @@ -65,8 +63,6 @@ For WPF apps use `wpf`, e.g.(WPF debugging available only for react-native-windo
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "wpf",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
"platform": "wpf"
}
```
26 changes: 4 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@
"program": "^\"\\${workspaceRoot}/.vscode/launchReactNative.js\"",
"type": "reactnative",
"request": "launch",
"platform": "android",
"sourceMaps": true,
"outDir": "^\"\\${workspaceRoot}/.vscode/.react\""
"platform": "android"
}
},
{
Expand All @@ -142,9 +140,7 @@
"program": "^\"\\${workspaceRoot}/.vscode/launchReactNative.js\"",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"sourceMaps": true,
"outDir": "^\"\\${workspaceRoot}/.vscode/.react\""
"platform": "ios"
}
},
{
Expand All @@ -154,9 +150,7 @@
"name": "Attach to packager",
"program": "^\"\\${workspaceRoot}/.vscode/launchReactNative.js\"",
"type": "reactnative",
"request": "attach",
"sourceMaps": true,
"outDir": "^\"\\${workspaceRoot}/.vscode/.react\""
"request": "attach"
}
},
{
Expand All @@ -167,9 +161,7 @@
"program": "^\"\\${workspaceRoot}/.vscode/launchReactNative.js\"",
"type": "reactnative",
"request": "launch",
"platform": "exponent",
"sourceMaps": true,
"outDir": "^\"\\${workspaceRoot}/.vscode/.react\""
"platform": "exponent"
}
}
],
Expand All @@ -188,11 +180,6 @@
"description": "%reactNative.attach.sourceMaps.description%",
"default": false
},
"outDir": {
"type": "string",
"description": "%reactNative.attach.outDir.description%",
"default": null
},
"sourceMapPathOverrides": {
"type": "object",
"description": "%reactNative.attach.sourceMapsPathOverrides.description%"
Expand Down Expand Up @@ -295,11 +282,6 @@
"ReactNativeJS:V"
]
},
"outDir": {
"type": "string",
"description": "%reactNative.launch.outDir.description%",
"default": null
},
"runArguments": {
"type": "array",
"description": "%reactNative.launch.runArguments.description%"
Expand Down
1 change: 0 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"reactNative.snippets.debugExpo.description":"A new configuration for launching Expo app",
"reactNative.attach.program.description":"The path to launchReactNative.js in the vscode folder",
"reactNative.attach.sourceMaps.description":"Whether to use JavaScript source maps to map the generated bundled code back to its original sources",
"reactNative.attach.outDir.description":"The location of the generated JavaScript code (the bundle file). Normally this should be \"${workspaceRoot}/.vscode/.react\"",
"reactNative.attach.sourceMapsPathOverrides.description":"A set of mappings for rewriting the locations of source files from what the source map says, to their locations on disk. See https://github.com/Microsoft/vscode-react-native/blob/master/doc/debugging.md#debugging-with-typescript-and-haul for details",
"reactNative.attach.trace.description":"Setup logging level in debugger.",
"reactNative.attach.address.description":"TCP/IP address of debug port. Default is 'localhost'.",
Expand Down
3 changes: 3 additions & 0 deletions src/debugger/nodeDebugWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ export function makeSession(
logger.setup(Logger.LogLevel.Log, chromeDebugCoreLogs || false);
}

if (!args.sourceMaps) {
args.sourceMaps = true;
}
const projectRootPath = getProjectRoot(args);
return ReactNativeProjectHelper.isReactNativeProject(projectRootPath)
.then((result) => {
Expand Down
8 changes: 0 additions & 8 deletions src/extension/debugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,26 @@ export class ReactNativeDebugConfigProvider implements vscode.DebugConfiguration
"type": "reactnative",
"request": "launch",
"platform": "android",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react",
},
"Debug iOS": {
"name": "Debug iOS",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react",
},
"Attach to packager": {
"name": "Attach to packager",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "attach",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react",
},
"Debug in Exponent": {
"name": "Debug in Exponent",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "exponent",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react",
},
};

Expand Down
3 changes: 0 additions & 3 deletions src/extension/rn-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ export function activate(context: vscode.ExtensionContext): Q.Promise<void> {
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((event) => onChangeConfiguration(context)));

debugConfigProvider = vscode.debug.registerDebugConfigurationProvider("reactnative", configProvider);

let activateExtensionEvent = TelemetryHelper.createTelemetryEvent("activate");
Telemetry.send(activateExtensionEvent);


let promises: any = [];
if (workspaceFolders) {
outputChannelLogger.debug(`Projects found: ${workspaceFolders.length}`);
Expand Down
18 changes: 5 additions & 13 deletions test/smoke/resources/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,27 @@
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "android",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
"platform": "android"
},
{
"name": "Debug iOS",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
"platform": "ios"
},
{
"name": "Attach to packager",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "attach",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
"request": "attach"
},
{
"name": "Debug in Exponent",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "exponent",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
"platform": "exponent"
}
]
}
}