Repository: spyder-ide/spyder

Issue:
Kite autosearch docs not working on mouse events
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

## Problem Description

With Kite enabled, docs are not automatically displayed in the Kite Copilot on mouse events. However, docs are automatically displayed on keyboard (e.g. arrow key) events.

### What steps reproduce the problem?

1. Open the following file:
```python
import pandas as pd
df = pd.read_csv('csv')
```
2. Open the Kite Copilot and enable "Docs Follow Cursor".
3. In the file above, try clicking on different identifiers e.g. `panads` or `read_csv`.

### What is the expected output? What do you see instead?

__Expected:__ Docs should show up automatically in the Copilot.
__Actual:__ Nothing happens. However, if you use the arrow keys to move the cursor, docs are updated.

![spyder-autosearch-bug](https://user-images.githubusercontent.com/3752225/66146075-e598f900-e5c0-11e9-84ed-18890b1da44a.gif)

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: Spyder 4.0.0.dev0 (Commit: e362c9525) 
* Python version: Python 3.7.3 64-bit
* Qt version: Qt 5.9.6
* PyQt version: PyQt5 5.9.2
* Operating System name/version: Darwin 18.7.0 

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.4.2 (OK)
qtconsole >=4.5.5            :  4.5.5 (OK)
nbconvert >=4.0              :  5.5.0 (OK)
sphinx >=0.6.6               :  2.1.2 (OK)
pylint >=0.25                :  2.3.1 (OK)
psutil >=0.3                 :  5.6.3 (OK)
qtawesome >=0.5.7            :  0.5.7 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.5.0;<2.0.0:  1.5.0 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  None (NOK)
cython >=0.21                :  None (NOK)
IPython >=4.0                :  7.8.0 (OK)
matplotlib >=2.0.0           :  None (NOK)
pandas >=0.13.1              :  None (NOK)
numpy >=1.7                  :  None (NOK)
scipy >=0.17.0               :  None (NOK)
pyls >=0.28.2;<0.29.0        :  0.28.3 (OK)
rtree >=0.8.3                :  0.8.3 (OK)
```



Discussion:
We're not relaying mouse events, aka textDocument/hover requests to Kite
@andfoy, please take a look at this one.

Resolving patch:
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -1580,6 +1580,7 @@ def __cursor_position_changed(self):
         """Cursor position has changed"""
         line, column = self.get_cursor_line_column()
         self.sig_cursor_position_changed.emit(line, column)
+
         if self.highlight_current_cell_enabled:
             self.highlight_current_cell()
         else:
@@ -4035,6 +4036,11 @@ def mousePressEvent(self, event):
         else:
             TextEditBaseWidget.mousePressEvent(self, event)
 
+    def mouseReleaseEvent(self, event):
+        """Override Qt method."""
+        self.document_did_change()
+        TextEditBaseWidget.mouseReleaseEvent(self, event)
+
     def contextMenuEvent(self, event):
         """Reimplement Qt method"""
         nonempty_selection = self.has_selected_text()


Test patch: