Skip to content

Conversation

@ctlai95
Copy link
Contributor

@ctlai95 ctlai95 commented Apr 25, 2025

Problem

The current viewDiff implementation is restricted to only allowing comparing the current file contents. This means it's not possible to view a diff for a change that was applied at a previous point in time.

Solution

  • Create a new DiffContentProvider that can support showing multiple URIs in the same scheme. The current ContentProvider has a limitation that it can only show a single URI.
  • Refactor the code to use a defined type ViewDiffMessage instead of any
  • Change the logic so that diffs are stored in memory instead of a temp file on disk

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions
Copy link

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@ctlai95 ctlai95 changed the title feat: support multiple uri in a single diff scheme feat(amazonq): support multiple uri in a single diff scheme Apr 25, 2025
@ctlai95 ctlai95 closed this Apr 25, 2025
@ctlai95 ctlai95 reopened this Apr 25, 2025
* A TextDocumentContentProvider that can handle multiple URIs with the same scheme.
* This provider maintains a mapping of URIs to their content.
*/
export class DiffContentProvider implements vscode.TextDocumentContentProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this basically equivalent to having a virtual file system in vscode and then adding virtual files to it?

Copy link
Contributor Author

@ctlai95 ctlai95 Apr 25, 2025

Choose a reason for hiding this comment

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

I think yes, but I also need it to support multiple URIs to compare the before and after using the same URI scheme. I'm not sure if that part is supported by a vfs

@ctlai95 ctlai95 marked this pull request as ready for review April 25, 2025 18:46
@ctlai95 ctlai95 requested review from a team as code owners April 25, 2025 18:46
Copy link
Contributor

@justinmk3 justinmk3 left a comment

Choose a reason for hiding this comment

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

Using a VFS is a good idea, but in this case it might not look much different in terms of new surface area (code + tests)?

@jpinkney-aws jpinkney-aws merged commit 947c471 into aws:feature/hybridChat Apr 26, 2025
19 of 22 checks passed
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.

3 participants