Skip to content

Conversation

@mernen
Copy link
Member

@mernen mernen commented Dec 1, 2025

Allows one to type shell lines like jj log ~cli/ex⇥. Workspace-relative patterns (root*:) are also handled, so they can be completed from any subdirectory (e.g. jj diff root:lib/⇥).

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes

@mernen mernen requested a review from a team as a code owner December 1, 2025 04:18
@mernen mernen force-pushed the fileset-completion branch from 07538c9 to 14e19bd Compare December 1, 2025 04:27
let name = current[token_pos + token.len()..].trim_ascii_start();
current.split_at(current.len() - name.len())
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the idea is quite similar to split_revset_trailing_name(). Can we reuse this function? Is the revset pattern too strict?

Copy link
Member Author

Choose a reason for hiding this comment

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

The goal of the two is the same, but the operators are slightly different, with .. on one side and workspace-relative patterns on the other. Only part that is immediately clear to me how to share would be the "first half" ((token_pos, token) matching), but I'm not sure it'd be worth it.

(Apart from that, the fileset splitter tries to support quoted names, as I expect them to be much more common with files than with bookmarks, but this would be welcome in the revset one if they can be reasonably merged)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, true. We could parameterize the operators/tokens list as [&str] (instead of [char]), but it wouldn't help much.

Maybe we can at least keep these functions look similar (by adding split_fileset_trailing_path() or PartialRevset type)? If these functions get bigger, we might want to extract common helper functions.

if(status == 'renamed', 'renamed.source ' ++ source.path().display() ++ "\n"),
)
"#}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it seems now better to resolve relative paths by completion functions. Can you take a look at the previous attempt?

#7770 (comment)

I think we can then reuse FilePattern::from_str_kind() to get workspace-relative path prefix.

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.

2 participants