New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revisit handling of deleted/moved files in custom editors #86599
Comments
I pushed changes to revert back to how it was. I have a feeling that each editor should handle moves and deletes individually, specifically I think The reason I feel this cannot be handled in a generic way is that file changes and file operations are very specific and not something every editor should care about. So a method such as Let's put that on the agenda for our sync. |
I briefly looked into this but don't have a good understanding of how this should work. Specifically: vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts Lines 161 to 174 in e8b79d9
It looks like we used to pass in the new Is there a way to trigger a custom editor on a file resource to try to reproduce? |
@mjbvz I spend some time working on it via 7293979 and went back to a solution that would expose a It has the following signature: move(group: GroupIdentifier, target: URI): IMoveResult | undefined
export interface IMoveResult {
editor: IEditorInput | IResourceEditor;
options?: IEditorOptions;
} The idea is that you can return a new editor input that you would like to be replaced with and provide some additional options if e.g. you want to restore specific view state once the editor is being replaced. I was not adopting this for custom editor input because I was not sure how to create the input from within the custom input, maybe you could have a look and then delete your custom logic for handling moves. Btw deletes are also handled now, a file that is deleted that matches an editor that is opened will dispose that editor. But I think you have extra logic already somewhere to dispose webviews when files are deleted, maybe you could check. |
I just came across the change in b52f1c7#diff-bd0cac707b6707e6ef725a11d0702cea. I think the approach is a bit questionable as we now have some editors implementing this method (custom) but some not (files).
I find the
FileEditorTracker
should only be responsible for updating editors for files, not any other editor nor custom editors. At least that was the initial intent of it.Can you do the tracking on your end for custom editors? I am not seeing a big win of doing this in a generic way?
The text was updated successfully, but these errors were encountered: