Skip to content
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

Support IEditorAssociationOverride #341

Closed
ghentschke opened this issue Mar 27, 2023 · 3 comments
Closed

Support IEditorAssociationOverride #341

ghentschke opened this issue Mar 27, 2023 · 3 comments
Labels
editor The CDT C/C++, Assembly, Makefile and other editors provided by CDT
Milestone

Comments

@ghentschke
Copy link
Contributor

We are currently working on a new LSP based C/C++ Editor.
Currently I'am working on this issue

The file association for C/C++ source or header file to an editor should be dependent on the project settings. Therefor the user can select to prefer the new LSP based editor for his project.

The current implementation to override the default association of an editor to a file is based on this extension point: org.eclipse.ui.ide.editorAssociationOverride

The problem is that the cdt method org.eclipse.cdt.internal.ui.util.EditorUtility.getEditorID(IEditorInput, Object) does not care about the overriden default editor by the implementation of org.eclipse.ui.ide.editorAssociationOverride.

The fix are 5 lines of code in org.eclipse.cdt.internal.ui.util.EditorUtility.getEditorID(IEditorInput, Object):
image

The charm of this solution is, that the default C/C++ editor can be overriden by the org.eclipse.ui.ide.editorAssociationOverride extension point.

@jonahgraham
Copy link
Member

This looks good to me (but may need a null check on return of getEditorDescriptor?). Can you provide a PR so we can proceed?

@jonahgraham jonahgraham added this to the 11.2.0 milestone Mar 27, 2023
@jonahgraham jonahgraham added the editor The CDT C/C++, Assembly, Makefile and other editors provided by CDT label Mar 27, 2023
@ghentschke
Copy link
Contributor Author

I'll provide a pull request. Null check should not be necessary. The method getEditorDescrioptor will throw a PartInitException if no valid editor can be found.

ghentschke added a commit to ghentschke/cdt-changes that referenced this issue Mar 28, 2023
ghentschke added a commit to ghentschke/cdt-changes that referenced this issue Mar 31, 2023
jonahgraham pushed a commit to ghentschke/cdt-changes that referenced this issue Apr 4, 2023
@jonahgraham
Copy link
Member

Fixed by #345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor The CDT C/C++, Assembly, Makefile and other editors provided by CDT
Projects
None yet
Development

No branches or pull requests

2 participants