postStartupActivity is working in development environment, but not after deployment

I have a postStartupActivity set up like this in the plugin.xml for the built-in Markdown plugin:

  <extensions>
    <!-- ... -->
    <postStartupActivity implementation="org.intellij.plugins.markdown.ui.preview.jcef.CodeFenceLanguageParsingSupport"/>
  </extensions>

Which calls this:

class CodeFenceLanguageParsingSupport : ProjectActivity {
  override suspend fun execute(project: Project) {
  // ...

The above is working just fine when I’m running Intellij Community from the development environment. My plugin changes work great. But when I deploy the plugin, using it my copy of Ultimate, the above execute method never gets called.

I should elaborate on what I mean by deploy, in case that has anything to do with the problem.

I build the markdown.jar file in the development environment using the “Build IDEA Community Installers (current OS)” configuration, then replace the markdown.jar that comes bundled with the Ultimate Edition so I can test my changes there, rather than being limited to seeing how my plugin changes perform in the Community Edition.

I have a workaround for now, but I’d really like to know why my postStartupActivity isn’t working and fix that instead.

Why are you doing it so strange? Why not just build a normal plugin on top

Because I have no idea how to handle an already built-in plugin that way.

But why do you need such bizarre process in the first place ?

But why do you need such bizarre process in the first place ?

Maybe I don’t.

I hope you understand that for me, however, as an outsider coming into the huge IntelliJ codebase, the best way to do things isn’t always going to be readily apparent.

If the code for the Markdown plugin exists as an independent project, separate from the full IntelliJ Community Edition project, I’d gladly work with that instead. I haven’t been able to find such a separate project like that on GitHub among JetBrain’s public repositories.

If it’s there as a separate repo for just the Markdown plugin, please do point the way!

From within the IntelliJ Community Edition project, I haven’t found a way to build just the Markdown plugin by itself, and I only know how to build the plugin as a .jar file, not as an individually installable .zip file like when working on an independent plugin project.

I’m definitely no expert on how the build system works such that I could easily whip up my own build process for just the Markdown plugin alone.

As an outsider to your company, I don’t have access to the Ultimate Edition code, only the Community Edition. The only way I’m currently aware of to test how my Markdown plugin changes work with the Ultimate Edition is the admittedly hacky .jar file transplant that I’m currently performing.

Again, if there’s a better way, I’m all ears.

But what you are trying to achieve with building Markdown plugin? What tasks you need to solve?

First of all, I hope this conversation doesn’t get too sidetracked from my original postStartupActivity issue. I’d still like to try to solve that.

However, what I’m trying to achieve is adding features and fixing bugs in the Markdown preview.

The current issue I’m trying to figure out now is how to make the synced scrolling work better, because I’ve found with some Markdown documents that the scrolling of the preview can be way, way off from the current editing position.

I started out with adding GitHub-style formatting and syntax coloring, done in a way that goes well beyond what simply adding custom CSS can accomplish. (As is, the GitHub plugin uses syntax colors from the user’s current IDE theme, hard-coded as per-span styles, not CSS classes which can be overriden.)

I’ve also added the ability to double-click inside the preview and move the editor to the position where you double-clicked.

I have no idea, of course, if JetBrains will be interested in any of what I’m doing once I’m ready to submit a PR. But, if not, I’ll then take the step of figuring out how to spin this stuff off as an entirely independent plugin (if I can figure out how to make a separate plugin override what the built-in plugin is doing.)

And I can at least have my desired features for myself, even if no one else wants them. :relieved_face:

The features look really good! We would be happy to review such and it all looks rather interesting to have out of the box.

Most likely the issue you have is the problem with JAR layout, when you replace JAR manually you break some caches of the content dispositions and code does not get loaded properly. I’d suggest installing plugin from disk instead of replacing JAR.

The cache we have is in plugins/plugin-classpath.txt of the installation directory.

I’d suggest installing plugin from disk instead of replacing JAR.

I wasn’t sure if the usual way of loading a plugin from disk would even work for a .jar file (as opposed to the .zip files normally used), or what sort of weird conflict might occur trying to replace or override a built-in plugin.

Nevertheless, given your suggestion, I decided to give this a try:

And, for now, all I got was…

…so I’ll have to change the branch I’m working with to get further trying this out.

You can also mock the compatible build via Registry… action.

Search by words build and compatible.

1 Like

I’ve finally gotten all my code changes in good shape for a PR: Markdown Preview enhancements and bug fixes by kshetline · Pull Request #3039 · JetBrains/intellij-community · GitHub