Skip to content

Feature/device selector - #3007

Closed
Matteo Boetti (teoboetti) wants to merge 20 commits into
microsoft:masterfrom
teoboetti:feature/device-selector
Closed

Matteo Boetti (teoboetti) wants to merge 20 commits into
microsoft:masterfrom
teoboetti:feature/device-selector

Conversation

@teoboetti

Copy link
Copy Markdown

No description provided.

A launch installs and starts the app, which finishes evaluating its bundle
well before the CDP proxy manages to attach. Hermes replays scriptParsed on
Debugger.enable, so breakpoints registered for that first run resolve and
look bound, but the code they belong to has already executed and they are
never reached. Reloading by hand makes them work, which is what users hit
today.

Hermes has no pause-on-load to wait for: it answers
Runtime.runIfWaitingForDebugger with "Unsupported method" (-32601), so the
only lever is to run the bundle again once the debugger is ready. Send a
single Page.reload after the debugger goes quiet following its initial
breakpoint requests. Reloads are driven by the device (the nativePageReloads
capability), so the debugger stays attached and the breakpoints re-bind.

The request is sent out of band with an id the debugger never issued, so it
discards the reply as an unknown response id.
* Wait for the debug adapter server to bind before reading its port

Net.Server.listen() is asynchronous, so address() could still return null
when DebugAdapterServer was constructed, producing a debug session pointed
at an invalid port. Resolve the descriptor from the listen callback instead,
and surface bind failures through reject.

* Set the expected Origin header when connecting to the Metro inspector

React Native's @react-native/dev-middleware validates the Origin header on
/inspector/debug WebSocket upgrades and closes connections whose origin is
neither the dev server nor a loopback host. The proxy connected without one,
so Metro answered 401 and logged:

  Connection from DevTools failed to be established for origin 'undefined'

Build the application transport explicitly so the Origin header derived from
the inspector URL is sent, and update the CDP proxy test for the new
transport creation path.

* Reload the application once so first-run breakpoints are hit

A launch installs and starts the app, which finishes evaluating its bundle
well before the CDP proxy manages to attach. Hermes replays scriptParsed on
Debugger.enable, so breakpoints registered for that first run resolve and
look bound, but the code they belong to has already executed and they are
never reached. Reloading by hand makes them work, which is what users hit
today.

Hermes has no pause-on-load to wait for: it answers
Runtime.runIfWaitingForDebugger with "Unsupported method" (-32601), so the
only lever is to run the bundle again once the debugger is ready. Send a
single Page.reload after the debugger goes quiet following its initial
breakpoint requests. Reloads are driven by the device (the nativePageReloads
capability), so the debugger stays attached and the breakpoints re-bind.

The request is sent out of band with an id the debugger never issued, so it
discards the reply as an unknown response id.

* Resolve packages from the public npm registry

The lockfile pinned 220 tarballs to internal Azure Artifacts feeds and to
registry.npmmirror.com. npm refuses those as "remote" type packages
(EALLOWREMOTE), so npm install fails outside Microsoft's network. Both hosts
mirror the public registry at the same paths, so the integrity hashes are
unchanged.

Drop this commit before opening a pull request upstream.

* Bump version to 1.14.2 for local builds

Keeps the sideloaded build ahead of the published 1.14.1 so the marketplace
does not replace it on auto-update.

Drop this commit before opening a pull request upstream.

* Add a VSIX build workflow and an install-local script

Packages the extension on a v* tag and attaches the VSIX to that release, so
it can be installed on a machine without the build toolchain. Also runnable
on demand via workflow_dispatch, which just uploads the artifact.

npm run install-local packages and installs into Codium in one step for the
local edit loop.

Drop this commit before opening a pull request upstream.
* Mark local builds as patched and date-stamp their version

The extension keeps upstream's msjsdiag.vscode-react-native id, so a patched
local build was indistinguishable from the published one in the extensions
list. Rename the display name, and put the build date in the patch version.

1.14.<YYYYMMDD> keeps the upstream base visible, always sorts above a real
1.14.x, and rises on every build without being managed by hand. An upstream
1.15.0 would sort above it, which is the point at which this fork wants
rebasing anyway.

