Skip to content

Conversation

@ETCaton
Copy link

@ETCaton ETCaton commented Aug 3, 2025

Description

Adds an item for jj based on their fish and Starship prompts.

Screenshots (if appropriate)

cda4b1b1a10c3343c1b554b4a0052fb297837163324b6f5eb63653ec139fc36a

How Has This Been Tested

  • I have tested using Linux.
  • I have tested using MacOS.

Checklist

  • I am ready to update the wiki accordingly.
  • I have updated the tests accordingly.

@ETCaton ETCaton requested a review from IlanCosman as a code owner August 3, 2025 19:32
@fowles
Copy link

fowles commented Nov 5, 2025

image

I think something is going wrong with the coloration for this. I tried adding it in and it seems to not obey the pill forms in some weird way

@fowles
Copy link

fowles commented Nov 5, 2025

It would also be nice if this handled co-located jj repos better instead of having both the jj and the git items

@ETCaton
Copy link
Author

ETCaton commented Nov 5, 2025

I haven't used pills so I haven't seen this, but will take a look at that and identifying colocation in ~1 week or so. The secondary ID (commit hash) would be sufficient for Git operations and colocation's an explicit-enough interaction I think it would make sense to exclude Git in that case 👍

@fowles
Copy link

fowles commented Nov 5, 2025

from my debugging it has something to do with needing

SETUVAR tide_jj_bg_color:000000
SETUVAR tide_jj_color:E4E4E4
SETUVAR tide_jj_icon:\x1d

in fish_variables (to get any pills at all to work).

But then the colors you get from change_id.shortest(8) with log --color=always causes it to blow away the in progress colors

@fowles
Copy link

fowles commented Nov 6, 2025

What I ended up using is:

function _tide_item_jj
    if not command -sq jj; or not jj root --quiet &>/dev/null
        return 1
    end

    set change_id (jj log --no-graph --color=never \
        -r '@' -T 'change_id.shortest(8)')

    string match -qr '(?<changes>#*)(?<bookmark>\w+)' \
      (jj log --no-graph --color=never \
          -r 'heads(::@ & bookmarks())::@' -T '"#" ++ self.bookmarks()')
    set ahead (math (string length $changes) - 1)

    set jj_status (jj log -r@ -n1 --no-graph --color=never -T '
    separate(" ",
        bookmarks.map(|x| truncate_end(10, x.name(), "…")).join(" "),
        tags.map(|x| truncate_end(10, x.name(), "…")).join(" "),
        diff.stat().total_added() ++ "+",
        diff.stat().total_removed() ++ "-",
        if(conflict, "conflict"),
        if(divergent, "divergent"),
        if(hidden, "hidden"),
    )' | string trim)
    _tide_print_item jj "$change_id $ahead⇡$bookmark $jj_status"
end

Comment on lines +8 to +17
bookmarks.map(|x| if(
x.name().substr(0, 10).starts_with(x.name()),
x.name().substr(0, 10),
x.name().substr(0, 9) ++ "…")
).join(" "),
tags.map(|x| if(
x.name().substr(0, 10).starts_with(x.name()),
x.name().substr(0, 10),
x.name().substr(0, 9) ++ "…")
).join(" "),
Copy link

@fowles fowles Nov 10, 2025

Choose a reason for hiding this comment

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

Suggested change
bookmarks.map(|x| if(
x.name().substr(0, 10).starts_with(x.name()),
x.name().substr(0, 10),
x.name().substr(0, 9) ++ "")
).join(" "),
tags.map(|x| if(
x.name().substr(0, 10).starts_with(x.name()),
x.name().substr(0, 10),
x.name().substr(0, 9) ++ "")
).join(" "),
bookmarks.map(|x| truncate_end(10, x.name(), "")).join(" "),
tags.map(|x| truncate_end(10, x.name(), "")).join(" "),

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