Get rid of that silly space eclipse generates when you open an EL expression

雨燕双飞 提交于 2019-12-04 02:38:04

You can disable the auto-close-brace:

Create XML like

<?xml version="1.0" encoding="UTF-8"?>
<profiles version="1">
<profile name="customStyle" version="1">
<setting id="org.eclipse.jdt.core.formatter.yourMatchingConstant" value="do not insert"/>
</profile>
</profiles>

Find your constant in Default code formatter constants of eclipse Replace yourMatchingConstant in above XML file with found.

Then import this XML in Preferences --> Java --> Code Style --> Formatter

Usually this means that the preference to eliminate space when completing the bracket is not provided by the developer of the plugin that validate EL expression.

If it really bothers you to have space by default, there are 2 things you may try to do:

  1. Make a request on Eclipse's Bugzilla page (since WTP is not a third party plugin). It might be ignored, but worth a shot.
  2. Make a small tweak on your own: Look for the piece of code that handle the completion of brackets inside the jar, modify it so that it doesn't give space, and then compile and install the modified plugin on your IDE.

The drawback of #2 is that you will need to invest some time to tweak and could not always update WTP to the newest version (since it will override the tweak). But it is feasible.

Probably it's not the best option, but you can create a template like this:

Then, when you need to insert an EL expression, you can press Ctrl+Space, then $ and then enter; and you get an EL expression without spaces and the cursor inside the expression.

You can disable the auto-completion in Web --> JSP Files --> Editor --> Typing. You'll have to type the closing brace yourself, but it is probably better than deleting an errant space.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!