Eclipse (ctrl+space) content assist hook

送分小仙女□ 提交于 2019-12-23 03:16:31

问题


I wrote a plugin that gets user input from Java editor, makes some computation, and writes the results to my view. The way I start the process of aforementioned computation is via context menu and I hate it. I would like it to start on ctrl+space, i.e. content assist. It is faster, more intuitive w.r.t. what the plugin does. Is there a way to do so?

Update: For example, what should I do to get the current cursor position when user presses ctrl+space? I would use that position info and print it to my view. This is the most simplistic plugin that I basically need.


回答1:


You could take part in the content assistent calculation of Ctrl-Space by extending javaCompletionProposalComputer. However, if you want to trigger some arbitrary modification operation on the Java file, you are better suited by providing a quick assist instead.

If you are confused by the terms: An example for quick assist is the suggestion "Invert if statement", which you can see when pressing Ctrl-1 with the cursor placed on an "if".



来源:https://stackoverflow.com/questions/12402860/eclipse-ctrlspace-content-assist-hook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!