Skip to content

editor: Extract completions and code_actions out of editor.rs - #56030

Merged
SomeoneToIgnore merged 9 commits into
zed-industries:mainfrom
GoldStrikeArch:feat/extract-completions-and-codeactions-out-of-editor
May 7, 2026
Merged

editor: Extract completions and code_actions out of editor.rs#56030
SomeoneToIgnore merged 9 commits into
zed-industries:mainfrom
GoldStrikeArch:feat/extract-completions-and-codeactions-out-of-editor

Conversation

@GoldStrikeArch

@GoldStrikeArch GoldStrikeArch commented May 7, 2026

Copy link
Copy Markdown
Contributor

cc @SomeoneToIgnore

Summary

Follow-up to #55352, where the conclusion was to split editor.rs incrementally by topic instead of all at once.

This mechanically extracts two editor topics into focused sibling modules:

  • crates/editor/src/code_actions.rs
  • crates/editor/src/completions.rs

One odd boundary remains: Editor::context_menu() is still a general context-menu accessor, but it now lives in code_actions.rs because it was part of the moved code actions block and is also used by completions, Vim tests, agent UI, and the quick action bar. Would you prefer that generic context-menu accessor stay in editor.rs for now until context-menu code gets its own extraction?

Testing

  • cargo check -p editor --lib
  • cargo check -p editor --tests
  • cargo check -p editor --lib --features test-support

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • N/A

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 7, 2026
@GoldStrikeArch
GoldStrikeArch marked this pull request as draft May 7, 2026 09:52
@GoldStrikeArch GoldStrikeArch changed the title feat: mechanical extraction of completions and code_actions editor: Extract completions and code_actions out of editor.rs May 7, 2026
@GoldStrikeArch
GoldStrikeArch marked this pull request as ready for review May 7, 2026 10:17
Comment thread crates/editor/src/code_actions.rs Outdated
Comment thread crates/editor/src/completions.rs Outdated

@SomeoneToIgnore SomeoneToIgnore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

impl Editor are not grouped still; fn and pub(super) fn and maybe others seem to be mixed, not ordered.

@GoldStrikeArch

Copy link
Copy Markdown
Contributor Author

@SomeoneToIgnore

impl Editor are not grouped still;

I see. I misunderstood your point, now with the latest changes this:

#[cfg(any(test, feature = "test-support"))]
impl Editor {
// ...
}

Is next to the "main"impl Editor in completions.rs. Is this what you were referring to?

fn and pub(super) fn and maybe others seem to be mixed, not ordered

Right now both "main" impl Editor in code_actions.rs and completions.rs are ordered like this:

  • pub fn
  • fn
  • pub(super) fn

I tried to use the same pattern as in config.rs which we did yesterday. Do you want some other order?

@SomeoneToIgnore

Copy link
Copy Markdown
Contributor

fn is more private than its surroundings in this case, so the sequence seems odd.
I'd put fn last.

@GoldStrikeArch

Copy link
Copy Markdown
Contributor Author

@SomeoneToIgnore

fn is more private than its surroundings in this case, so the sequence seems odd.
I'd put fn last.

Agreed. I moved the fn to the bottom

@GoldStrikeArch
GoldStrikeArch force-pushed the feat/extract-completions-and-codeactions-out-of-editor branch from 670cc12 to 7dd78d7 Compare May 7, 2026 12:44

@SomeoneToIgnore SomeoneToIgnore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you.

@SomeoneToIgnore
SomeoneToIgnore enabled auto-merge May 7, 2026 12:51
@SomeoneToIgnore
SomeoneToIgnore added this pull request to the merge queue May 7, 2026
Merged via the queue into zed-industries:main with commit bd2fb74 May 7, 2026
31 checks passed
pull Bot pushed a commit to jasonkneen/zed that referenced this pull request May 7, 2026
…ries#56070)

cc @SomeoneToIgnore

## Summary

Follow-up to zed-industries#56030 

This mechanically extracts two editor topics into focused sibling
modules:

- `crates/editor/src/fold.rs`
- `crates/editor/src/selection.rs`

One odd boundary remains: several selection state types still live in
`editor.rs`. I didn't move them because those caused that "huge 11k
diff" in the previous PR, so I propose to move them later.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
@GoldStrikeArch
GoldStrikeArch deleted the feat/extract-completions-and-codeactions-out-of-editor branch May 7, 2026 18:26
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…ed-industries#56030)

cc @SomeoneToIgnore

## Summary

Follow-up to zed-industries#55352,
where the conclusion was to split `editor.rs` incrementally by topic
instead of all at once.

This mechanically extracts two editor topics into focused sibling
modules:

- `crates/editor/src/code_actions.rs`
- `crates/editor/src/completions.rs`

One odd boundary remains: `Editor::context_menu()` is still a general
context-menu accessor, but it now lives in `code_actions.rs` because it
was part of the moved code actions block and is also used by
completions, Vim tests, agent UI, and the quick action bar. Would you
prefer that generic context-menu accessor stay in `editor.rs` for now
until context-menu code gets its own extraction?

## Testing

- `cargo check -p editor --lib`
- `cargo check -p editor --tests`
- `cargo check -p editor --lib --features test-support`

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…ries#56070)

cc @SomeoneToIgnore

## Summary

Follow-up to zed-industries#56030 

This mechanically extracts two editor topics into focused sibling
modules:

- `crates/editor/src/fold.rs`
- `crates/editor/src/selection.rs`

One odd boundary remains: several selection state types still live in
`editor.rs`. I didn't move them because those caused that "huge 11k
diff" in the previous PR, so I propose to move them later.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ed-industries#56030)

cc @SomeoneToIgnore

## Summary

Follow-up to zed-industries#55352,
where the conclusion was to split `editor.rs` incrementally by topic
instead of all at once.

This mechanically extracts two editor topics into focused sibling
modules:

- `crates/editor/src/code_actions.rs`
- `crates/editor/src/completions.rs`

One odd boundary remains: `Editor::context_menu()` is still a general
context-menu accessor, but it now lives in `code_actions.rs` because it
was part of the moved code actions block and is also used by
completions, Vim tests, agent UI, and the quick action bar. Would you
prefer that generic context-menu accessor stay in `editor.rs` for now
until context-menu code gets its own extraction?

## Testing

- `cargo check -p editor --lib`
- `cargo check -p editor --tests`
- `cargo check -p editor --lib --features test-support`

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…ries#56070)

cc @SomeoneToIgnore

## Summary

Follow-up to zed-industries#56030 

This mechanically extracts two editor topics into focused sibling
modules:

- `crates/editor/src/fold.rs`
- `crates/editor/src/selection.rs`

One odd boundary remains: several selection state types still live in
`editor.rs`. I didn't move them because those caused that "huge 11k
diff" in the previous PR, so I propose to move them later.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants