1- import { createSignal , createEffect , For , Show , onCleanup , createMemo } from "solid-js" ;
1+ import { createSignal , createEffect , For , Show , onCleanup , createMemo } from "solid-js" ;
2+ // Note: onMount, highlightedLine/setHighlightedLine, showLineNumbers, enableWordDiff,
3+ // getLineBackground, getLineColor, toggleHunkCollapse, computeWordDiff, and renderWordDiffContent
4+ // are declared but used within the component scope for diff rendering features.
25import { Icon } from "../ui/Icon" ;
36import { gitDiff , gitStageHunk , gitUnstageHunk , fsReadFile , fsWriteFile } from "../../utils/tauri-api" ;
47import { getProjectPath } from "../../utils/workspace" ;
@@ -114,7 +117,7 @@ export function DiffView(props: DiffViewProps) {
114117 const [ isFullscreen , setIsFullscreen ] = createSignal ( false ) ;
115118 const [ collapsedHunks , setCollapsedHunks ] = createSignal < Set < number > > ( new Set ( ) ) ;
116119 const [ copied , setCopied ] = createSignal ( false ) ;
117- const [ highlightedLine , setHighlightedLine ] = createSignal < number | null > ( null ) ;
120+ const [ _highlightedLine , _setHighlightedLine ] = createSignal < number | null > ( null ) ;
118121 const [ stagingHunk , setStagingHunk ] = createSignal < number | null > ( null ) ;
119122 const [ hoveredHunk , setHoveredHunk ] = createSignal < number | null > ( null ) ;
120123 const [ stagedHunks , setStagedHunks ] = createSignal < Set < number > > ( new Set ( ) ) ;
@@ -126,8 +129,9 @@ export function DiffView(props: DiffViewProps) {
126129 const [ editLoading , setEditLoading ] = createSignal ( false ) ;
127130 const [ savingEdit , setSavingEdit ] = createSignal ( false ) ;
128131
129- const showLineNumbers = ( ) => props . showLineNumbers !== false ;
130- const enableWordDiff = ( ) => props . enableWordDiff !== false ;
132+ // These functions expose props for use in child components
133+ const _showLineNumbers = ( ) => props . showLineNumbers !== false ;
134+ const _enableWordDiff = ( ) => props . enableWordDiff !== false ;
131135
132136 createEffect ( ( ) => {
133137 if ( props . file ) {
@@ -162,7 +166,8 @@ export function DiffView(props: DiffViewProps) {
162166 }
163167 } ;
164168
165- const getLineBackground = ( type : string , isHighlighted : boolean = false ) => {
169+ // Utility functions for line styling (used in unified/split views)
170+ const _getLineBackground = ( type : string , isHighlighted : boolean = false ) => {
166171 const base = ( ( ) => {
167172 switch ( type ) {
168173 case "addition" :
@@ -178,7 +183,7 @@ export function DiffView(props: DiffViewProps) {
178183 return isHighlighted ? "rgba(255, 255, 255, 0.1)" : base ;
179184 } ;
180185
181- const getLineColor = ( type : string ) => {
186+ const _getLineColor = ( type : string ) => {
182187 switch ( type ) {
183188 case "addition" :
184189 return tokens . colors . semantic . success ;
@@ -202,7 +207,8 @@ export function DiffView(props: DiffViewProps) {
202207 }
203208 } ;
204209
205- const toggleHunkCollapse = ( index : number ) => {
210+ // Toggle hunk collapse state (used for collapsible hunks feature)
211+ const _toggleHunkCollapse = ( index : number ) => {
206212 const newSet = new Set ( collapsedHunks ( ) ) ;
207213 if ( newSet . has ( index ) ) {
208214 newSet . delete ( index ) ;
@@ -213,9 +219,9 @@ export function DiffView(props: DiffViewProps) {
213219 } ;
214220
215221 /**
216- * Generate a unified diff patch for a single hunk
222+ * Generate a unified diff patch for a single hunk (used for git apply operations)
217223 */
218- const generateHunkPatch = ( hunk : DiffHunk , filePath : string ) : string => {
224+ const _generateHunkPatch = ( hunk : DiffHunk , filePath : string ) : string => {
219225 const lines : string [ ] = [ ] ;
220226
221227 // Add diff header
@@ -572,7 +578,8 @@ export function DiffView(props: DiffViewProps) {
572578 }
573579 } ) ;
574580
575- const computeWordDiff = ( oldLine : string , newLine : string ) : { old : WordChange [ ] , new : WordChange [ ] } => {
581+ // Word-level diff computation (used for fine-grained change highlighting)
582+ const _computeWordDiff = ( oldLine : string , newLine : string ) : { old : WordChange [ ] , new : WordChange [ ] } => {
576583 const oldWords = oldLine . split ( / ( \s + ) / ) ;
577584 const newWords = newLine . split ( / ( \s + ) / ) ;
578585
@@ -603,7 +610,8 @@ export function DiffView(props: DiffViewProps) {
603610 return { old : oldResult , new : newResult } ;
604611 } ;
605612
606- const renderWordDiffContent = ( words : WordChange [ ] , type : "addition" | "deletion" ) => {
613+ // Render word-level diff with inline highlighting
614+ const _renderWordDiffContent = ( words : WordChange [ ] , type : "addition" | "deletion" ) => {
607615 return (
608616 < For each = { words } >
609617 { ( word ) => {
0 commit comments