Skip to content

feat(permission_window): render description/command from part updates#257

Merged
sudo-tee merged 9 commits intosudo-tee:mainfrom
disrupted:permission-description
Feb 10, 2026
Merged

feat(permission_window): render description/command from part updates#257
sudo-tee merged 9 commits intosudo-tee:mainfrom
disrupted:permission-description

Conversation

@disrupted
Copy link
Contributor

close #241

@disrupted disrupted marked this pull request as ready for review February 9, 2026 22:36
@disrupted disrupted force-pushed the permission-description branch 2 times, most recently from 9d81466 to 90b2bcb Compare February 10, 2026 08:15
Update permission window rendering to prefer message.part.updated description and command, wire renderer correlation for part-to-permission updates, and add regression coverage including replay expectations and collapsing-order handling.
@disrupted disrupted force-pushed the permission-description branch from 90b2bcb to de38869 Compare February 10, 2026 08:23
Copy link
Owner

@sudo-tee sudo-tee left a comment

Choose a reason for hiding this comment

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

I think we should improve the spacing in the window, currently in this MR it looks lile so
image

With the two remarks I added the permission window would look like this instead

Image

This is the code I used to get this window

  local content = {}
  if permission._description and permission._description ~= '' then
    table.insert(content, (icons.get(perm_type) or '') .. ' *' .. (perm_type or '') .. '* ' .. permission._description)
  elseif permission.title then
    table.insert(content, (icons.get(perm_type) or '') .. ' *' .. (perm_type or '') .. '* `' .. permission.title .. '`')
  else
    table.insert(content, (icons.get(perm_type) or '') .. ' *' .. (perm_type or '') .. '*')
    local lines = vim.split(permission.patterns or {}, '\n')
    table.insert(content, '```')
    for i, line in ipairs(lines) do
      table.insert(content, line)
    end
    table.insert(content, '```')
  end

  table.insert(content, '')

  if permission._command and permission._command ~= '' then
    local lines = vim.split(permission._command, '\n')
    table.insert(content, '```')
    for i, line in ipairs(lines) do
      table.insert(content, line)
    end
    table.insert(content, '```')
  end

local patterns = table.concat(permission.patterns or {}, '`, `'):gsub('\r', '\\r'):gsub('\n', '\\n')
display_text = (icons.get(perm_type) or '') .. ' *' .. (perm_type or '') .. '* `' .. (patterns ~= '' and patterns or 'Unknown Permission') .. '`'
end

Copy link
Owner

Choose a reason for hiding this comment

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

We should add an empty line after the title/description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be there now since I applied your suggestion

@disrupted
Copy link
Contributor Author

disrupted commented Feb 10, 2026

great idea! I applied your suggestion and cleaned it up a little (removed or '' fallbacks in places where they are unnecessary). I also added the permission filetype (such as bash) to the Markdown codefence so we get proper Treesitter highlighting

permission_prompt_ts_highlight

@disrupted
Copy link
Contributor Author

disrupted commented Feb 10, 2026

I was hoping to see a proper diff for the replay snapshots since a lot of them have changed. this would depend on #259 though. it also seems like the JSON keys are not ordered consistently. when I diff locally it shows a lot more changes than I would've expected 🤔

edit: sorted. configured vim.json.encode to format and sort keys. once we set #259 as the base branch the diff should be much more clear

@sudo-tee
Copy link
Owner

sudo-tee commented Feb 10, 2026

I was hoping to see a proper diff for the replay snapshots since a lot of them have changed. this would depend on #259 though. it also seems like the JSON keys are not ordered consistently. when I diff locally it shows a lot more changes than I would've expected 🤔

edit: sorted. configured vim.json.encode to format and sort keys. once we set #259 as the base branch the diff should be much more clear

Great I will have a look ar #259

Should be straightforward to merge

Edit: merged

@sudo-tee
Copy link
Owner

It is indeed way better to see diffs this way,

Thanks for all your efforts in helping me on this plugin

@sudo-tee sudo-tee merged commit 954123c into sudo-tee:main Feb 10, 2026
5 checks passed
@disrupted disrupted deleted the permission-description branch February 10, 2026 20:07
@disrupted
Copy link
Contributor Author

🤝 likewise man, happy to support this project. It really is a fantastic plugin!

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.

permission request parity with opencode TUI

2 participants