Skip to content

feat: add support for diff editor detection#297

Open
twangodev wants to merge 4 commits into
Azn9:developfrom
twangodev:develop
Open

feat: add support for diff editor detection#297
twangodev wants to merge 4 commits into
Azn9:developfrom
twangodev:develop

Conversation

@twangodev
Copy link
Copy Markdown

This PR adds support for viewing diffs by updating status to "Comparing filename" when viewing diffs

Original Behavior

The following would appear when the following was open:

image image

New Behavior

We employ a new technique for capturing filename when reading a diff.

image image

This also works with diffs generated by Claude Code, Junie through their native integrations.

image image image

Copilot AI review requested due to automatic review settings February 15, 2026 11:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for detecting diff editor views in JetBrains IDEs and updating the Discord Rich Presence status to show "Comparing filename" when viewing diffs. The feature enhances user status accuracy by distinguishing between regular file editing and diff comparison activities.

Changes:

  • Added isDiffEditor boolean field to the Data.File data class to track diff editor state
  • Implemented diff editor detection logic using class name pattern matching
  • Enhanced filename extraction for diff editors using EditorTabTitleProvider and regex pattern matching
  • Updated presence text logic to display "Comparing" prefix for diff editors

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
plugin/common/src/main/kotlin/dev/azn9/plugins/discord/data/Data.kt Added isDiffEditor field to Data.File class and updated toString method
plugin/common/src/main/kotlin/dev/azn9/plugins/discord/data/DataService.kt Core implementation: diff detection, filename extraction via EditorTabTitleProvider, and regex pattern for parsing filenames from tooltips
plugin/common/src/main/kotlin/dev/azn9/plugins/discord/settings/values/PresenceText.kt Updated prefix logic to prioritize "Comparing" for diff editors over "Editing"/"Reading"
plugin/common/src/main/kotlin/dev/azn9/plugins/discord/render/templates/CustomTemplate.kt Added IsDiffEditor template variable support for custom templates
plugin/common/src/main/kotlin/dev/azn9/plugins/discord/settings/gui/preview/PreviewRenderer.kt Added isDiffEditor default value in preview renderer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/common/src/main/kotlin/dev/azn9/plugins/discord/data/DataService.kt Outdated
Comment thread plugin/common/src/main/kotlin/dev/azn9/plugins/discord/data/DataService.kt Outdated
twangodev added 3 commits May 1, 2026 11:35
…lename

Previously, if the regex failed to match a filename in the tab tooltip,
the entire tooltip text was used as the displayed name, which could be
arbitrarily long.
The previous pattern \b[\w\-]+\.[\w.]+\b accepted strings like
"file..txt" because the trailing character class included the dot
itself. The new pattern requires each dot to be followed by at least
one word/hyphen character, while still supporting multi-extension
names like "file.tar.gz".
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