开发 jetbrains 插件的一些疑问
cli 会删除目标目录然后生成,怎么才能让 WebStorm 的配置文件还在?
具体来说就是
- WebStorm 创建了一个项目,并生成了一个初始的 .idea 配置目录
- cli 开始执行,检测到目录已存在,删除目录,重新生成文件
- WebStorm 检测到 .idea 配置目录被删除,项目无法正常索引
目前想到的一些解决方案是
- cli 本身支持覆盖式生成
- 在插件中将项目生成到临时位置,然后剪切到实际目录
第二种方案已经证明是可行的,仅需要覆盖 generateInTemp
函数即可
override fun generateInTemp(): Boolean {
return true
}
具体代码: https://github.com/rxliuli/vi...
另外有什么推荐的 JetBrains 插件开发者社群么?
还有一些其他的问题
如何在检测到项目目录不为空时自动清空它
在 generateProject 中执行 baseDir.delete(project)
会提示
Error executing task com.intellij.lang.javascript.boilerplate.NpmPackageProjectGenerator$$Lambda$2839/0x000000010225b440@c5cf50a
java.lang.NullPointerException: Parameter specified as non-null is null: method com.vite.cli.ViteCliProjectGenerator.customizeModule, parameter entry
at com.vite.cli.ViteCliProjectGenerator.customizeModule(ViteCliProjectGenerator.kt)
at com.intellij.lang.javascript.boilerplate.NpmPackageProjectGenerator.lambda$generateProject$6(NpmPackageProjectGenerator.java:351)
at com.intellij.javascript.nodejs.interpreter.download.NodeJsDownloadService.ensureInstalled(NodeJsDownloadService.java:40)
at com.intellij.lang.javascript.boilerplate.NpmPackageProjectGenerator.lambda$generateProject$7(NpmPackageProjectGenerator.java:344)
at com.intellij.openapi.project.DumbServiceImpl.doRun(DumbServiceImpl.java:403)
at com.intellij.openapi.project.DumbServiceImpl.updateFinished(DumbServiceImpl.java:395)
at com.intellij.openapi.project.TrackedEdtActivityService$TrackedEdtActivity.run(TrackedEdtActivityService.java:66)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:218)
at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:200)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:319)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:133)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:189)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:969)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
问题在于吾辈不知道应该在哪儿做这个操作
参考:https://intellij-support.jetb...
如何让 JBList
变成一个下拉选择框
怎么在生成项目后运行 npm/yarn install
找到一个函数 postInstall
,但一个提示已被废弃,另一个不知道在哪里可以让它执行
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论