Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Ensure distinct static member completion candidates #201 #202
Conversation
Static methods such as String/valueOf have many overloads. Prior to this commit, the static-members function returned one completion candidate for each overload.
|
I'm guessing there might be a similar problem for instance methods as well. |
|
Hey folks, I am checking exactly that part in orchard now and a lot of work went into polishing that. I know this implementation is different but probably it is worth having a look there |
|
@arichiardi The code completion is actually in |
Forget about this. I saw your comment on #201 just now. |
| (for [member (concat (.getMethods class) (.getDeclaredFields class)) :when (static? member)] | ||
| (.getName ^Member member))) | ||
| (distinct | ||
| (for [member (concat (.getMethods class) (.getDeclaredFields class)) :when (static? member)] |
bbatsov
Jun 23, 2020
Contributor
Probably it's best to convert this to some ->> pipeline. Seems the author of the original code was quite fond of for, but I'm definitely more fond of map, filter and friends. :-)
Probably it's best to convert this to some ->> pipeline. Seems the author of the original code was quite fond of for, but I'm definitely more fond of map, filter and friends. :-)
eerohele
Jun 24, 2020
Author
Contributor
Yeah, I very rarely use for, too. I can certainly rewrite the function with ->>. Would you prefer that I do it in a separate commit?
Yeah, I very rarely use for, too. I can certainly rewrite the function with ->>. Would you prefer that I do it in a separate commit?
| @@ -45,6 +45,7 @@ | |||
| (candidates "java.lang.System/out"))) | |||
|
|
|||
| (is (some #{"String/valueOf"} (candidates "String/"))) | |||
| (is (every? #(= 1 %) (vals (frequencies (candidates "String/"))))) | |||
bbatsov
Jun 23, 2020
Contributor
Might be a good idea to add some helper named unique-candidates? and use it in the other completion tests as well.
Might be a good idea to add some helper named unique-candidates? and use it in the other completion tests as well.
eerohele
Jun 24, 2020
Author
Contributor
I can do that. I realized that I could just do (apply distinct? (candidates "String/")) instead, though.
I can do that. I realized that I could just do (apply distinct? (candidates "String/")) instead, though.
|
I pushed the changes you proposed as separate commits. I can squash them prior to the possible merge if necessary. (Fixed typos in commit messages afterwards.) |
7f221ec
to
6725957
6725957
to
375dd8c
|
Thanks! I'll push a new alpha now. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Static methods such as
String/valueOfhave many overloads. Prior to this commit, thestatic-membersfunction returned one completion candidate for each overload.