-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(auto-edit): Support unified diff and refactor diff format #7000
Conversation
bbe228c
to
6082a72
Compare
6082a72
to
84951e4
Compare
9339e00
to
663cab5
Compare
663cab5
to
247f27b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Tested it locally and added a couple of minor suggestions inline.
vscode/src/autoedits/renderer/image-gen/highlight/highlight-decorations.ts
Show resolved
Hide resolved
vscode/src/autoedits/renderer/image-gen/decorated-diff/types.ts
Outdated
Show resolved
Hide resolved
// TODO: Log these errors, useful to see if we run into issues where we're not correctly | ||
// initializing the canvas | ||
throw new Error('Canvas not initialized') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should figure out why Sentry error reporting isn't working right now. It'd be helpful to check if this issue occurs on users' machines.
syntaxHighlights.push({ | ||
range: [startPos, endPos], | ||
color: token.color || DEFAULT_HIGHLIGHT_COLORS[theme], | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tricky because, the background image of the suggestion comes from your theme, but the syntax highlighting is hardcoded to a specific dark/light theme.
Some of the options we have:
-
Use a hardcoded background color for light/dark themes. I think we do this for chat right now. Solves the issue with a highlighting mismatch, but maybe becomes a visual annoyance in the users editor.
-
Find some way to get the users' theme colours. There's no built-in way that VS Code provides to do this, but maybe we could read the file system and the users settings to extract theme data.
@sourcegraph review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olafurpg Looking good! I've reviewed the code and found no issues to report.
many thanks bot |
https://linear.app/sourcegraph/issue/CODY-4921/auto-edit-support-unified-diff-format-for-image-generations
AutoEditUnifiedDiff.mov
Description
This PR:
DecorationInfo
instead ofAddedLinesDecorationInfo
. This means we can easily port this to the inline decorator in a follow up PR.DecorationInfo
and supporting deletions here adds a lot of checks/edge cases.Test plan
unified
andadditions
modes enabled