Skip to content

feat: add +/- notation option to Diff operation#2343

Open
Sushanth012 wants to merge 1 commit intogchq:masterfrom
Sushanth012:feat/diff-plus-minus-notation
Open

feat: add +/- notation option to Diff operation#2343
Sushanth012 wants to merge 1 commit intogchq:masterfrom
Sushanth012:feat/diff-plus-minus-notation

Conversation

@Sushanth012
Copy link
Copy Markdown

Closes #2312

Added a "Show +/- notation" boolean option to the Diff operation (default: false).

When enabled:

  • Added lines are prefixed with "+ "
  • Removed lines are prefixed with "- "
  • Unchanged lines are prefixed with " " (two spaces)

Output is compatible with standard unified diff format, allowing export to tools like Slack's diff snippet viewer. Existing highlighting behavior is unchanged when the option is off.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 28, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@C85297 C85297 left a comment

Choose a reason for hiding this comment

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

Hi @Sushanth012 , thank you for the pull request!

I am worried the changes might not have the effect you desire in certain conditions - such as if diffChars is selected. Your code assumes that the returned value from jsdiff is split by lines, but I don't believe this to always be the case.

Could you confirm if you've tested this locally, and ideally provide screenshots so we can review the UI behaviour?
And could you also add a test case (unfortunately there isn't an existing one for Diff, but you could copy one of the tests in tests/operations/tests and implement a test just for this +/- functionality)

@C85297
Copy link
Copy Markdown
Member

C85297 commented Apr 28, 2026

@Sushanth012 jsdiff does seem to support a patch mode, might that solve your problem?

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.

Feature request: diff recipe should include + and - in the textual output

3 participants