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

No syntax highlight on jinja files #102

Closed
Kiiv opened this issue Feb 8, 2024 · 10 comments
Closed

No syntax highlight on jinja files #102

Kiiv opened this issue Feb 8, 2024 · 10 comments

Comments

@Kiiv
Copy link

Kiiv commented Feb 8, 2024

Hi,

I've installed the plugin on Eclipse2023-12.
Version: 2023-12 (4.30.0)
Build id: 20231201-2043

I have no syntax highlight on a text.json.j2 file.

In the error log I have this :

!ENTRY org.eclipse.tm4e.languageconfiguration 4 0 2024-02-08 09:40:25.009
!MESSAGE Failed to parse pattern: {%\s*end(block|filter|for|if|macro|raw)\s*%}
!STACK 0
java.util.regex.PatternSyntaxException: Illegal repetition near index 1
{%\s*end(block|filter|for|if|macro|raw)\s*%}
 ^
	at java.base/java.util.regex.Pattern.error(Pattern.java:2028)
	at java.base/java.util.regex.Pattern.closure(Pattern.java:3309)
	at java.base/java.util.regex.Pattern.sequence(Pattern.java:2214)
	at java.base/java.util.regex.Pattern.expr(Pattern.java:2069)
	at java.base/java.util.regex.Pattern.compile(Pattern.java:1783)
	at java.base/java.util.regex.Pattern.<init>(Pattern.java:1430)
	at java.base/java.util.regex.Pattern.compile(Pattern.java:1069)
	at org.eclipse.tm4e.languageconfiguration.internal.utils.RegExpUtils.create(RegExpUtils.java:39)
	at org.eclipse.tm4e.languageconfiguration.internal.model.LanguageConfiguration.getAsPattern(LanguageConfiguration.java:211)
	at org.eclipse.tm4e.languageconfiguration.internal.model.LanguageConfiguration.lambda$6(LanguageConfiguration.java:196)
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.readIntoField(ReflectiveTypeAdapterFactory.java:212)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:433)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:393)
	at com.google.gson.Gson.fromJson(Gson.java:1227)
	at com.google.gson.Gson.fromJson(Gson.java:1137)
	at com.google.gson.Gson.fromJson(Gson.java:1075)
	at org.eclipse.tm4e.languageconfiguration.internal.model.LanguageConfiguration.load(LanguageConfiguration.java:205)
	at org.eclipse.tm4e.languageconfiguration.internal.registry.LanguageConfigurationDefinition.getLanguageConfiguration(LanguageConfigurationDefinition.java:138)
	at org.eclipse.tm4e.languageconfiguration.internal.registry.AbstractLanguageConfigurationRegistryManager.getLanguageConfigurationFor(AbstractLanguageConfigurationRegistryManager.java:61)
	at org.eclipse.tm4e.languageconfiguration.internal.HasLanguageConfigurationPropertyTester.test(HasLanguageConfigurationPropertyTester.java:59)
	at org.eclipse.core.internal.expressions.Property.test(Property.java:65)
	at org.eclipse.core.expressions.TestExpression.evaluate(TestExpression.java:107)
	at org.eclipse.core.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:54)
	at org.eclipse.core.expressions.WithExpression.evaluate(WithExpression.java:84)
	at org.eclipse.core.expressions.ReferenceExpression.evaluate(ReferenceExpression.java:72)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isCoreExpressionVisible(ContributionsAnalyzer.java:281)
	at org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isVisible(ContributionsAnalyzer.java:255)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord.computeVisibility(ContributionRecord.java:170)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributionRecord.updateVisibility(ContributionRecord.java:101)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.updateElementVisibility(MenuManagerRendererFilter.java:191)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.updateElementVisibility(MenuManagerRendererFilter.java:202)
	at org.eclipse.ui.internal.WorkbenchWindow.lambda$3(WorkbenchWindow.java:868)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5039)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4519)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:342)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:648)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:342)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:555)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1459)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1432)

