Skip to content

Add jj item - #592

Open
ETCaton wants to merge 1 commit into
IlanCosman:mainfrom
ETCaton:jj-item
Open

Add jj item#592
ETCaton wants to merge 1 commit into
IlanCosman:mainfrom
ETCaton:jj-item

Conversation

@ETCaton

@ETCaton ETCaton commented Aug 3, 2025

Copy link
Copy Markdown

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.

@fowles

fowles commented Nov 5, 2025

Copy link
Copy Markdown
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

fowles commented Nov 5, 2025

Copy link
Copy Markdown

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

@ETCaton

ETCaton commented Nov 5, 2025

Copy link
Copy Markdown
Author

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

fowles commented Nov 5, 2025

Copy link
Copy Markdown

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

fowles commented Nov 6, 2025

Copy link
Copy Markdown

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 thread functions/_tide_item_jj.fish Outdated
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(" "),

@fowles fowles Nov 10, 2025

Copy link
Copy Markdown

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(" "),

@plttn plttn mentioned this pull request Jan 27, 2026
4 tasks
@ETCaton

ETCaton commented Jul 30, 2026

Copy link
Copy Markdown
Author

I hadn't forgotten about this but I was trying to get things working with the pill without compromising the colors off and on, and I think it's just too much of a headache.

This is a best effort at working with all the configs, but I'm personally going to take my original one on my machine and just patch on top of wherever tide goes; if someone wants to update this or change it I would just fork my change and open a new PR. If this gets merged it can always be updated as well, obviously

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