Skip to content

Capture filename in partialdiff uri #66

@Coteh

Description

@Coteh

Hi, I noticed that when I use the swapdiff VS Code extension to swap two sides of a diff generated with PartialDiff, the filenames in the tab name change.

I believe this is because PartialDiff actually saves the filenames as "text/reg1" and "text/reg2" respectively based on this configuration:

REGISTER1: 'reg1',
REGISTER2: 'reg2',

Here's a couple of screenshots that illustrate my point:

Screen Shot 2021-03-21 at 6 27 55 PM

Screen Shot 2021-03-21 at 6 28 11 PM

You can see below that the uri for the first PartialDiff file contains just the "reg1" name.

Screen Shot 2021-03-21 at 6 29 01 PM

And the swapdiff extension simply does a swap of the two diffs based on visible editor uris:

https://github.com/shalimski/swapdiff/blob/0a5e83288a9c7ef57b663fb55a0a9b0c18323ccf/src/extension.ts#L22

It seems like there's an open VS Code issue at the moment to allow access to the editor tab label via API microsoft/vscode#41909 so I think the best approach is to capture the original filename (edit: and the line number too) within the PartialDiff filename, whether it's an actual file or an "untitled" file, and then other extensions such as swapdiff can make use of those original filenames.

Is this something that's possible to implement? I would be interested in taking a crack at it myself too if possible. :)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions