编写 Intelli-J 检查?
我将如何编写自己的 Intelli-J 检查?我正在寻找一些一般指南或资源。
我想在每次手动实例化集合类时提出检查提示,而不是按照团队范围通过 Guava (List.newArrayList()/Maps.newHashMap()
) 等标准。
我会很感激任何方向。
How would I go about writing my own Intelli-J inspection? I'm looking for some general guides or resources.
I want to bring up an inspection hint every time a collection class is instantiated manually, rather than through the Guava (List.newArrayList()/Maps.newHashMap()
) etc. as per a team-wide standard.
I'd appreciate any direction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于这样的检查,您不需要编写插件,而是使用 结构搜索和替换(SSR)功能,允许通过快速修复创建自定义检查。
另请参阅创建您自己的检查部分和此功能的文档。
请注意,它仅在终极版本中可用。
For such an inspection you don't need to write a plug-in, instead use the Structural Search and Replace (SSR) feature which allows to create custom inspections with quick fixes.
See also the Creating your own inspections section and documentation for this feature.
Note that it's available in the Ultimate version only.
我不得不让您失望,但与插件和 IntelliJ 相关的几乎所有内容都没有书面指南、资源或文档:(。
(这是许多 IntelliJ 粉丝没有为他们最喜欢的工具开发插件的主要原因)。
该公司制造了出色的产品,但是当涉及到开发人员(而不是用户)的文档、书籍和指南时,它们几乎不存在:(。
您唯一的选择是查看实际 IntelliJ 插件的源代码-ins(其中一些在这里:http://git.jetbrains.org/)并询问非常关于 IntelliJ 插件列表的具体问题,开发团队通常会很乐意回答您几分钟之内。
I'll have to disappoint you but there are no written guidelines nor resources nor documentation for almost everything related to plug-ins and IntelliJ :(.
(this is the main reason many IntelliJ fans haven't worked on plug-ins for their favorite tool).
That company makes fantastic products, but when it comes to documentation, books, and guidelines for developers (not users) - well, they're practically non-existing :(.
Your only bet is to take a look the source of actual IntelliJ plug-ins (some of them are here: http://git.jetbrains.org/) and ask very concrete questions on the IntelliJ plug-in list since the development team will gladly answer you usually in a matter of minutes.