feat(code-diff): scope search to removed | added | changed lines#4061
feat(code-diff): scope search to removed | added | changed lines#4061john-traas wants to merge 12 commits intomainfrom
Conversation
|
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4061/ |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR extends limel-code-diff’s in-diff search from being limited to removed lines to a user-selectable scope (removed, added, or changed), with a compact scope picker embedded in the search bar. It also adjusts default behavior and visibility so search is available whenever there is any diff.
Changes:
- Added
SearchScopeplus pure helperspickDefaultScopeandlineMatchesScope(with unit tests) to support scoped searching. - Updated
limel-code-diffto tracksearchScope, render a<limel-button-group>scope picker, and apply highlighting/counting only to lines within the active scope. - Updated all locales to generalize the search label and add new scope-related translation keys.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/code-diff/code-diff.tsx | Adds scoped search state, scope picker UI, and applies scope filtering during render/highlighting. |
| src/components/code-diff/search-utils.ts | Introduces SearchScope and pure helpers for default-scope selection and scope matching. |
| src/components/code-diff/search-utils.spec.ts | Adds unit coverage for the new scope helper functions. |
| src/components/code-diff/code-diff.scss | Ensures the new scope picker doesn’t shrink in the search bar layout. |
| src/translations/en.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/da.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/de.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/fi.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/fr.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/nl.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/no.ts | Updates search label and adds new search-scope translation keys. |
| src/translations/sv.ts | Updates search label and adds new search-scope translation keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Extends the in-diff search of
limel-code-difffrom "removed lines only" to a user-selectable scope:removed(default),added, orchanged. The picker is an inline icon-only<limel-button-group>placed before the search input.removedif there are deletions, otherwiseadded(auto-fallback).Implementation
search-utils.ts:pickDefaultScopeandlineMatchesScope(full unit-test coverage).code-diff.tsxgains asearchScope@State()field;renderContentconsultslineMatchesScope; the toggle visibility predicate is widened.<limel-button-group>rendered as the first child of the search bar; emitschangetoonScopeChangewhich narrows the id without an unchecked cast.en,da,de,fi,fr,nl,no,sv) — oldcode-diff.searchvalue generalized, plus four new keys for the scope-picker labels.Test plan
compare_arrowsicon resolves visibly. (Fallbacks:swap_vert,sync_alt.)minus/plus_mathrender sensibly for "Removed" / "Added".Esccloses the panel and reopening returns to the smart default.Notes
@Prop/@Event; component remains@beta.search-bar__scopeandsearch-bar__inputare decorative — styling is by tag selector. Pre-existing for__input, mirrored for__scope. Could be cleaned up in a follow-up if full BEM discipline is wanted.