Skip to content

feat(input): select the next occurrence, or all of them, as more selections - #2

Merged
trancong12102 merged 1 commit into
mainfrom
feat/select-occurrences
Oct 1, 2026
Merged

trancong12102 merged 1 commit into
mainfrom
feat/select-occurrences

Conversation

@trancong12102

Copy link
Copy Markdown

Adds ⌘D-style occurrence selection to the multi-line inputs (code editor and textarea), built on the existing multi-cursor selections. No upstream PR covers it (checked longbridge/gpui-component's open PRs on 2026-10-01).

  • With only carets, the first press selects the word under the newest caret (or the word just before it when the caret sits at its end).
  • SelectNextOccurrence then adds the next occurrence of the newest selection's text as another selection, wrapping past the end and skipping text already selected, and scrolls to it.
  • SelectAllOccurrences adds every occurrence.
  • Neither has a default key binding; applications bind them (Slopty binds ⌘D and ⌘⇧L in its file editor).

Public API

gpui-base (re-exported from gpui-component's input):

  • actions::SelectNextOccurrence: select the word, then add the next occurrence as a selection.
  • actions::SelectAllOccurrences: select the word, then every occurrence.
  • pub use lsp_types; in gpui_base::input: the LSP types the providers speak, so a CompletionProvider implementer needs no lsp-types dependency pinned to the same version.

Tests: input::occurrences::tests (word first then wrap, all at once, a caret off any word). cargo clippy -p gpui-base fails on main already with too_many_arguments in dock_area.rs and text_wrapper.rs, untouched here.

Co-Authored-By: Claude Code

@trancong12102
trancong12102 force-pushed the feat/select-occurrences branch from ab0ee5e to f8e5e45 Compare October 1, 2026 15:45
…ctions

SelectNextOccurrence selects the word under a caret, then adds the next
occurrence of the selected text as another selection, wrapping past the
end; SelectAllOccurrences adds every one. Both are code-editor and
textarea actions with no default key, so an application binds them.
lsp_types is re-exported, so a provider names the types it speaks
without a dependency of its own to keep in step.

Co-Authored-By: Claude Code
@trancong12102
trancong12102 force-pushed the feat/select-occurrences branch from f8e5e45 to 66bedc3 Compare October 1, 2026 16:12
@trancong12102
trancong12102 merged commit 594b47d into main Oct 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant