Content assist without choosing in Eclipse - eclipse

Is there a way, like some key binding or some settings, to make the content assist to choose the best match one, or the first one, without showing the window? It's always faster when only one choice is available, like
many other IDE has done so.

See this blogpost
Short summary:
Rename the content assist tag that is triggered to something unique (blog author changed "test" to "tst") and change the template to have auto-insert enabled.
When your template is the only choice, it will then be autoinserted.

No. It would require multiple keybindings ala Intellij IDEA, and Eclipse has only notion of "content assist" which is used for autocompletion of everything that could be useful when you invoke it.
Besides, "best match" sounds to me like it would be very annoying, since IDE's best guess might not be your best guess.

Related

Disable IDE auto format command

I have a code base that many developers work on. Some people blindly use auto format in their IDE and mess up the formatting of sql statements or other things. It appears that some IDE's like eclipse do have the ability to use //#Formatter:off (which I have put around many things I do want to not get formatted), but by default these are ignored. Thus, is there a way to either enable the setting so that will be used by default, or is there a way to disable any shortcut key linked to auto format using some sort of maven plugin? Basically I am looking for a way to enforce this for anyone who is working on the codebase since everyone can change their own formatter settings.
I found https://code.revelc.net/formatter-maven-plugin/format-mojo.html, but I dont think it can do either of those things.
Thanks in advance!

Eclipse autocomplete parentheses in control structures

I have a quick question that might save me a few seconds of annoyance every day. I know that eclipse can do a lot of autocomplete magic, so this might be possible:
As a programmer who learned with python, I constantly forget to surround contitions in control structures (like if or while) with parentheses. How do I make eclipse autocomplete opening and closing parentheses when I finish typing while or if?
I am aware that I can autocomplete whole structures with ctrl-space, but how can I configure eclipse to do this by itself?
Any help is appreciated.
So in stock Eclipse, the usual way to bring up assisted content is to type Ctrl+Space. The problem with this is that it brings up both Help Proposals and Template Proposals, with the Help Proposals displayed first. You end up wasting time scrolling down to find what you actually want from the Template Proposals. And there's just that much more clutter to choose from.
The solution is this:
Go Window->Preferences->General->Keys. In the type filter text search for "Template". This should bring up a "C++ Content Assist (Template Proposal)" line. Click on it. Now map this to whatever shortcut you'd like (I did Shift+Space because that's an easy one to do while typing). Make sure to click on the "Binding" option to do this. Click "Ok" and you're done!
If you ever want to add or change what is brought up by that shortcut, and for which specific strings it works, just go Window->Preferences->C/C++->Editor->Templates and you can edit those to do exactly what you'd like when using that newly assigned shortcut.
Hope this helps.
EDIT: I am unable verify if this works for PyDev, as I'm running Eclipse Oxygen, which doesn't currently offer PyDev or the Eclipse Marketplace Client plugin. However, my guess is this would still work in PyDev. Best of luck!
Sources:
Setting auto complete shortcuts in Eclipse
How to change the Control+Space autocomplete shortcut keys in Eclipse for Android
Thanks for any help, but the only thing that seems to work are workarounds. My prefered "solution" is to change the Auto activation triggers for Java in Preferences>Java>Editor>Content Assist from . to .iwfs, so that the autocomplete dialog automatically pops up when I start typing if, while, for or switch. Then hitting enter will do exactly what I needed.

Automatically insert first choice in Eclipse content assist

One thing I like about Visual Studio is that you can automatically insert the first choice of the content assist instead of pressing Ctrl+Space and then choose the first option from the menu.
Is there a similar way to map a special key combination to always insert the first choice in Eclipse ?
If such option is not a native option in Eclipse, is there a plugin for that ?
I have seen a similar question in SO : Content assist without choosing in Eclipse but the solution suggested there was to rename the content assist tag that is triggered to something unique, I'm looking for something that works for everything.
Nope auto-insert only works when there is only one choice.
You may open an enhancement request for this feature against JDT/Text - https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT

Show whitespace in Eclipse for specific editors/file types

I know how to turn on white-space visualization wholesale but I would like to turn it on ONLY for specific file types - say *.mf files. Anyone know how to do this?
Right now, this doesn't seem to be fully supported.
This was "vehemently" asked in 2010:
Can we consider that the global approach:
all text editors show whitespace characters or not"
is COMPLETELY wrong ?
NO (I hope the big letters make it easier for you to get it ;-)
Now having said that, every editor (type) can decide to override the default options by either, always enable/disable them or by adding additional options.
If you need this from e.g. the CDT editor then you should file a bug report there. If you desire to set this per editor (or rather content type) then please file a new enhancement request. This bug will not deal with this.
Hence the current enhancement request "bug 321439 'Allow whitespace options per content type'.
(and not too many volunteers to tackle said request)

How can I get block comment hotkey functionality when editing *.ftl files in Eclipse?

Trying to edit Freemarker Templates in Eclipse, and going nuts because I have some inline Javascript that I'm creating on the fly, and can't easily comment / uncomment multiple lines at a time.
I've tried the following:
expanding the scope of the "toggle comment" behavior (to things like "Editing Text", or "In Windows") - has no effect
installing the official Freemarker eclipse plugin (both 1.0 and 1.1) - has absolutely no effect that I can see, other than appearing under "Preferences ... File Associations"
associating the .ftl extension with other types of editors - HTML, JavaScript, 3rd party - all these have absolutely no effect that I can see
Is there a way I can tell if Eclipse is even honoring my file associations? How do I know, for sure, which Editor is being used? I know when a Java file is being edited, I see additional pulldown menus (Source, etc.) - is there any other diagnostic way to figure out what's going on?
Any help is appreciated.
I know this isn't what you want to hear, but the Freemarker support in IntelliJ IDEA is really great.
Unfortunately, it isn't part of the free Community Edition, so you have to get the Ultimate Edition to benefit from it. But you can try it out for 30 days for free.
No, I am in no way associated with JetBrains, just a happy user.