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

Defines "org.eclipse.core.runtime.text" GenericEditor #17

Closed
angelozerr opened this issue Nov 23, 2016 · 4 comments
Closed

Defines "org.eclipse.core.runtime.text" GenericEditor #17

angelozerr opened this issue Nov 23, 2016 · 4 comments

Comments

@angelozerr
Copy link
Contributor

angelozerr commented Nov 23, 2016

Once GenericEditor presentationReconcilers will support "org.eclipse.core.runtime.text" to bind IPresentationReconclier (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=507772), the org.eclipse.textmate4e.ui could declare in the plugin.xml:

<extension
         point="org.eclipse.ui.genericeditor.presentationReconcilers">
      <presentationReconciler           class="org.eclipse.language.textmate.eclipse.text.TMPresentationReconciler"
            contentType="org.eclipse.core.runtime.text">

It will give the capability to register a TextMate grammar with UI preferences and when user will open a file with GenericEditor, the syntax coloration should be done.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=507753#c2

@mickaelistria
Copy link
Contributor

I've proposed a patch for https://bugs.eclipse.org/bugs/show_bug.cgi?id=507772 . With this, you can simply have the TMPresentationReconciler throw an IllegalArgumentError in the install(...) method (according to the provided viewer and document) to notify the generic editor that it should be ignored.
It would be great if you could give it a try.

mickaelistria added a commit to mickaelistria/textmate.java that referenced this issue Aug 7, 2017
And throw an exception in install if it cannot apply properly (missing
grammar).

Signed-off-by: Mickael Istria <[email protected]>
@mickaelistria
Copy link
Contributor

In order to have this, TMPresentationReconciler mustn't show the pop-up message in case of missing grammar. I believe this piece of logic, showing the pop-up in case of missing grammar, makes more sense inside the TMEditor or someplace else that doesn't cascade to generic editor.
Also, TMPresentationReconciler shouldn't throw an error when there is no grammar. In case there is no available grammar for the input, it should simply do nothing. Currently, we cannot associate to text as it would make the Generic Editor show an error and be unusable
I'm working on another appraoch that would allow making the TMPresentationReconciler the default (if no better one is defined). It's simpler and better, but it requires TMPresentationReconciler to not break things.

@angelozerr
Copy link
Contributor Author

Also, TMPresentationReconciler shouldn't throw an error when there is no grammar.

When you register with extension point a grammar (with bad information), I think it's cool to see the error in the editor, no?

@mickaelistria
Copy link
Contributor

Yes, in case the grammar is erroneous, it's fine to show an error because either it happens during devleopment time and the developer can fix it, or it's a user-defined association and user can remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants