Repository navigation
web: release code -w -g file:line once the file's editor closes - #344740
Merged
Connor Peet (connor4312) merged 6 commits intoOct 28, 2026
Merged
Connor Peet (connor4312) merged 6 commits into
Connor Peet (connor4312) merged 6 commits into
Conversation
In the browser host, `--goto` paths are opened with the `:line:col` suffix stripped, but the `--wait` list kept the raw path, so `whenEditorClosed` never matched the closed editor and the CLI hung (`code serve-web`). Strip the suffix the same way for the wait list. Fixes microsoft#342514
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
One or more reviewer sessions failed, leaving the review evidence incomplete.
No open issues 🎉
What changed in this PR
Fixes #342514 by making the web workbench’s code -w -g file:line wait for the actual opened resource, allowing the command to exit when its editor closes.
Changes:
- Strips line and column suffixes from wait-list resources in goto mode, preserving existing merge and diff behavior.
- Adds a regression test verifying the editor selection and wait-marker deletion after closure.
| File | Description |
|---|---|
src/vs/workbench/services/host/test/browser/browserHostService.test.ts |
Tests goto-mode opening and wait-marker cleanup. |
src/vs/workbench/services/host/browser/browserHostService.ts |
Normalizes goto-mode resources before waiting for editor closure. |
Review effort: Balanced
Only skip stripping `:line:col` when the diff branch actually ran (`diffMode` with exactly two files), so a diff request that falls back to the normal open still waits on the stripped resources. Collapse the mapping to a single expression and drop test stubs that `workbenchInstantiationService` overrides already provide.
Akshat Anand (cipheraxat)
marked this pull request as ready for review
October 28, 2026 14:37
Connor Peet (connor4312)
approved these changes
Oct 28, 2026
Connor Peet (connor4312)
enabled auto-merge (squash)
October 28, 2026 17:12
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 28, 2026
Martin Aeschlimann (aeschli)
approved these changes
Oct 28, 2026
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.
Fixes #342514
In the web workbench (
code serve-web),code -w -g README.md:1opens the file at the right line, but the command never exits after the tab is closed. Plaincode -w README.mdworks.BrowserHostService.openWindowstrips the:line:colsuffix withparseLineAndColumnAwareonly for the editor it opens. The--waitlist was built from the raw file openables, sowhenEditorClosedwaited onREADME.md:1, which never matches theREADME.mdeditor that gets closed.The wait list now strips line and column the same way when
gotoLineModeis set, so it waits on the same resource that was opened. Merge mode and plain-ware unchanged. Diff mode is skipped on purpose, because the diff branch opens the raw URIs, so its wait list has to keep them. Desktop isn't affected because electron-main resolves the paths before it waits.Added
src/vs/workbench/services/host/test/browser/browserHostService.test.ts. It opens/workspace/README.md:3:5withgotoLineModeand a wait marker, closes theREADME.mdeditor, and asserts that the marker file is deleted.README.md, selection 3:5README.md, selection 3:5deleted: [])Validation:
./scripts/test.sh --run src/vs/workbench/services/host/test/browser/browserHostService.test.ts: fails onmain, passes with the fix./scripts/test.sh --run src/vs/workbench/test/browser/parts/editor/editor.test.ts --run src/vs/base/test/common/extpath.test.ts: 30 passingnpm run eslinton both files, andtsc -p src/tsconfig.json --noEmit: cleanNot covered: I did not run a live
code serve-websession. The fix is checked by the unit test above, which drivesBrowserHostService.openWindowdirectly.