Open Col-E opened 3 years ago
Some investigation:
Investigating if some third party library could be used
Most "Java code completion" libraries are implemented over LSP or are old and target javac
internal classes that are hidden within internal modules in JDK 9+.
What about JShell?
Works great for vanilla Java snippets and completions in that context, but in Recaf we'd like to be able to complete things like tha names of declared fields/members in the current class, or referenced classes. JShell could be given a classpath to operate off of, but given that we do NOT want to load the contents of stuff being looked at in Recaf this is not an option. Additionally, there seems to be no good way of completing for arbitrary offsets in full source texts, as the system is designed to only work off of single line snippets at a time.
What do some other applications do if they don't use either of these options?
I've seen some completely re-create their own Java parser model with custom lexers and AST models. I don't have that kind of time.
The assembler did a simple
String.startsWith(...)
and showed the firstN
results. If a user is referencing a function more often than others push that item up in the list using some basic weight scheme. I think this is similar to how IntelliJ's suggestions work too.