Repository navigation
feat: add Flutter-style device selector - #11
Merged
Merged
Conversation
Status bar item (right side) shows the selected device and opens a picker listing running devices and offline emulators/simulators. Starting an offline Android emulator (normal or cold boot) or iOS simulator selects it once it connects. The selection is saved per workspace and fills `target` for Android/iOS launch configs that leave it open (empty, "simulator" or "device"); an explicit target still wins. - add DeviceSelector and the reactNative.selectDevice command - make Android/iOS launchSimulator public; add Android cold boot flag - open DeviceHub (Xcode 27+) or Simulator.app after booting a simulator - remove DeviceStatusIndicator, replaced by the new status bar item
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A device selector modelled on the Flutter extension's (Dart-Code
device_manager.ts):Pixel_7_API_34 (android emulator),iPhone 17 (ios simulator),Pixel 8 (android), orNo Device. The tooltip shows how many devices are connected. Clicking it runs React Native: Select Device.Start <AVD>rows (each with a cold-boot variant) andStart <iOS simulator>rows.launchconfigs,targetis filled from the selected device when the config leaves it open: empty, orsimulator/devicewhen the device type matches. An explicittargetalways wins. A platform mismatch logs a one-line note and falls back to the existing behaviour.launch.jsonis never written.Changes
src/extension/deviceSelector.ts: pure helpers plus theDeviceSelectorclass (refresh, picker, launching,resolveDebugConfiguration).reactNative.selectDevicecommand andFailedToSelectDeviceerror code.AndroidTargetManager.launchSimulatorandIOSTargetManager.launchSimulatorare now public. Android takes acoldBootflag (-no-snapshot-load).DeviceStatusIndicator; the new status bar item replaces it.Refreshing
xctrace, about 2.5 s per call) refresh every 6th tick and when the picker opens.Testing
npm test: 496 passing, 0 failing.npx gulp lint: clean.Known limitations
targetintolaunch.jsonkeep using it. Delete that line to let the selector drive.emulatorfromPATH, as the existing "Launch Android Emulator" command does.