PsiLiteralExpression for Pycharm Plugin

Answered

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

0
2 comments

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.

0

Thanks Karol, I got a little bit into PSI and solved it another way.

0

Please sign in to leave a comment.