npm run install-local now stamps the date before packaging, so every local
install carries the day it was built. It writes package.json and the
lockfile, so expect a dirty tree after a local build.

Drop this commit before opening a pull request upstream.

* Document installing the extension in VSCodium

VSCodium resolves extensions from Open VSX, which does not carry this fork,
so the packaged VSIX has to be installed directly. Cover both routes: the
VSIX attached to a release by CI, and a local build via npm run install-local.

Also record how a local build is told apart from the published extension,
and that auto update has to be disabled because the fork keeps upstream's
extension identifier.

Drop this commit before opening a pull request upstream.
Brings in the EAS config error handling, symlink-safe cleanup and the
ip-address/fast-uri security bumps from microsoft/vscode-react-native.

Only package.json and package-lock.json overlapped with the fork: the
patched displayName, the dated version and install-local survive, and the
lockfile is regenerated so it differs from upstream by the version alone.
The Hermes CDP and session-manager fixes are untouched.
…stop (#4)

* fix(build): keep nls metadata keys relative under gulp 5

gulp 5 stores the literal "." passed as `base` on the vinyl file instead of
resolving it, so vscode-nls-dev could not strip the project root from the
module path and wrote absolute paths as keys in nls.metadata.json. At runtime
vscode-nls looks modules up by their path relative to dist/, found nothing and
rendered every localized string as "Messages not found.".

Pass the absolute appRoot as base so the keys come out as src/... again.

* fix(android): surface the run-android error when the device drops offline

When `react-native run-android` failed and the device had gone offline in the
meantime, the target lookup in the finally block threw error 1209 and replaced
the original failure, so the debug console only said "There is no any Android
debuggable online target" while the real cause (for example Gradle's
"device offline") was buried in the Run android output channel.

Keep the run-android error when at least one device was online at the start
of the run, and drop the redundant second lookup in the catch block that could
only re-throw the same 1209. When nothing was online from the start 1209 is
still reported.

Also replace the nested ternary in getTargetIdForRunApp with plain conditions
and `includes`, which clears the two ESLint warnings in the file.

* feat(debugger): stop the packager when the debug session is stopped

Pressing Stop in the debug toolbar left Metro running. On a disconnect with
terminateDebuggee set and no restart flag, stop the packager the extension
spawned. Restart and plain Disconnect keep it alive, and a packager started
outside the editor is never touched.
* chore(lint): clear all eslint warnings

Fix the 128 code warnings reported by gulp lint with minimal,
behaviour-preserving edits: strict equality, no parameter reassignment,
explicit return types on exported functions, flattened promise chains,
and reduce/for-index/nested-ternary rewrites. Loops that are retry,
polling, or order-dependent keep their sequential await behind a
no-await-in-loop disable with a reason.

Add the 28 existing file names that fail unicorn/filename-case to the
rule's ignore list rather than renaming them.

* ci: add GitHub Actions CI, bump actions to v7, enable Dependabot

Add a CI workflow that runs lint, build, unit tests and localization
tests on pushes to master and on pull requests. Bump checkout,
setup-node and upload-artifact to v7 in both workflows and let
Dependabot keep GitHub Actions up to date weekly.

* ci: bundle the extension before running tests

The test suites activate the extension through its dist/rn-extension
entry point, which only the webpack production build produces. Run
gulp prod-build before the dev build, matching upstream's validation
pipeline.
…tive into upstream-sync

# Conflicts:
#	package-lock.json
#	package.json
…tive into upstream-sync

# Conflicts:
#	src/cdp-proxy/reactNativeCDPProxy.ts
#	src/extension/reactNativeSessionManager.ts
…tive into upstream-sync

# Conflicts:
#	src/cdp-proxy/CDPMessageHandlers/hermesCDPMessageHandler.ts
#	src/cdp-proxy/CDPMessageHandlers/iOSDirectCDPMessageHandler.ts
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
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Matteo Boetti (@teoboetti) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

@teoboetti
Matteo Boetti (teoboetti) deleted the feature/device-selector branch October 19, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant