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

TM4E breaks generic editor for text file #137

Closed
mniewrzal opened this issue Sep 6, 2017 · 5 comments
Closed

TM4E breaks generic editor for text file #137

mniewrzal opened this issue Sep 6, 2017 · 5 comments

Comments

@mniewrzal
Copy link

I tried to open simple text file with generic editor but it was broken with Failed to create the part's controls message. Text file can be empty.

org.eclipse.core.runtime.AssertionFailedException: null argument:Cannot find TextMate grammar for the given document at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85) at org.eclipse.tm4e.ui.text.TMPresentationReconciler$InternalListener.inputDocumentChanged(TMPresentationReconciler.java:229) at org.eclipse.jface.text.TextViewer.fireInputDocumentChanged(TextViewer.java:2759) at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2800) at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:631) at org.eclipse.jface.text.source.projection.ProjectionViewer.setDocument(ProjectionViewer.java:365) at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:581) at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:3999) at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3469) at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:61) at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:445) at org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor.createPartControl(ExtensionBasedTextEditor.java:67) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:151) at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:99) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:355) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

@angelozerr
Copy link
Contributor

That's strange because #129 was not merged?

We would like consume TextLMate grammar with GenericEditor by letting the user to register grammar with preferences (today this works only with the TextMate Editor) See #17

You have this error because a plugin (which plugin?) frines that:

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

That @mickaelistria has started with #129 But it requires some changes inside GenericEditor. It should be very cool if we could fix #17

@mickaelistria
Copy link
Contributor

At least, in case there is no TextMate grammar, the PresentationReconciler should break the whole editor (indepedently of all related issues). It should probably just log in the console and do nothing in that case.

@angelozerr
Copy link
Contributor

angelozerr commented Sep 8, 2017

@mniewrzal please retry, c0f75b0 should fix your problem.

It should probably just log in the console and do nothing in that case.

I have decided not to log something (in order to avoid polluating logs when Generic Editor open a text file or other thing where grammar doesn't exists).

But I have kept the capability to throw an error if grammar or theme are not available. You can do that with

  • option
  • with Java API with TMPresentationReconciler#setThrowError(boolean throwError)

If you don't like this idea, please tell me.

The cool thing is that now you can use user preferences grammar with Generic Editor.

@mniewrzal
Copy link
Author

please retry, c0f75b0 should fix your problem.

Looks ok now. Thanks!

Your strategy to handle logging also sounds good.

@angelozerr
Copy link
Contributor

Looks ok now. Thanks!

Cool:)

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

3 participants