Change Open MR In Web IDE route to use query params

Context

@himkp commented

I wonder if we can think about passing the file path in the URL itself so that when clicking “Edit in Web IDE” from the MR diff, we actually open and focus on the file there as well.

You had suggested on Slack that our /merge_requests/:id route really should be a query parameter: .../-/path/to/file.md?from_mr=123&source_project=. I searched for issues and there isn't any for allowing "Edit in Web IDE" button to open the actual file in the IDE. Do you mind opening a follow up issue for this? Thanks!

This also causes issues when trying to open the Web IDE on a specific file from a MR.

Investigation notes

  • This is where the route is defined https://gitlab.com/gitlab-org/gitlab/blob/93d77316b5d03f06fd6e38f7dceb577b2df9977b/app/assets/javascripts/ide/ide_router.js#L64
  • I imagine we want to change how we're finding the mergeRequestId to look for the query params and also change the order of the conditional.

One approach, and possible the easiest implementation, would be to simply update openMergeRequest to accept a filePath parameter. This way we wouldn't have to touch openBranch at all.

Questions:

  • What about preexisting references to the old merge request route? Are we wanting to support those and redirect?
Edited Jan 05, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading