MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / showDiff

Function showDiff

source code/hooks/useDiffInIDE.ts:79–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77 getConnectedIdeName(toolUseContext.options.mcpClients) ?? 'IDE'
78
79 async function showDiff(): Promise<void> {
80 if (!shouldShowDiffInIDE) {
81 return
82 }
83
84 try {
85 logEvent('tengu_ext_will_show_diff', {})
86
87 const { oldContent, newContent } = await showDiffInIDE(
88 filePath,
89 edits,
90 toolUseContext,
91 tabName,
92 )
93 // Skip if component has been unmounted
94 if (isUnmounted.current) {
95 return
96 }
97
98 logEvent('tengu_ext_diff_accepted', {})
99
100 const newEdits = computeEditsFromContents(
101 filePath,
102 oldContent,
103 newContent,
104 editMode,
105 )
106
107 if (newEdits.length === 0) {
108 // No changes -- edit was rejected (eg. reverted)
109 logEvent('tengu_ext_diff_rejected', {})
110 // We close the tab here because 'no' no longer auto-closes
111 const ideClient = getConnectedIdeClient(
112 toolUseContext.options.mcpClients,
113 )
114 if (ideClient) {
115 // Close the tab in the IDE
116 await closeTabInIDE(tabName, ideClient)
117 }
118 onChange(
119 { type: 'reject' },
120 {
121 file_path: filePath,
122 edits: edits,
123 },
124 )
125 return
126 }
127
128 // File was modified - edit was accepted
129 onChange(
130 { type: 'accept-once' },
131 {
132 file_path: filePath,
133 edits: newEdits,
134 },
135 )
136 } catch (error) {

Callers 1

useDiffInIDEFunction · 0.85

Calls 7

logEventFunction · 0.85
showDiffInIDEFunction · 0.85
computeEditsFromContentsFunction · 0.85
getConnectedIdeClientFunction · 0.85
closeTabInIDEFunction · 0.85
onChangeFunction · 0.50
logErrorFunction · 0.50

Tested by

no test coverage detected