How to remove or replace FileEditor from EditorComposite
已回答
I have a FileEditorProvider with a HIDE_DEFAULT_EDITOR policy. But my logic of the FileEditorProvider#accept method is related to a dumb mode, and my FileEditorProvider itself is not implemented DumbAware. Thus, if the file was opened at the start of the project, a default editor will be created instead of mine.
You have special logic for adding custom (additional) editors after dumb mode (FileEditorManagerImpl#openFileImpl4), but they are only added but do not replace, the default editor.
I can reopen the files that interest me, but it will not user-friendly.
See: com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl#openFileImpl4
com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl#dumbModeFinished
请先登录再写评论。
Also, the inability to reinitialize file editors leads to a small problem in IDEA.
Test case:
Actual result: After changing the file extension to *.svg, the file editor has not changed.
See: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001940480-How-to-close-reopen-an-editor-while-preserving-its-position-in-split-panes- , this appears to be by design.
In my plugin I have an option and code to watch for file type changes and reload the affected editor(s)