Add contribution points for completion customization#2110
Add contribution points for completion customization#2110testforstephen merged 3 commits intoeclipse-jdtls:masterfrom
Conversation
|
This could be abused to some extent if multiple plugins decide to take control. I would have liked to see some kind of extension point contribution where plugins can contribute their relevance score (or sorter), and ultimately let JDT-LS decide. A score is a bit nicer than just a sorter, because with a score the result can be combined. I'll have a closer look at this. |
|
For better designing the API, let me briefly introduce how IntelliCode (probably the first consumer of this contribution point) ranks the items. To make smarter ranking, it needs to know context information of the triggerred postion (including AST, bindings etc.). Besides, extra info is appened (using item.command.args) to items for diagnosic use, (e.g. elapsed time of the completion, ranking of each item...) That's why it interferes in an early stage, ranking the CompletionProposals before converting them to CompletionItem. For clearer and easier implementation, IntelliCode has below requirements:
|
|
@Eskibear Thanks for sharing the context. I'll propose a more general one later. |
This comment was marked as outdated.
This comment was marked as outdated.
|
@testforstephen This is the PR to open a contribution point for completion ranking. |
0214b2c to
92c5cca
Compare
|
@Eskibear @testforstephen I've updated the PR per our discussion about the APIs |
|
@rgrunber Feel free to take a look. I think the latest change should address the comment about |
|
Tested b397c2c , migrating intellicode-java with the new API. so far so good. |
- Extension contributors can call JavaLanguageServerPlugin.getCompletionRankingService() to get the ranking service, which is used to register and un-register the completion ranking provider. - Extension contributors can implement the ICompletionRankingProvider which contributes scores/label prefix/addition data for each completion proposal. - JDT.LS will aggregate all the ranking results from the ranking providers. Signed-off-by: Sheng Chen <[email protected]>
b397c2c to
7105880
Compare
|
The last change I would like to make is to rename @rgrunber @fbricon @snjeza Feel free to leave comments if you have any. If everything looks good, I will start to add test cases. |
Signed-off-by: Sheng Chen <[email protected]>
917a5fe to
1f3cc6b
Compare
testforstephen
left a comment
There was a problem hiding this comment.
Just one small comment about API naming. If no one else has any further comments, I think this PR is ready to be merged.
Signed-off-by: Sheng Chen <[email protected]>
a37ec88 to
f151711
Compare
This PR adds a set of contribution points which allows JDT.LS plugins(for example: intellicode) participate into the completion processing - mostly the ranking stuff.
With this PR, intellicode will not need to redirect the completion requests anymore, instead it can have the chance to use its own ranking algorithm during completion processing.
Signed-off-by: sheche [email protected]