DjLeChuck
(Vivien De Bona)
February 9, 2026, 4:47pm
1
Hi,
First, I’m totaly new about plugin development ecosystem, sorry if I misunderstand some points.
I’m making an internal plugin for our company in which I check used Code Style scheme and Inspections profile.
In order to detect usages I have this code:
Code Style
return CodeStyleSchemes.getInstance().currentScheme.name == SCHEME_NAME
Inspection
val projectProfileManager = InspectionProjectProfileManager.getInstance(project)
val currentProfile = projectProfileManager.currentProfile
return currentProfile.name == PROFILE_NAME
My code runs inside an invokeLater
ApplicationManager.getApplication().invokeLater {
checkAndInstallSchemes(project)
}
My problem is with the Inspection profile, when my code is executed it seems the IDE hasn’t yet fully load the configuration and currentProfile is Default instead of my custom one.
In the settings, my custom profile is selected and in .idea/inspectionProfiles/profiles_settings.xml the content seems good:
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="My custom application Profile" />
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
NB: It’s an application Profile, not a project one.
Can someone explain me what’s wrong? I guess it’s a question of timing before running my code, or a totaly wrong approach in the detection.
Where do you start this code? Is it ProjectActivity or some other extension point?
DjLeChuck
(Vivien De Bona)
February 16, 2026, 1:35pm
4
Hi,
Did someone has an idea please?
jansorg
(Joachim Ansorg)
February 16, 2026, 1:48pm
5
Try com.intellij.application.options.codeStyle.CodeStyleSchemesModel#getSelectedScheme if it provides better values
DjLeChuck
(Vivien De Bona)
February 16, 2026, 2:19pm
6
@jansorg thank you for your anwser!
Correct me if I’m wrong, but this is for Code Style , not Inspection Profile right?
However, if it’s better than using CodeStyleSchemes.getInstance().currentScheme.name, I will change it anyway!
jansorg
(Joachim Ansorg)
February 16, 2026, 3:48pm
7
Yep, sorry, that was about the code style. In my experiments, that provided a more reliable value for application code style profiles. But please do your own testing.
Regarding inspection profiles, I only had a quick look at this. I’m not sure if this is correct.
intellij-community/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt at c8cba92f81ec5a85efacae0e407995955e12ac70 · jansorg/intellij-community · GitHub loads the initial state, if I’m not mistaken.
It’s even posting an event, project.messageBus.syncPublisher(ProfileChangeAdapter.TOPIC).profilesInitialized(). Instead of running an activity, I’d listen to ProfileChangeAdapter.profilesInitialized in a project event listener.
2 Likes