Closed mickaelistria closed 9 months ago
I am not happy with the fix via #655 and will probably revert it.
AbstractGrammarRegistryManager#grammarForScopeName
should not throw an exception if a grammar is not found but return null. so the issue lies elsewhere.
with #655 any TMException that may happen during loading a grammar for other reasons than a not found grammar is swallowed and neither reported to the log nor the UI.
Can you please provide a full stacktrace of the exception you got.
I could reproduce it. This is not supposed to happen.
org.eclipse.tm4e.core.TMException: No grammar provided for <source.java@some.plugin.id>
at org.eclipse.tm4e.core.internal.grammar.dependencies.ScopeDependencyProcessor.collectReferencesOfReference(ScopeDependencyProcessor.java:117)
at org.eclipse.tm4e.core.internal.grammar.dependencies.ScopeDependencyProcessor.processQueue(ScopeDependencyProcessor.java:82)
at org.eclipse.tm4e.core.registry.Registry._loadGrammar(Registry.java:139)
at org.eclipse.tm4e.core.registry.Registry.loadGrammar(Registry.java:126)
at org.eclipse.tm4e.registry.internal.AbstractGrammarRegistryManager.getGrammarForScope(AbstractGrammarRegistryManager.java:198)
at org.eclipse.tm4e.registry.internal.AbstractGrammarRegistryManager.getGrammarFor(AbstractGrammarRegistryManager.java:168)
at org.eclipse.tm4e.ui.text.TMPresentationReconciler.findGrammar(TMPresentationReconciler.java:339)
at org.eclipse.tm4e.ui.text.TMPresentationReconciler$TextViewerListener.inputDocumentChanged(TMPresentationReconciler.java:212)
I am not happy with the fix via https://github.com/eclipse/tm4e/pull/655 and will probably revert it.
Any other fix that would still allow referencing 3rd party grammars without adding a provider-specific suffix and that doesn't throw an exception on missing grammar would be fine. This issue was blocker for eclipseide-jdtls and wildwebdeveloper which have referenced the grammars from the language_pack.
I'm looking into it and yes the idea is that you can still reference syntaxes using the plain textmate scope name from other plugins.
I hopefully fixed the root cause now. please try the latest snapshot release.
Thank you for this improved fix.
In eclipseide-jdtls, we reference the grammar from the TM4E language pack. This was working until 4199ad9e75bc972aa7882238ba44095e3aa8e7b5 . Now, the same code makes the editor fail at being initialized, with a message assuming it's looking for the grammar inside this current consumer bundle, which is not true.
The mapping should be more relaxed: if a scopeName is set, then instead of failing if not defined locally it could pick any of the defined ones in 3rd party plugins.