idea plugin openapi code set ide settings

已回答

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

0

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

请先登录再写评论。