-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Implemented IVsEditorFactoryChooser on AbstractEditorFactory class to invoke WinForms designer editor factory directly by VS Shell #77306
base: main
Are you sure you want to change the base?
Conversation
…y class. This interface provides a method 'ChooseEditorFactory' which is invoked by VS Shell before 'CreateEditorInstance' method is invoked. 'ChooseEditorFactory' method provides an opportunity to the current editor factory to sniff the file and return another editor factory guid if required. If an alternate editor factory guid is returned, VS Shell will invoke that editor factory directly. Else it will continue to invoke 'CreateEditorInstance' method of current editor factory. We use this mechanism to check if 'rguidLogicalView' is 'Designer'. If it is designer, then ChooseEditorFactory will return editor factory guid of a new WinForms Editor Factory. We have safeguarded the changes behind a feature flag which will be enabled by default.
src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs
Outdated
Show resolved
Hide resolved
@Shyam-Gupta Once this is rolled out fully, would this mean we can delete all the other code we have in our editor factory that special cases WinForms by simply always delegating to the other editor factory? |
I've restarted the integration test failures, but they weren't looking entirely optimistic:
So that could be related to a crash in the editor factory since it was trying to open a file. |
Yes thats right. Once it all works as expected, I will share another PR to cleanup that code. |
…s to succeed as the VS build against which the tests are running, does not have WinForms inproc designer side of changes yet.
Its happening because the VS build against which integration tests are running does not have WinForms inproc designer side of changes yet. To workaround this issue, I have set defaultValue = false for the feature flag. This way the tests will use earlier code path which doesn't utilize the new editor factory. It will use the new EF once the change gets inserted into VS. |
Implemented IVsEditorFactoryChooser interface on
AbstractEditorFactory
class. This interface provides a methodChooseEditorFactory
which is invoked by VS Shell beforeCreateEditorInstance
method is invoked.ChooseEditorFactory
method provides an opportunity to the current editor factory to sniff the file and return another editor factory guid if required. If an alternate editor factory guid is returned, VS Shell will invoke that editor factory directly. Else it will continue to invokeCreateEditorInstance
method of current editor factory. We use this mechanism to check ifrguidLogicalView
isDesigner
. If it is designer, thenChooseEditorFactory
will return editor factory guid of a new WinForms Editor FactoryWinFormsDesignerEditorFactory
. This new editor factory will return an instance ofIAsyncDocView
interface which will enable it to load the designer asynchronously.We have safeguarded the changes behind a feature flag which will be enabled by default.