Skip to content

editor: Add line range support to editor::CopyFileLocation command#51328

Merged
SomeoneToIgnore merged 2 commits intozed-industries:mainfrom
shashank-suresh:CopyFileLocation-line-range-support
Mar 12, 2026
Merged

editor: Add line range support to editor::CopyFileLocation command#51328
SomeoneToIgnore merged 2 commits intozed-industries:mainfrom
shashank-suresh:CopyFileLocation-line-range-support

Conversation

@shashank-suresh
Copy link
Copy Markdown
Contributor

Closes #51309

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI 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.

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')
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 11, 2026
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 11, 2026
@SomeoneToIgnore SomeoneToIgnore self-assigned this Mar 12, 2026
Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) March 12, 2026 09:12
@SomeoneToIgnore SomeoneToIgnore merged commit 4d5e25f into zed-industries:main Mar 12, 2026
39 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support including full selected line range in output of editor::CopyFileLocation command

2 participants