Skip to content
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

Feature Request: Option to disable for diff comparison #112

Open
snaphat opened this issue Apr 24, 2023 · 2 comments
Open

Feature Request: Option to disable for diff comparison #112

snaphat opened this issue Apr 24, 2023 · 2 comments

Comments

@snaphat
Copy link

snaphat commented Apr 24, 2023

Blockman can be bit busy when viewing side by side comparisons such that distracts from the actual differences. I would like to request a option to automatically disable blockman for diff views.

@leodevbro
Copy link
Owner

Thank. I hope I will have time soon to try implementing this feature request.
Right now you can toggle disable/enable Blockman with F1 command:
>Blockman Toggle Enable/Disable
or
>Blockman Toggle Enable/Disable And Force Show/Hide Indent Guides

@leodevbro
Copy link
Owner

So far I found these solutions:

if (editor.document.uri.scheme === "git") {
    // this editor is the left side of the diff
}
const theUri = editor.document.uri.toString();

const trueOrFalse = window.tabGroups.all.some((tabGroup) =>
    tabGroup.tabs.some((tab) => {
        const tabInp: any = tab.input;

        return (
            tabInp?.modified?.toString() === theUri ||
            tabInp?.original?.toString() === theUri
        );
    }),
);

if (trueOrFalse) {
    // this editor has the document which is open in at least one diff editor
    // but this editor may not be the diff editor.
    // For example, maybe this editor is just a normal editor and this document is open in another editor which is diff editor.
}

Sources:
microsoft/vscode#36019
microsoft/vscode#15513

So, for now, we can detect the left side of diff editor, but I could not find a solution to detect the right side of diff editor. I mean, as you can see in the above code samples, we can detect that the editor has the document which is open in at least one diff editor, but we cannot be sure that this editor is the diff editor itself.

If you or anyone finds a solution for it, please let me know.

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

No branches or pull requests

2 participants