Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Favorite imports #368

Closed
nik9000 opened this issue Nov 15, 2017 · 5 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#531
Closed

Favorite imports #368

nik9000 opened this issue Nov 15, 2017 · 5 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#531

Comments

@nik9000
Copy link

nik9000 commented Nov 15, 2017

I'd like something like Eclipse's "Favorites" features for imports. In particular I'd like to be able to say "I like these classes and these static methods so when I hit ctrl-. on an unimported class give me those options first if they match". This'd make imports a bit easier and static method imports much easier. I get that they are different things, but Eclipse sticks them together in its UI so I think of them as a single thing.

@nik9000 nik9000 changed the title Import favorites Favorite imports Nov 15, 2017
@ADTC
Copy link

ADTC commented Dec 19, 2017

(Below comment was opened as a new issue #424)

I'd be happy if the menu is sorted in a more sensible manner. Right now it looks so random and messy. It doesn't even look like a lexicographic sort. And it's hard to look for the correct import when the menu is very lengthy. 😞

unsorted random list of import and change to suggestions

Can it be sorted so that all the "Import" suggestions appear on top? Followed by "Change to", because more often than not, the class name is correct and I don't need to change it, I just need to import it. And within each type of suggestion, sorting could be lexicographic by default but also any recent/plausible imports or favorites could bubble to the top (within the type).

Related: #56

@fbricon
Copy link
Collaborator

fbricon commented Jan 24, 2018

@snjeza can you please see if we can add the equivalent of
screen shot 2018-01-24 at 11 38 06 am

via a server preference like:

	"java.completion.favoriteMembers": [
		"org.junit.Assert.*",
		"org.junit.Assume.*",
		"org.junit.jupiter.api.Assertions.*",
		"org.junit.jupiter.api.Assumptions.*",
		"org.junit.jupiter.api.DynamicContainer.*",
		"org.junit.jupiter.api.DynamicTest.*"		
	]

The .* suffix seems to be just for show in Eclipse UI, we could very well ignore it.

My main concern about this feature is if relies too much on jdt.ui, then it'll be harder to port to jdt.ls.

@fbricon
Copy link
Collaborator

fbricon commented Jan 24, 2018

@ADTC can you please open a separate bug report, proposal sort order/relevance is a bit of a different matter.

@ADTC
Copy link

ADTC commented Jan 30, 2018

@fbricon Done with #424

@fbricon
Copy link
Collaborator

fbricon commented Jan 31, 2018

New java.completion.favoriteStaticMembers preference allows you to define your favorite imports. Default values are:

	"java.completion.favoriteStaticMembers": [
		"org.junit.Assert.*",
		"org.junit.Assume.*",
		"org.junit.jupiter.api.Assertions.*",
		"org.junit.jupiter.api.Assumptions.*",
		"org.junit.jupiter.api.DynamicContainer.*",
		"org.junit.jupiter.api.DynamicTest.*"		
	]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants