idea plugin openapi code set ide settings

Answered

When i use webstorm, I hope force enable idea > settings > "eslint" and "prettier", I need use openapi code to set settings on startup

1 comment
Comment actions Permalink

I find the solution

most configuration is declare in .xml with

projectService and the projectService implementation is .*Configuration

in my case, prettier configuration is following (eslint is similar)

<projectService serviceImplementation="com.intellij.prettierjs.PrettierConfiguration"/>

I use following code get prettier conf instance

make my plugin support import PrettierConfiguration(if not, ide can import but it raise "no such class" , in plugin xml

intellij.prettierJS is prettier plugin id in prettier plugin xml

<depends>intellij.prettierJS</depends>

and then get conf

def prettierConf = project.getService(PrettierConfiguration)

prettierConf.state is conf in settings, default is null

how to set state?

open sandbox ide settings ui > maunally set expected settings

set breakpoint in prettierConf, ide "Watches" see prettierConf.state

use code set same state

 

0

Please sign in to leave a comment.