How to show the welcome markdown file in editor when plugin is installed?



I'm trying to display a welcome markdown page on the editor when the plugin is installed using <postStartUpActivity>

Using TextEditorWithPreview.openPreviewForFile to display the markdown page in the editor on project startUp.

But, openPreviewForFile is shown as "Unresolved reference"

Is there any alternate that I can make use of to display the markdown page, when plugin is first installed?


Bellow is the code snippet which I'm using.

<postStartupActivity implementation=""/>
class welcomePage: StartupActivity.DumbAware {
override fun runActivity(project: Project) {
val welcomeText = String(javaClass.getResourceAsStream("/Welcome/").readAllBytes())
val welcomeFile = LightVirtualFile("Welcome Page", welcomeFile)
invokeLater {
TextEditorWithPreview.openPreviewForFile(project, welcomeFile)
Comment actions Permalink

Probably you're compiling against older version of IDE platform where the method does not yet exist.

On another note, forcing users to read page on project load is quite disruptive, I'd suggest to show notification with possibility to open such page if user wishes to do so.

Also consider using RunOnceUtil

Comment actions Permalink

Is there a way, to get the markdown file as a virtual file using the path?

I have created a markdown file in plugin project structure, But when I'm trying to get the file it gives me "null"

Comment actions Permalink

I think previous approach with LightVirtual is fine and should work.


Please sign in to leave a comment.