PsiLiteralExpression for Pycharm Plugin
Hi, I'm working on a plugin for Pycharm, and wanted to implement new Language. So, I followed the tutorial https://plugins.jetbrains.com/docs/intellij/custom-language-support-tutorial.html
The example https://github.com/JetBrains/intellij-sdk-code-samples/tree/main/simple_language_plugin works fine, but if I want to do the same in my project, the PsiLiteralExpression is not available.
My Gradle build script has the following:
intellij
{
version = '2022.3.1'
type = 'PC'
plugins = ["PythonCore"]
}
If I add change it as in the simple_language_plugin,:
plugins = ["PythonCore", "com.intellij.java"]
I get the error:
Cannot find builtin plugin 'com.intellij.java' for IDE: ....
I found out, that the problem is, this plugin is not available for Pycharm flavor (type = 'PC').
My question is: Is it possible to use the PsiLiteralExpression in Pycharm plugins, or I need to do some workaround?
Thx,
Milo
Please sign in to leave a comment.
Hi Miloslav,
Simple language example integrates with Java files, and
PsiLiteralExpression
is a part of Java PSI and is available only in Java plugin.Java plugin is not a part of PyCharm, and I guess you don’t want to depend on Java functionality available in IntelliJ IDEA. If you want to add a similar support in Python files, I suggest using PsiViewer plugin or Tools | View PSI Structure… to inspect Python files PSI and see what element is similar to
PsiLiteralExpression
in the Python PSI.Thanks Karol, I got a little bit into PSI and solved it another way.
How did you solve it. With all the lang specific PSI features now behind each plugin it is really hard now to write a plugin that adapts to different languages and IDEs while sticking to the common semantic structure. Karol Lewandowski what is the right pattern?