Calling PsiViewer from external tool (NOT plugin)


#1

Hi,

TLDR: Sample code for invoking PsiViewer in external tool (not as IntelliJ plugin) ?

  1. I’m referring to the PsiViewer at https://www.jetbrains.com/help/idea/psi-viewer.html

  2. I am not writing a plugin. I am writing a separate external tool. I would like to somehow use the PsiViewer (while creating as little “IntelliJ IDEA Scaffolding” as possible).

  3. This is extending Kotlin Parser in Kotlin? as I am now trying to find a better way to visualize PsiElement / AST output.

  4. Does anyone have sample code for invoking the PsiViewer in an external tool?

Thanks!


#2

You are aware of the fact, that someone posted a link to a github doing exactly that in that topic?

Or am I to understand that you don’t want to have to import the import com.intellij.* namespaces or depend on the kotlin compiler? Well they are the place where the kotlin psi is defined so you will have to use them.


#3

@Wasabi375 : I am not sure we are discussing the same problem.

  1. My last post in the previous thread has code for parsing *.kt files into PsiElement tree. I am fine with using PsiElement.

  2. By PsiViewer, I am referring to the plugin https://plugins.jetbrains.com/plugin/227-psiviewer – I am NOT referring to the intellij psi classes.

  3. The previous thread linked to two github repos:
    https://github.com/arturbosch/detekt
    https://github.com/cretz/kastree

  4. My question is: Is there a way to invoke something like PsViewer without firing up the entireity of IntelliJ IDEA. Can I just run the single PsiViewer window ?

  5. (I may be wrong here). I think you think the question I am asking is concerning which libraries I need to import to parse kotlin. The question I am asking is: which libs I need to import / run in order to run-psiviewer.

  6. I believe these are two different questions.


#4

In a further attempt to clarify:

  1. The solution to the previous question ca run entirely in the Console. It requires no GUI.

  2. this question concerns: what is the ‘minimal gui shell’ needed to run the PSiViewer GUI tool.


#5

Sorry, my bad. I am not aware of any way of running intellij plugins outside of intellij. That being said the source for this plugin is at github: https://github.com/cmf/psiviewer/
It does not contain a license, so I’s ask the developer before copying and using parts of it.

I don’t think it is possible, but using the sources, you might be able to adapt it to use a different window system, but this will probably be a lot of work. Not sure though.


#6

Thanks for confirming that this is unlikely to be easy to do (this is also what I suspected). I’ll look for a different strategy.