JeremyYao commented on issue #1015: URL: https://github.com/apache/daffodil-vscode/issues/1015#issuecomment-2770493142
> [@JeremyYao](https://github.com/JeremyYao) off the top of my head, it may be an asynchronous/await issue with having a promise as an argument when it's required to be resolved _prior_ to sending a message. > > It may be worth either: > > 1. Move the promise for modifying the viewport prior to the send and pass the resolved data as an argument instead. > 2. Rework the data editor ui to accept a promise and do not update the viewport display until it's resolved. > > If I remember correctly option 2 may not be able to be implemented because of the data type parameter limitations for sending messages between an extension and a webview Hmmmm I've modified the code around to look like where we moved modifyViewport out of the sendViewportRefresh args. ```TypeScript private async scrollViewport( panel: vscode.WebviewPanel, viewportId: string, offset: number, bytesPerRow: number ) { // start of the row containing the offset, making sure the offset is never negative const startOffset = Math.max(0, offset - (offset % bytesPerRow)) try { const result = await modifyViewport( viewportId, startOffset, VIEWPORT_CAPACITY_MAX ) await sendViewportRefresh(panel, result) } catch { const msg = `Failed to scroll viewport ${viewportId} to offset ${startOffset}` getLogger().error({ err: { msg: msg, stack: new Error().stack, }, }) vscode.window.showErrorMessage(msg) } } ``` The issue seems to stem from sendViewportRefresh() from my testing. For a replace operation, it goes through `messageReceiver(message: EditorMessage)` about 3 times: the `MessageCommand.replace` case -> `MessageCommand.search` case -> `MessageCommand.scrollViewport` case. I'll send screenshots of the data editor as I step through the 7-th -> 8th click for Bee,Bee. I have breakpoints in the following locations:   Clicking on replace  AFter the `MessageCommand.replace` case  After the ```TypeScript await this.panel.webview.postMessage({ command: MessageCommand.searchResults, data: { searchResults: searchResults, searchDataBytesLength: searchDataBytes.length, overflow: overflow, }, }) ``` call for the `MessageCommand.search` case, we get highlighting  For the `MessageCommand.scrollViewport`, case it gets interesting    It seems to be the `sendViewportRefresh()` call removing the highlighting. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
