Skip to content

Commit afd0ff6

Browse files
ViniGupta08facebook-github-bot
authored andcommitted
Server side changes to render diff view
Summary: Adding server side changes to support rendering diff view from VS-ISL Reviewed By: evangrayk Differential Revision: D75636068 fbshipit-source-id: 82584e991d287c8decd396d9c801a4a3a93d066a
1 parent 6a5d7be commit afd0ff6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

addons/isl/src/platform/visualStudioPlatform.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
import * as pathModule from 'path';
9+
import type {Comparison} from '../../../shared/Comparison';
810
import type {Platform} from '../platform';
911
import type {OneIndexedLineNumber, RepoRelativePath} from '../types';
1012

@@ -14,6 +16,7 @@ declare global {
1416
interface Window {
1517
__vsIdeBridge: {
1618
openFileInVisualStudio: (path: string, line?: number, col?: number) => void;
19+
openDiffInVisualStudio: (path: string, comparison: Comparison) => void;
1720
};
1821
}
1922
}
@@ -48,6 +51,16 @@ const visualStudioPlatform: Platform = {
4851
}
4952
}
5053
},
54+
openDiff: async (path: RepoRelativePath, comparison: Comparison) => {
55+
if (window.__vsIdeBridge && window.__vsIdeBridge.openDiffInVisualStudio) {
56+
const helpers = await import('./platformHelpers');
57+
const repoRoot = helpers.getRepoRoot();
58+
if (repoRoot) {
59+
const fullPath = pathModule.join(repoRoot, path);
60+
window.__vsIdeBridge.openDiffInVisualStudio(fullPath, comparison);
61+
}
62+
}
63+
},
5164
canCustomizeFileOpener: false,
5265
upsellExternalMergeTool: false,
5366

0 commit comments

Comments
 (0)