sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
811 stars 39 forks source link

Fire an event when an autocomplete entry is selected - no other way to detect it from a mouse click if its a simple (non-command-callback based) completion #1166

Open keith-hall opened 8 years ago

keith-hall commented 8 years ago

Expected behavior

That clicking on an autocompletion entry would have the same behavior as pressing Tab to commit the entry, on all platforms, so that plugins can consistently respond to both events.

Actual behavior

Clicking on an autocompletion entry doesn't fire any command, although the text is correctly inserted into the document.

Steps to reproduce

  1. In the Sublime console, enter sublime.log_commands(True)
  2. Bring up autocomplete, notice the log shows auto_complete
  3. Highlight one of the entries using the arrow keys
  4. Press Tab, notice the console log shows commit_completion with "auto_complete_commit_on_tab": true and insert_best_completion with "auto_complete_commit_on_tab": false

  1. In the Sublime console, enter sublime.log_commands(True)
  2. Bring up autocomplete, notice the log shows auto_complete
  3. Click on one of the entries, notice the console log doesn't show anything extra - no command was fired

    Tried on

    • Operating system:
    • [X] Windows
    • [ ] Mac OS
    • [X] Linux
    • [X] 64 bit
    • [ ] 32 bit
    • Sublime Text Build:
    • branch:
    • [X] stable
    • [X] dev
    • number:
    • Build 3103 and 3109
FichteFoll commented 4 years ago

Likely the same underlying issue as https://github.com/sublimehq/sublime_text/issues/1834. Actually not, because the issue was closed mistakenly.

keith-hall commented 4 years ago

@deathaxe, on which platforms did you see this was fixed on? I tried on Linux, and still nothing is logged in the console with sublime.log_commands(True) and clicking on an autocomplete entry. And EventListener on_post_text_command/on_post_window_command methods aren't fired either.

keith-hall commented 4 years ago

(my particular use case is actually solved by being able to call an arbitrary command for my plugin's completions, but I wanted to check in case other people want this functionality but can't control the completions...)

deathaxe commented 4 years ago

I didn't realize it's about not publishing the commit_completion to plugins, but thought it is about clicking on auto completion items doesn't do anything at all.

keith-hall commented 3 years ago

In light of the comment at https://github.com/sublimehq/sublime_text/issues/4023#issuecomment-802809082, I'm going to change this issue from a bug to a feature request for clicking on an autocompletion entry to fire an event listener.