如何在IntelliJ中提出自定义自动完成建议? [英] How do I make a custom autocomplete suggestion in IntelliJ?

查看:128
本文介绍了如何在IntelliJ中提出自定义自动完成建议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想给intellij的对象名称自动完成功能添加一个建议.当前,当自动补全一个类的实例的名称时,它只是自动补全为该类的名称,但使用小写形式.

I want to make add a suggestion to intellij’s autocomplete to object names. Currently when autocompleting a name of a instance of a class it just autocompletes to the class name but in lower case.

ExampleObject exampleObject;

有时,这会导致需要一些时间来跟踪错误的错误.我发现这另一种命名约定通常应该更好用.只需在类名的前面添加"a",通常就可以更清楚地看到哪个是对象,哪个是类.例如

This has sometimes causes bugs that take some time to track down. I found this other naming convention that often should work better. Just by adding ‘a’ infront of the class name, it often is much clearer which is the object and which is the class. E.g

ExampleObject aExampleObject;

我稍微浏览了一下设置,但找不到足够的设置来完成此操作.它很小,但我认为这将是不错的选择".任何帮助都很好.

I’ve looked through the settings a bit but couldn’t quite find the setting to do this. It’s something small, but i think it will be a "nice to have". Any help on this would be nice.

谢谢.

推荐答案

您可以在P 引用中定义字段的前缀和后缀,局部变量等.编辑器代码样式| Java |代码生成窗格:

You may define prefixes and suffixes of fields, local variables etc in Preferences | Editor | Code Style | Java | Code Generation pane:

这篇关于如何在IntelliJ中提出自定义自动完成建议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