react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Add Windows configuration to VS Code's RN Tools

Open kmelmon opened this issue 7 years ago • 13 comments

When installing VS Code's react-native-tools, you'll get configurations to run on Android/iOS, but there is no configuration to run on Windows. We should add that configuration. This will avoid the manual steps as outlined in the wiki. See: https://github.com/microsoft/react-native-windows/wiki/VS-Code-Debugging

The manual steps currently look like copy/pasting this into launch.json: { "name": "Debug Windows", "cwd": "${workspaceFolder}", "type": "reactnative", "request": "launch", "platform": "windows" }

Note that we may need to track this with a task in the VS Code github as well. Starting here to make it easier to track on the RN4W side.

kmelmon avatar Nov 05 '19 01:11 kmelmon

It's possible you don't have react-native-windows set up so this needs to not do nothing. Could it be a prompt to direct the developer to RNW? This would need to be an edit in the VSCode repo, not ours.

chrisglein avatar Nov 06 '19 19:11 chrisglein

I have added the Windows configuration to the presets in the React Native extension. If react-native-windows is not set up, the session fails with the following message: error Unrecognized command "run-windows". If everything looks reasonable, I'll go ahead and edit the wiki. Please let me know, if I missed anything!

nasadigital avatar Jan 06 '20 18:01 nasadigital

I have added the Windows configuration to the presets in the React Native extension. If react-native-windows is not set up, the session fails with the following message: error Unrecognized command "run-windows". If everything looks reasonable, I'll go ahead and edit the wiki. Please let me know, if I missed anything!

@nasadigital Would it be possible to add something in the plugin code to detect if react-native-windows is installed when running the new command and display something to the user to let them know they need to first install it? This would help new react-native-windows customers avoid potential confusion.

I'd like to see a message displayed like: It appears you don't have react-native-windows installed. Go to https://github.com/microsoft/react-native-windows#getting-started for more info.

kmelmon avatar Jan 08 '20 00:01 kmelmon

@nasadigital Would it be possible to add something in the plugin code to detect if react-native-windows is installed when running the new command and display something to the user to let them know they need to first install it? This would help new react-native-windows customers avoid potential confusion.

I'd like to see a message displayed like: It appears you don't have react-native-windows installed. Go to https://github.com/microsoft/react-native-windows#getting-started for more info.

@kmelmon Makes sense, let me give it a go! How would I go about checking whether react-native-windows is installed? Is checking for the 'rnpm-plugin-windows' dependency sufficient or is it more reasonable to check if a windows directory exists in the project root?

nasadigital avatar Jan 08 '20 18:01 nasadigital

I'd do a require.resolve('react-native-windows', {paths: [ pathOfTheProject ] }); with a try catch to see if it succeeeds. The rnpm-plugin-windows dependency is optional, its really just an installation helper, so isn't a good thing to check.

acoates-ms avatar Jan 08 '20 19:01 acoates-ms

Sounds good! I'll chat with RN extensions folks and send out a PR promptly.

nasadigital avatar Jan 08 '20 20:01 nasadigital

With the generous help of RN extension folks, a more helpful message is shown to the user if they try to debug windows and it seems they haven't installed the 'react-native-windows' package. If everything looks reasonable, I'll go ahead and edit the wiki.

nasadigital avatar Jan 15 '20 16:01 nasadigital

Thanks @nasadigital! #1191 looks good, feel free to edit the wiki.

kmelmon avatar Jan 16 '20 00:01 kmelmon

Hi @kmelmon . React Native Tools v0.14.0 with Debug Windows scenario just have been released.

SounD120 avatar Jan 16 '20 12:01 SounD120

@kmelmon I didn't have permissions to edit the wiki so I asked @savatia to check in the changes. Let me know if there is anything else I can do.

nasadigital avatar Jan 16 '20 18:01 nasadigital

@nasadigital I can add you as a core contributor. First I'll need you to link your github account to the Microsoft org. Go here: https://opensource.microsoft.com/link

kmelmon avatar Jan 16 '20 22:01 kmelmon

@kmelmon Thank you! I linked the account and the wiki is updated: https://github.com/microsoft/react-native-windows/wiki/VS-Code-Debugging

nasadigital avatar Jan 23 '20 16:01 nasadigital

@nasadigital @kmelmon Sounds like everything is wrapped up here? Safe to close this issue?

chrisglein avatar Feb 03 '20 04:02 chrisglein