Is it possible to specify default editor?
Hello. I use `OpenFileDescriptor(project, file).navigate(true);` to open my file in editor. If file extension is unknown then IDEA ask which editor to use. Is it possible to specify default editor (to skip popup window)?
Please sign in to leave a comment.
Try to use OpenFileDescriptor.navigateInEditor(...) method.
It doesn't work - just nothing happens. I need to open plain text editor for unknown file extension.
I read sources and found following solution. Is it correct? Is it possible to improve it?
This should work.You can also just check whether file.getFileType() is FileTypes.UNKNOWN, and if it is, do the manual type override as you do.
Is `FileTypeManagerImpl.cacheFileType(file, PlainTextFileType.INSTANCE);` correct way to override file type? It doesn't look like public API and I think it may change in future versions of IDEA
There's no other way to do it, unless there's a filename pattern that identifies your files (or any other criteria on a VirtualFile).