Pergunta

In Eclipse the auto complete is very very strict. Is there a way to have it slightly looser? For instance:

getData()
setData()

I want to type "data", and have the two functions above be found but because both functions have "get" or "set" at the start, it doesn't suggest these functions, I have to type get or getD to finally be able to get it in the auto complete.

I was wondering if there was a setting to have it include 'any' functions that have the search term within it, not just starts with?

I have tried doing searches on Google, but without knowing the the terms I am only getting people asking for help saying 'its not working'. I just want to change from "startswith" to "contains"..

Foi útil?

Solução 2

Eclipse Neon (4.6)

Now Content Assist is more flexible:

autocomplete

The feature is described here:

Content Assist now supports substring patterns. Enter any part of the desired proposal's text, and Content Assist will find it! For example, completing on selection proposes all results containing selection as a substring.

Outras dicas

The Eclipse Code Recommenders project includes subwords completion which seems to be exactly what you are looking for.

Keep in mind that with the upcoming 2.1 release (together with Eclipse Luna on the 25th of June, 2014), the subwords completion is no longer activated by default. Go to Preferences > Code Recommenders > Completions and activate the Subwords-Completion Processor.

Unfortunately there is no preferences setting to enable or change that. There are several ways to tweak the behavior of Content Assist under Preferences > Java > Editor > Content Assist, such as enabling "camel caps" matching (eg, typing gD will findgetData()), but I see nothing about sub-string matching. It would be a good feature request, though. Please consider entering it in Eclipse's Bugzilla.

Even better with Eclipse 4.17 July 2020:

Substring/Subword matches for types

Content Assist now fully supports both substring and subword matches for types:

https://www.eclipse.org/eclipse/news/4.17/images/substring-types.png

Substring matches are always shown and subword matches can be enabled/disabled with the existing Show subword matches option on the Java > Editor > Content Assist preference page.

as @antoine martin mention.. I manage to incude the Code Recommenders by adding below plugin. Im using Eclipse 4.13. Here is the step

  1. Help > Install New Software

  2. add below URL and enter

    https://repo.eclipse.org/content/shadows/releases.unzip/org/eclipse/recommenders/stable/2.5.4/stable-2.5.4.zip-unzip/

  3. Select

  • Eclipse Code Recommenders
  • Eclipse Code Recommenders Developer Resource
  • Eclipse Code Recommenders Third-Party
  1. Accept, Install and restart.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top