@@ -44,9 +44,6 @@ function onDragOver(e) {
4444}
4545
4646function onDragLeave ( e ) {
47- // Only remove if leaving the cell (not entering a child)
48- // But dragleave fires when entering a child too.
49- // Simpler to rely on dragover to manage the class, or clean up if leaving grid.
5047 if ( e . target === lastHighlightedCell ) {
5148 // This flickers. Rely on dragover.
5249 }
@@ -78,8 +75,7 @@ async function onDrop(e) {
7875 const uris = uriList . split ( / \r ? \n / ) ;
7976 if ( uris . length > 0 && uris [ 0 ] ) {
8077 let uri = uris [ 0 ] ;
81- // Decode URI if needed, but VS Code usually provides encoded URIs
82- // We need a name. Try to extract from URI.
78+ // Extract name from URI
8379 let name = 'unknown_file' ;
8480 try {
8581 // Simple parsing for name
@@ -109,25 +105,16 @@ async function handleFileUpload(cell, fileName, fileBlob) {
109105async function handleUriUpload ( cell , fileName , uri ) {
110106 try {
111107 updateStatus ( `Fetching ${ fileName } ...` ) ;
112- // Use backend to read file from workspace
113- // Response should be the buffer/array
114108 const result = await backendApi . readWorkspaceFileUri ( uri ) ;
115109
116- // Result comes back as the data structure from RPC.
117- // HostBridge returns Uint8Array.
118- // PostMessage serialization handles Uint8Array correctly usually.
119- // If it comes as { type: 'Buffer', data: [...] } (Node Buffer serialization), we need to handle it.
120-
121110 let uint8Array ;
122111 if ( result instanceof Uint8Array ) {
123112 uint8Array = result ;
124113 } else if ( result && result . type === 'Buffer' && Array . isArray ( result . data ) ) {
125114 uint8Array = new Uint8Array ( result . data ) ;
126115 } else if ( result && typeof result === 'object' && Object . keys ( result ) . some ( k => ! isNaN ( k ) ) ) {
127- // Sometimes obj-like {0: x, 1: y...}
128116 uint8Array = new Uint8Array ( Object . values ( result ) ) ;
129117 } else {
130- // Fallback or error
131118 console . error ( 'Unknown data format from backend:' , result ) ;
132119 throw new Error ( 'Received invalid data format from backend' ) ;
133120 }
0 commit comments