Skip to content

adopt working copy editor handler and remove custom editor input factory - #123308

Merged
Benjamin Pasero (bpasero) merged 2 commits into
mainfrom
ben/custom-editor-handler
May 10, 2021
Merged

Benjamin Pasero (bpasero) merged 2 commits into
mainfrom
ben/custom-editor-handler

Conversation

@bpasero

Copy link
Copy Markdown
Contributor

This PR fixes #117208

This puts an end to custom editor input factories and leverages the new IWorkingCopyEditorHandler infrastructure that has already been adopted for notebooks and search editors.

It is similar in some regard, so most of the code is pretty much the same. I am still not super happy that the backup needs to be resolved first before being able to create the editor input because I think that should happen rather from the resolve method and e.g. notebooks can resolve sync as well (and have extensions behind them).

Anyway, one issue I see with this change that I need help with:

  • open some text editors
  • open a Luna paint editor
  • make the paint editor dirty
  • click one of the text editors
  • reload
  • click on paint editor

=> 🐛 Unable to open 'Screenshot 2021-05-07 at 17.16.50.png': Webview already registered.

Demo:
recording

I think the second time the editor restores it works nicely because at that point the UI state did not have the previous editor in hand anymore so it was freshly opened. On the upside, this proofs that the new backup mechanism keeps backups around until they can be restored successfully 👍

*/
class WorkbenchConfigurationContribution {
constructor(
@ICustomEditorService _customEditorService: ICustomEditorService,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logan Ramos (@lramos15) fyi I moved this "hack" into the new ComplexCustomWorkingCopyEditorHandler

@bpasero

Copy link
Copy Markdown
Contributor Author

Matt Bierner (@mjbvz) the more I think about it the more I feel this check is not working (probably even before):

https://github.com/microsoft/vscode/pull/123308/files#diff-dcfa850f285ac9c88d57d984808503db30081884d22f2692a462f1cbb153d6d6R126

The idea is that when isOpen returns false, createEditor will be called and now we probably have 2 editors with the same webview and that is the error we see.

@Stirfry70

This comment has been minimized.

@mjbvz

Copy link
Copy Markdown
Contributor

Benjamin Pasero (@bpasero) Thanks for looking into this!

I confirmed that the webview is already registered error happens because we create two identical custom editor inputs. As you note, the second input is created because the isOpen check always returns false.

I just pushed a fix for isOpen. This seems to fix the issue with restoring the webview on reload

@bpasero
Benjamin Pasero (bpasero) deleted the ben/custom-editor-handler branch May 10, 2021 05:29
@bpasero

Copy link
Copy Markdown
Contributor Author

Thanks!

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

custom-editors Custom editor API (webview based editors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit custom editor input factory

3 participants