Repository: spyder-ide/spyder

Issue:
No call tips when 'Automatic insertion of parentheses, braces and brackets' is unchecked
## Description of your problem

The call tips pop up doesn't work when auto brackets are disabled.  I didn't see anything in the basic debug

I found this out while testing jedi.  I thought I broke the call tips at first.  It might have something to do with #2810

**What steps will reproduce the problem?**

1. Uncheck 'Automatic insertion of parentheses, braces and brackets' in the editor advanced settings
2. type a function like `import numpy; numpy.ones(
3. call tips will not pop up

**What is the expected output? What do you see instead?**
The call tips should pop up

## Versions and main components

* Spyder Version:3.x and 3.02
* Python Version:3.5
* Operating system:linux


## Dependencies

Please go to the menu entry `Help > Optional Dependencies` (or
`Help > Dependencies`), press the button `Copy to clipboard`
and paste the contents below:

jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.1 (OK)
nbconvert >=4.0  :  4.1.0 (OK)
numpy >=1.7      :  1.11.1 (OK)
pandas >=0.13.1  :  0.19.0 (OK)
pep8 >=0.6       :  1.6.2 (OK)
psutil >=0.3     :  3.3.0 (OK)
pyflakes >=0.6.0 :  1.0.0 (OK)
pygments >=2.0   :  2.0.2 (OK)
pylint >=0.25    :  1.4.2 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.3.1 (OK)
sympy >=0.7.3    :  0.7.6.1 (OK)




Discussion:
@mariacamilaremolinagutierrez, please work on this one.

Resolving patch:
diff --git a/spyder/widgets/sourcecode/codeeditor.py b/spyder/widgets/sourcecode/codeeditor.py
--- a/spyder/widgets/sourcecode/codeeditor.py
+++ b/spyder/widgets/sourcecode/codeeditor.py
@@ -2725,12 +2725,9 @@ def keyPressEvent(self, event):
             self.stdkey_end(shift, ctrl)
         elif text == '(' and not self.has_selected_text():
             self.hide_completion_widget()
-            if self.close_parentheses_enabled:
-                self.handle_close_parentheses(text)
-            else:
-                self.insert_text(text)
-        elif text in ('[', '{') and not self.has_selected_text() \
-          and self.close_parentheses_enabled:
+            self.handle_parentheses(text)
+        elif (text in ('[', '{') and not self.has_selected_text() and
+              self.close_parentheses_enabled):
             s_trailing_text = self.get_text('cursor', 'eol').strip()
             if len(s_trailing_text) == 0 or \
                s_trailing_text[0] in (',', ')', ']', '}'):
@@ -2797,12 +2794,12 @@ def keyPressEvent(self, event):
             if self.is_completion_widget_visible() and text:
                 self.completion_text += text
 
-    def handle_close_parentheses(self, text):
-        if not self.close_parentheses_enabled:
-            return
+    def handle_parentheses(self, text):
+        """Handle left and right parenthesis depending on editor config."""
         position = self.get_position('cursor')
         rest = self.get_text('cursor', 'eol').rstrip()
-        if not rest or rest[0] in (',', ')', ']', '}'):
+        valid = not rest or rest[0] in (',', ')', ']', '}')
+        if self.close_parentheses_enabled and valid:
             self.insert_text('()')
             cursor = self.textCursor()
             cursor.movePosition(QTextCursor.PreviousCharacter)


Test patch: