Develop IntelliJ Plugin

Hi all,

It’s my first time posting here so sorry if I’m doing it wrong :smiley:

I’m trying to develop a IntelliJ plugin for check some stuff on code coverage results, I don’t find a good documentation about IntelliJ SDK neither ChatGPT wrote good insights, do you have a up to date documentation, samples? It’s very hard to find information about how to develop plugins, how to test it.

Thank you :blush:

1 Like

Hi, the documentation is available here: IntelliJ Platform SDK | IntelliJ Platform Plugin SDK.

If things you need are not there, please let us know via the Feedback widget at the bottom of the pages (“Was this page helpful?”, click No and describe what’s missing).

If you have any specific questions about code coverage, please describe the use case you want to implement.

1 Like

My guess is that the coverage portion of the SDK isn’t going to be well-covered – if at all – in the current documentation. I think it’s something that only a handful of plugin devs have had to mess with, though I’m in that group and am happy to help if I can.

Are you looking to integrate a coverage engine or rather to consume and process information from an existing coverage engine? I agree that undertanding your use case(s) will help tremendously in being able to provide guidance.

Hello Scott, thank you for your help!

When you have some complex ifs, like if( a() || b() || c() && d()) in coverage mode with tracing actived, you can see only the branches but you don’t know which if your test passed, my idea is to add more information on this part and show the coveraged code with branches and with If that has been tested.

Did you get it my idea?

I think I do. If so, it sounds like you’re wanting to show (more?) details for branch coverage. That’s not something I’ve implemented for my coverage engine integration because it only supports line-level coverage, but the Java coverage engine does support it, at least in some form, e.g.:

However, I think it only shows that a given line has partial coverage and not explicitly which subsets of that line were executed vs. which weren’t, e.g.:

image

Assuming that you have the information available to know which subsets of the line itself to highlight as covered vs. uncovered, that would likely be completely customer since, to my knowledge, the IDE’s coverage overlay is primarily based on showing gutter line marker information and not inline information.

You might be able to add inlay hints that are visible while coverage is showing for partially-covered expressions. To do that, you might register a CoverageSuiteListener that will be called each time a coverage suite is displayed or closed and show your additional information for the selected suite when available and hide it when not available.

I know that’s not as concrete as you might like, but it’s a brain dump of how I’d approach this, at least initially. Hope it helps!

Hello,

Than you for your inputs, my issue is I dont know if I can get all these informations about branches and ifs tested. This is what I’m trying to find but the docs is not good :smiley:

That’s going to vary based on the actual coverage engine implementation. BaseCoverageSuite does include an isBranchCoverage() method to determine whether or not a given suite includes branch coverage information, but I think how that gets implemented and used will be specific to the implementation.

Your best bet is to use the debugger when showing coverage for your specific use case to determine what information is available and, more importantly, how/where it’s available, and then determine whether or not you can even get to that information at runtime.