Repository: spyder-ide/spyder

Issue:
Kite pop-up doesn't show up if Editor pane undocked
Kite works fine if Editor pane docked (see Picture 1). If I undock the Editor pane and move to another monitor (let's say the "Vertical Right" monitor you see on Picture 1), Kite's pop-up window will not show up. You can see on Picture 2 an example of the issue (i.e. the absence of Kite's pop-up window).

I also observed that some shortcuts don't work if the Editor pane is undocked and on another monitor. For instance, if the cursor is on the Editor pane when undocked, and I press F5, it will not run the file. I have to click on the Console pane first. Maybe both issues are interconnected?

PS: tagging @metalogical as requested (as I contacted Kite first about the issue)

### Picture 1
<img width="640" alt="Full screen" src="https://user-images.githubusercontent.com/57544001/70808051-dedeed00-1d8c-11ea-8f2f-84399e55dd93.png">

### Picture 2
<img width="316" alt="Kite not working" src="https://user-images.githubusercontent.com/57544001/70808071-e7cfbe80-1d8c-11ea-9729-86a05adbe0b3.png">



Discussion:
@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/api/plugins.py b/spyder/api/plugins.py
--- a/spyder/api/plugins.py
+++ b/spyder/api/plugins.py
@@ -523,3 +523,9 @@ def toggle_view(self, checked):
             self.dockwidget.raise_()
         else:
             self.dockwidget.hide()
+
+    def set_ancestor(self, ancestor):
+        """
+        Needed to update the ancestor/parent of child widgets when undocking.
+        """
+        pass
diff --git a/spyder/plugins/base.py b/spyder/plugins/base.py
--- a/spyder/plugins/base.py
+++ b/spyder/plugins/base.py
@@ -131,6 +131,7 @@ def __init__(self, plugin):
 
     def closeEvent(self, event):
         """Reimplement Qt method."""
+        self.plugin.set_ancestor(self.plugin.main)
         self.plugin.dockwidget.setWidget(self.plugin)
         self.plugin.dockwidget.setVisible(True)
         self.plugin.switch_to_plugin()
@@ -356,7 +357,7 @@ def _create_window(self):
         window.setCentralWidget(self)
         window.resize(self.size())
         self.refresh_plugin()
-
+        self.set_ancestor(window)
         self.dockwidget.setFloating(False)
         self.dockwidget.setVisible(False)
 
diff --git a/spyder/plugins/editor/plugin.py b/spyder/plugins/editor/plugin.py
--- a/spyder/plugins/editor/plugin.py
+++ b/spyder/plugins/editor/plugin.py
@@ -1103,6 +1103,22 @@ def update_font(self):
                 comp_widget.setup_appearance(completion_size, font)
                 kite_call_to_action.setFont(font)
 
+    def set_ancestor(self, ancestor):
+        """
+        Set ancestor of child widgets like the CompletionWidget.
+
+        Needed to properly set position of the widget based on the correct
+        parent/ancestor.
+
+        See spyder-ide/spyder#11076
+        """
+        for editorstack in self.editorstacks:
+            for finfo in editorstack.data:
+                comp_widget = finfo.editor.completion_widget
+                kite_call_to_action = finfo.editor.kite_call_to_action
+                comp_widget.setParent(ancestor)
+                kite_call_to_action.setParent(ancestor)
+
     def _create_checkable_action(self, text, conf_name, method=''):
         """Helper function to create a checkable action.
 


Test patch: