editor: Add line range support to editor::CopyFileLocation command#51328
Merged
SomeoneToIgnore merged 2 commits intozed-industries:mainfrom Mar 12, 2026
Merged
Conversation
Previously, CopyFileLocation would always copy a single line number. This change extends it to copy a range when the user has a multi-line selection (e.g. 'src/main.rs:2-3'). Selections ending at column 0 of a line do not include that line in the range and would default to the single line number implementation (e.g. 'src/main.rs:2').
…ation Adds test coverage for the updated CopyFileLocation command, covering: - Single line selection (existing behaviour) - Multi-line selection returning a range (e.g. 'src/main.rs:2-3') - Selection ending a column 0 not including that line (e.g. 'src/main.rs:2')
SomeoneToIgnore
approved these changes
Mar 12, 2026
Contributor
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Nice, thank you!
tommyming
pushed a commit
to tommyming/zed
that referenced
this pull request
Mar 13, 2026
…ed-industries#51328) Closes zed-industries#51309 Before you mark this PR as ready for review, make sure that you have: - [X] Added a solid test coverage and/or screenshots from doing manual testing - [X] Done a self-review taking into account security and performance aspects - [X] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Improved `editor::CopyFileLocation` command to include the full selected line range (e.g. 'src/main.rs:12-18') when multiple lines are selected, rather than only the first line number.
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.
Closes #51309
Before you mark this PR as ready for review, make sure that you have:
Release Notes:
editor::CopyFileLocationcommand to include the full selected line range (e.g. 'src/main.rs:12-18') when multiple lines are selected, rather than only the first line number.