Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ Please keep **1 PR to solve 1 problem**, and keep **Small improvements should be
| ---------------------------- | --------------------------- |
| [Put Before Screenshot here] | [Put After Screenshot here] |

## Break Changes
## Public API

List every public item this pull request adds, changes or removes, grouped by crate, with its signature and one line on what it is for. Include JavaScript methods and TypeScript declarations. If none, remove this section.

- `gpui_component::input::Example::builder(value: bool) -> Self` — what it does.

## Breaking Changes

Describe any breaking changes introduced by this pull request. If none, remove this section.

Expand Down
9 changes: 6 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,12 @@ Text input system based on Rope data structure:
- When creating a PR, inspect previous PR titles in the repository and match
that style. Do not blindly use conventional prefixes like `fix:` or `feat:`
unless the existing PR title style uses them.
- When a PR changes the public API of `crates/component`, add a `## Breaking Changes`
section with `diff` blocks showing the old and new usage. See PR #2691 and
`.claude/skills/gpui-component-dev/references/pr-description.md`.
- When a PR adds, changes or removes public API in any crate, list every item
under a `## Public API` section of the description, grouped by crate, with its
signature and one line on its purpose (JavaScript methods and TypeScript
declarations included). Changes to existing items also go under
`## Breaking Changes` with `diff` blocks showing the old and new usage. See
PR #2691 and the "Describe public API changes" section of `CONTRIBUTING.md`.
- Avoid `Kind` as a type-name suffix. It says an enum classifies something
without saying what it classifies, and carries no meaning a reader could not
already infer from `enum`. Name the type after what its variants _are_
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ Before opening a pull request, please make sure that:
When using AI, ask it to avoid unrelated refactors, cleanup, or formatting.
**Less is better.**

### Describe public API changes

A pull request that adds, changes or removes anything public — a type, a
function, a builder method, an action, a re-export, a JavaScript method or a
TypeScript declaration — lists it in the description under a `## Public API`
section, grouped by crate, with the signature as a reviewer would read it in
the docs. Say what each item is for in one line; a name alone is not enough.
The reviewer should be able to judge the API from the description without
reading the diff.

Changes to existing public items go under `## Breaking Changes` with a `diff`
block showing the old and the new usage, even when the old form still
compiles. Additive changes are not breaking, but they are still listed.

Well-prepared pull requests are easier for us to review and may be merged very
quickly. If a contribution is already in good shape, maintainers may directly
help polish small details and move it forward.
Expand Down
3 changes: 3 additions & 0 deletions crates/base/src/input/base/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::input::Selection;
/// immediately before the replacement was applied.
#[derive(Debug, PartialEq, Clone)]
pub(super) struct Change {
pub(super) token_delta: Option<Box<super::inline_tokens::TokenDelta>>,
pub(crate) old_range: Selection,
pub(crate) old_text: String,
pub(crate) new_range: Selection,
Expand All @@ -20,6 +21,7 @@ impl Change {
new_text: &str,
) -> Self {
Self {
token_delta: None,
old_range: old_range.into(),
old_text: old_text.to_string(),
new_range: new_range.into(),
Expand All @@ -32,6 +34,7 @@ impl Change {
pub(super) fn shifted(&self, delta: isize) -> Self {
let shift = |offset: usize| (offset as isize + delta).max(0) as usize;
Self {
token_delta: self.token_delta.clone(),
old_range: (shift(self.old_range.start)..shift(self.old_range.end)).into(),
old_text: self.old_text.clone(),
new_range: (shift(self.new_range.start)..shift(self.new_range.end)).into(),
Expand Down
Loading
Loading