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

live templates stopped to work #700

Open
tbabczynski opened this issue Apr 4, 2024 · 4 comments
Open

live templates stopped to work #700

tbabczynski opened this issue Apr 4, 2024 · 4 comments
Labels

Comments

@tbabczynski
Copy link

After IntelliJ update (to 2024.1) live templates stopped to work in .g4 editor. More, in settings for the live templates, they are not associated to anything and "no applicable contexts." warning appear.
BTW. Should they be grouped in generic "user" group?

@bjansen bjansen added the bug label Apr 4, 2024
@tbabczynski
Copy link
Author

tbabczynski commented Apr 8, 2024

Here, I discovered that it is not only the update issue but also the new Jetbrains' view. The live templates for ANTLR 2023.1.6 don't work in new UI but they work in the old one. The ANTLR doesn't appear on the context list. (I didn't check all versions between them.)

EDIT:
In 2023.2.6 it doesn't work. In 2023.1.6 on my laptop it works in classic UI view, doesn't work in the new one. On the laptop of one of my students, who had this version and never had any newer, the live templates worked in both views. I don't know why. I discovered that even in the newest version the live templates work if one choose the "other" checkbox in the context define dialogue. Just the ANTLR context disappeared in the 2.6 version. Something must have changed in the editor registration process and the way the plugin used to do it stopped working.

@tbabczynski
Copy link
Author

tbabczynski commented Apr 10, 2024

Maybe it will help. I checked the com.intellij.codeInsight.template.TemplateContextType in the jetbrains repository.
It has a bunch of @deprecated marks in methods you used in the plugin, e.g.
public boolean isInContext(@NotNull PsiFile file, int offset) - * @deprecated use {@link #isInContext(TemplateActionContext)}

public OutsideRuleContext() {
	super("ANTLR_OUTSIDE", "Outside rule", ANTLRGenericContext.class);
}
/**  @deprecated Set contextId and baseContextId in plugin.xml instead */
@Deprecated
  protected TemplateContextType( String id,  String presentableName,  
    Class<? extends TemplateContextType> baseContextType)

They were deprecated in 2022 but maybe now they work no longer.

@bjansen
Copy link
Collaborator

bjansen commented Apr 11, 2024

The new method still delegates to the old one that we override, so I don't think the problem is there.
I made changes recently to fix compatibility with 2024.1, but it's possible I missed something. I'll look into it.

@tbabczynski
Copy link
Author

tbabczynski commented Apr 11, 2024 via email

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

No branches or pull requests

2 participants