-
Notifications
You must be signed in to change notification settings - Fork 201
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
[#808] Support overriden default-editor-association in EditorUtility #809
[#808] Support overriden default-editor-association in EditorUtility #809
Conversation
@jonahgraham can this be part of the next release or am I too late? |
I am pretty comfortable with the last minute changes for the CDT-LSP components, but this is pretty core in CDT and we won't have time to respin if there are unintended consequences. Can we leave it for after this release? If you need it in this release, let me know and I will investigate more to see if we can squeeze it in. |
I know that this is pretty late but I found this issue in the morning. IMO it's a bigger bug when users want to work with old an new editor in the same workspace (as we do in out product) and we want to update our IDE after this release. So it would be great if you have the time to check this PR. |
OK - I will have a look in detail. If I don't see too much concern I will merge this before RC2 build. |
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry(); | ||
IEditorDescriptor desc = registry.getDefaultEditor(input.getName(), contentType); | ||
IEditorDescriptor desc = null; | ||
if (input instanceof ExternalEditorInput externalInput) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the risk here is moderate, because this code will be reached only if the input is not an instance of IFileEditorInput
and it must be an instanceof ExternalEditorInput
which limits the call on non workspace files as well. However, when this code should throw an exception, the previous behavior is ensured (desc is still null).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you have a look at
Lines 232 to 240 in 46d7fb7
} else if (input instanceof IURIEditorInput) { | |
IURIEditorInput uriEditorInput = (IURIEditorInput) input; | |
URI uri = uriEditorInput.getURI(); | |
try { | |
IFileStore fileStore = EFS.getStore(uri); | |
id = IDE.getEditorDescriptorForFileStore(fileStore, false).getId(); | |
} catch (CoreException e) { | |
// fallback to default case | |
} |
Besides that question - I agree this change is low risk and worth getting in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it works as well. Good point!
Thanks @ghentschke - I have merged now. |
fixes #808
fixes eclipse-cdt/cdt-lsp#338