Listen to code completion events
已回答
Hi all! I’m conducting a user study on code completion behavior in IntelliJ. I’d like to listen to code completion events and collect their information, including:
- Triggered time
- Terminated time or duration
- Termination state (canceled, applied, timeout, etc.)
- The typed completion prefix
- The collection of proposals presented to the user
- The collection of proposals the user interacted with
- The selected/applied proposal and its index/order in the proposal list
- The completion contributor that each proposal originates from
- Other completion context and parameters are nice to have
I’ve looked through the list of listeners at https://plugins.jetbrains.com/docs/intellij/extension-point-list.html, but I couldn't find anything that meets my needs.
I later found `com.intellij.codeInsight.lookup.LookupListener`, which has most of the information I need. I’d love to know if I’m on the right track and how to get the other information.
Many thanks!
请先登录再写评论。
Hi,
Could you please clarify what information is missing after using
LookupListener?Of course. I added the `LookupListener` via the `com.intellij.codeInsight.lookup.LookupManagerListener#activeLookupChanged`. As of now, I’ve found the following information from `LookupListener`:
Since I submitted the question, I've found more things and I think mostly got what I needed. Please let me know if I have done it correctly or if there are better ways to get any of those. That said, I’m still looking for:
Hi,
Your approach looks good to me, but I also suggest checking classes in this package in the IntelliJ Community sources:
https://github.com/JetBrains/intellij-community/tree/master/plugins/stats-collector/src/com/intellij/stats/completion/tracker
I'm not sure all of your required data is covered or even possible (I had a brief look and could not find anything about contributor information and completion context/params).
Please also remember to not collect and send any data without an explicit user's consent.
Of course! Explicit user consent is a must.
Also, thank you for the pointer. I’ll look into it.