Repository: spyder-ide/spyder

Issue:
Local code not shown in Kite completions
## Problem Description

Kite provides function completions for functions defined in a local file that is referenced/imported into the current file. 

### What steps reproduce the problem?


1.
create a file things.py with the following content:

```    
one = 1

def two():
        return 2

class Three:
        me = "3"
```

create another file test.py in the same directory 

2. 
in test.py type

```
from things import one, two, Three
```

On a new line, type: 
`two().` 
(period at the end) 

### What is the expected output? What do you see instead?

Expected: Completions should show int methods including real, imag, and bit_length
Actual: Shows nothing

See video: [https://www.screencast.com/t/CJqsVt04Hu2](https://www.screencast.com/t/CJqsVt04Hu2)

## 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: latest spyder beta
* Python version: 
* Qt version: 
* PyQt version: 
* Operating System name/version: 



Discussion:
Thanks for reporting. We'll take a look at it after we release Spyder 4.
This could be solved once we make Kite take precedence over the LSP.
based on my investigation, it looks like completions aren't requested at all in this case (`two().‸`), so seems to be unrelated to the precedence issue.
@andfoy could you take a look?
> based on my investigation, it looks like completions aren't requested at all in this case 

I think that's correct.

@metalogical, how critical do you think this is for Kite? I mean, we'd really like to receive your help here if this is really important to you because @andfoy is very busy with other things right now.
@ccordoba12 do you know why completions aren't being requested in this case? I don't think this is critical for the first version of the integration with Kite, but if we had more context on why this wasn't triggering, we could figure out how to help out here.
> do you know why completions aren't being requested in this case?

I don't know if that's an issue in our side or a problem/limitation with Jedi or the LSP, to be honest (most probably it has to do with the later).

@andfoy, do you know what's happening here?

Most probably we're preventing dot completions after a parenthesis
Got it. We can dig into this in the coming weeks.
It seems the issue is that dot completions after a parenthesis aren't requested. Both local (ex above) and global function like `requests.get().$` show no completions after the `.` but show after Ctrl+Space
@metalogical can you take a look at this? 

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
@@ -3603,8 +3603,10 @@ def insert_text(event):
             self.insert_text(text)
             if text == ".":
                 if not self.in_comment_or_string():
-                    last_obj = getobj(self.get_text('sol', 'cursor'))
-                    if last_obj and not last_obj.isdigit():
+                    text = self.get_text('sol', 'cursor')
+                    last_obj = getobj(text)
+                    prev_char = text[-2] if len(text) > 1 else ''
+                    if prev_char in {')', ']', '}'} or (last_obj and not last_obj.isdigit()):
                         self.do_completion(automatic=True)
             else:
                 self.do_completion(automatic=True)


Test patch: