Closed tyaginidhi closed 11 months ago
I tested this in github.dev which also uses a FIleSystemProvider and it worked fine:
Do you get some error when trying to save, either as a notification or in the devtools console?
Thats the tricky part - there are no errors in console on Save action. There is just this on console on file edit and save:
File appears to be saved initially - but on vscode.dev tab reload this is the message for the image file open in editor: (this error though is not consistent in occurence) 9247.js:1 Uncaught (in promise) Error: Not enough bytes in file for png signature (0) at g (9247.js:1:7657) at Module._ (9247.js:1:9667) at s (vscode.main.js:1:71773) at async Se.openFile (vscode.main.js:1:204643) at async gn (vscode.main.js:1:310191) at async vscode.main.js:1:313536
This notification below is consistent - which seems reasonable since the changes to image file are not saved on the backend database.
This is what I'm seeing for vscode.dev/github/...
:
Since it's working for that I suspect there's something going wrong on the power platform end. Can you verify the writeFile call is getting the data and saving correctly?
Confirmed that there is no call coming to writeFile implementation. This is the writeFile code we have, for reference. And this is where we are registering the FSProvider.
Weird... If it was Luna Paint's fault I would expect some error showing up in devtools.
Could you enable trace logging via the Set Log Level command, try save and then grab the log from extension host channel in the output panel?
Here are the logs from Image file load to edit and save. LunaPaintImageEditSaveLogVerbose.txt
Oh looks like that's from devtools, I meant from here:
aha - i got it wrong - here are the logs from output channel for file open, edit and save action - though i noticed that there is not much in logs apart from diagnostics and this command: 2023-08-25 13:02:18.863 [trace] ExtHostCommands#executeCommand _update.state
Here is the file for reference: LunaPaintImageEditSaveLogVerbose_OutputChannel.txt
I am using npx to serve the extension files on localhost and consume in vscode.dev insiders URL: npx serve --cors -l 5000 --ssl-cert $HOME/certs/localhost.pem --ssl-key $HOME/certs/localhost-key.pem
Also - after edit-save scenario I tried opening the file from "File explorer", and I see the file is rendered with the last saved changes - so I think the changes are getting written to Virtual File System(VFS), but not to our database. Most likely since the call is possibly going to vscode.fs.writeFile() function??? and not to the provider implementation of writeFile? Just a theory - so not totally sure - but attaching the logs - maybe something amiss will show-up here.
LunaPaintImageEditSaveLogVerbose_OutputChannel_fileOpensceanrio.txt
Do you have the same problem with any other custom webview editors, like tldraw or draw.io integration?
Haven't tried these before but seems both of these extension support their own specific file formats unlike Luna paint - will have to get back on this.
The fact that they work on special file extensions shouldn't matter, the custom editors API which is what they all use replace the default editor and should work the same (in the image case it's the image preview).
@Tyriar I am now getting call to the writeFIle call in our FS implementation - so have closed the issue raised on Vscode-dev. I am checking the reload file sceanrio after the save file is successful to our backend. Seeing some issue there on correct file read on reload. Will debug this and raise a seprate issue as needed. Closing this issue down since it is now an action on our extension. On, why the initial writeFile call was not happening? I do not have a root-cause, but possibly worth trying on other similar issues. Seems like if there was any issue its not reproing any more.
For reference: https://github.com/microsoft/vscode-dev/issues/988
@Tyriar Good news. I have the PR ready to make use of Luna paint to help enable image edits for files loaded by our extension. Here is the PR: https://github.com/microsoft/powerplatform-vscode/pull/733
DO you mind reviewing it for accuracy?
Thank you for all the time spent in making this possible! We will be releasing it sometime next week, or after!
Our extension Power Platform Tools loads images associated with a website (Power pages - part of Power platform) from backend (Dataverse). I tried installing Luna paint and I am able to edit these images - but on save, the call to backend for saving these files in our database did not happen.
In Power platform tools extension - we have our own FileSystemProvider implementation - and leverage the writeFile() call to save the file content edited by user to our backend as well.
What is the delta we need to address to make sure our users are able to use Luna paint to edit files without our extension natively building this support? Or, is there a bug which is not allowing this to automatically happen for images loaded via our extension?