# How to detect used code style/inspection schema?

**URL:** <https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671>\
**Category:** IntelliJ Platform\
**Tags:** api, plugin-development\
**Created:** [February 9, 2026, 4:47pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671 "2026-02-09T16:47:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DjLeChuck](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/djlechuck/32/2561_2.png) [@DjLeChuck](https://platform.jetbrains.com/u/DjLeChuck)\
**Post date:** [February 9, 2026, 4:47pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/1 "2026-02-09T16:47:23Z")

</div>

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**

```kotlin
return CodeStyleSchemes.getInstance().currentScheme.name == SCHEME_NAME

```

**Inspection**

```kotlin
val projectProfileManager = InspectionProjectProfileManager.getInstance(project)
val currentProfile = projectProfileManager.currentProfile

return currentProfile.name == PROFILE_NAME

```

My code runs inside an `invokeLater`

```kotlin
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:

```xml
<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.

---

<div class="post-metadata">

**Author:** ![yuriy.artamonov](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/yuriy.artamonov/32/48_2.png) [@yuriy.artamonov](https://platform.jetbrains.com/u/yuriy.artamonov)\
**Post date:** [February 9, 2026, 5:55pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/2 "2026-02-09T17:55:10Z")

</div>

> [@DjLeChuck](#):
>
> `ApplicationManager.getApplication().invokeLater {`

Where do you start this code? Is it `ProjectActivity` or some other extension point?

---

<div class="post-metadata">

**Author:** ![DjLeChuck](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/djlechuck/32/2561_2.png) [@DjLeChuck](https://platform.jetbrains.com/u/DjLeChuck)\
**Post date:** [February 9, 2026, 6:09pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/3 "2026-02-09T18:09:32Z")

</div>

Inside `ProjectActivity`!

---

<div class="post-metadata">

**Author:** ![DjLeChuck](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/djlechuck/32/2561_2.png) [@DjLeChuck](https://platform.jetbrains.com/u/DjLeChuck)\
**Post date:** [February 16, 2026, 1:35pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/4 "2026-02-16T13:35:46Z")

</div>

Hi,

Did someone has an idea please? 🙂

---

<div class="post-metadata">

**Author:** ![jansorg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/jansorg/32/52_2.png) [@jansorg](https://platform.jetbrains.com/u/jansorg)\
**Post date:** [February 16, 2026, 1:48pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/5 "2026-02-16T13:48:09Z")

</div>

Try `com.intellij.application.options.codeStyle.CodeStyleSchemesModel#getSelectedScheme` if it provides better values

---

<div class="post-metadata">

**Author:** ![DjLeChuck](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/djlechuck/32/2561_2.png) [@DjLeChuck](https://platform.jetbrains.com/u/DjLeChuck)\
**Post date:** [February 16, 2026, 2:19pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/6 "2026-02-16T14:19:11Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![jansorg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/jansorg/32/52_2.png) [@jansorg](https://platform.jetbrains.com/u/jansorg)\
**Post date:** [February 16, 2026, 3:48pm UTC](https://platform.jetbrains.com/t/how-to-detect-used-code-style-inspection-schema/3671/7 "2026-02-16T15:48:00Z")

</div>

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](https://github.com/jansorg/intellij-community/blob/c8cba92f81ec5a85efacae0e407995955e12ac70/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt#L103) 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.