Here is my installation details :

  Buildship: Eclipse Plug-ins for Gradle	3.1.8.v20231117-1658	org.eclipse.buildship.feature.group	Eclipse Buildship
  Bytecode Outline View	1.2.200.v20231106-1537	org.eclipse.jdt.bcoview.feature.feature.group	Eclipse.org
  EclEmma Java Code Coverage	3.1.8.202311140945	org.eclipse.eclemma.feature.feature.group	Eclipse EclEmma
  Eclipse IDE for Java Developers	4.30.0.20231201-1200	epp.package.java	Eclipse Packaging Project
  Eclipse Java Development Tools	3.19.300.v20231201-0110	org.eclipse.jdt.feature.group	Eclipse.org
  Extra Syntax Highlighting	1.0.0.20240204-1618	de.sebthom.eclipse.extra_syntax_highlighting.feature.feature.group	Sebastian Thomschke
  Git integration for Eclipse	6.8.0.202311291450-r	org.eclipse.egit.feature.group	Eclipse EGit
  GWT Eclipse Plugin	4.0.1.202305162146	com.gwtplugins.eclipse.suite.v3.feature.feature.group	GWT Eclipse Plugin
  Java implementation of Git	6.8.0.202311291450-r	org.eclipse.jgit.feature.group	Eclipse JGit
  JNA Library	4.1.0.v06022015_1911	net.java.dev.jna.feature.group	null
  JustJ JRE for IDE Packages	17.0.0.v20240120-1430	org.eclipse.justj.epp.feature.group	Eclipse JustJ
  M2E - Maven Integration for Eclipse	2.4.200.20231119-0901	org.eclipse.m2e.feature.feature.group	Eclipse.org - m2e
  M2E - POM Editor using LemMinX language server (includes Incubating components)	2.0.6.20231113-2319	org.eclipse.m2e.lemminx.feature.feature.group	Eclipse.org - m2e
  M2E - SLF4J over Logback Logging	2.2.1.20231113-2319	org.eclipse.m2e.logback.feature.feature.group	Eclipse.org - m2e
  Marketplace Client	1.10.2.v20231116-1812	org.eclipse.epp.mpc.feature.group	Eclipse Marketplace Client
  Mylyn WikiText	3.0.48.202308291007	org.eclipse.mylyn.wikitext_feature.feature.group	Eclipse Mylyn
  Oomph Setup	1.30.0.v20231122-0734	org.eclipse.oomph.setup.feature.group	Eclipse Oomph Project
  SonarLint for Eclipse	9.3.0.81553	org.sonarlint.eclipse.feature.feature.group	SonarSource
  Source Map Editor Feature	2.1.0.202303101717	com.github.sdbg.feature.feature.group	null
  SQL Editor	1.4.0	de.jcup.sqleditor.feature.group	Albert Tregnaghi
  Subversive SVN Connectors	6.0.4.I20161211-1700	org.polarion.eclipse.team.svn.connector.feature.group	Polarion Software
  Subversive SVN Integration for the M2E Project (Optional)	4.8.0.v20230227-2140	org.eclipse.team.svn.m2e.feature.group	Eclipse.org
  Subversive SVN Team Provider	4.8.0.v20230227-2140	org.eclipse.team.svn.feature.group	Eclipse.org
  Subversive SVN Team Provider Core	4.8.0.v20230227-2140	org.eclipse.team.svn.core.feature.group	Eclipse.org
  Subversive SVN Team Provider UI Capabilities	4.0.0.v20230227-2140	org.eclipse.team.svn.ui.capabilities.feature.group	Eclipse.org
  SVNKit 1.10.x Implementation (Optional)	6.1.0	org.polarion.eclipse.team.svn.connector.svnkit1_10.feature.group	osspit.org
  SVNKit Library	1.10.6.r10830	org.tmatesoft.svnkit.feature.group	TMate Software
  Tip of the Day UI Feature	0.4.200.v20231106-1240	org.eclipse.tips.feature.feature.group	Eclipse.org
  TM Terminal	11.4.0.202309142347	org.eclipse.tm.terminal.feature.feature.group	Eclipse CDT
@Kiiv
Copy link
Author

Kiiv commented Feb 8, 2024

Maybe you need at least to replace :

      "start": "{%\\s*(block|filter|for|if|macro|raw)",
      "end": "{%\\s*end(block|filter|for|if|macro|raw)\\s*%}"

by :

      "start": "\\{%\\s*(block|filter|for|if|macro|raw)\\}",
      "end": "\\{%\\s*end(block|filter|for|if|macro|raw)\\s*%\\}"

@sebthom
Copy link
Owner

sebthom commented Feb 8, 2024

The underlying issue is probably this: eclipse/tm4e#677
I'll see what I can do about it.

@sebthom
Copy link
Owner

sebthom commented Feb 8, 2024

The exception you are seeing is not related to parsing and is already fixed using the latest snapshot build of TM4E.

The actual issue was a configuration problem that I just fixed. Please update the extra-syntax-highlighting-eclipse-plugin and test again. For me it now looks like this:

image

@Kiiv
Copy link
Author

Kiiv commented Feb 8, 2024

Thanks, I'll try that ASAP !

This comment is not relevant even if it's not the cause of the problem ?

EDIT : still not working for me. And the same message appears in the logs

@sebthom
Copy link
Owner

sebthom commented Feb 8, 2024

Check which version of TM4E is installed and either upgrade to the latest release or snapshot version:

image

@sebthom
Copy link
Owner

sebthom commented Feb 8, 2024

This comment is not relevant even if it's not the cause of the problem ?

I already fixed this in TM4E. The snapshot version is able to parse this.

@Kiiv
Copy link
Author

Kiiv commented Feb 8, 2024

Better with TM4E 0.9.0 : jinja expression are well highlighted but not the json part. Don't know if it is working as intended.

I still have the "Failed to parse pattern" logs though.

EDIT : ok I'll try the snapshot of TM4E :)

@Kiiv
Copy link
Author

Kiiv commented Feb 8, 2024

No more error logs with the latest snaphot but still no syntax highlight for the json syntax in the file.

Curiously, if I paste my code in the "preview" section of the "Text Mate" > "Grammar" > "test.json.jinja" configuration page, it is working as expected

@sebthom
Copy link
Owner

sebthom commented Feb 8, 2024

I figured out the root cause, looks like eclipse does not like mapping content types to file extensions that contain a dot, e.g. json.jinja. I changed the config to use the file-patterns attribute instead when doing the content type mapping.

@Kiiv
Copy link
Author

Kiiv commented Feb 9, 2024

Tested this morning with the latest version and it's working as expected now !

Thank you very much for your support :)

@sebthom sebthom closed this as completed Feb 9, 2024
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