Skip to content

Commit a23a131

Browse files
committed
Build environment object once
1 parent 58c1d35 commit a23a131

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pythonFiles/completion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class JediCompletion(object):
3333

3434
def __init__(self):
3535
self.default_sys_path = sys.path
36+
self.environment = jedi.api.environment.Environment(sys.prefix, sys.executable)
3637
self._input = io.open(sys.stdin.fileno(), encoding='utf-8')
3738
if (os.path.sep == '/') and (platform.uname()[2].find('Microsoft') > -1):
3839
# WSL; does not support UNC paths
@@ -563,11 +564,10 @@ def _process_request(self, request):
563564
all_scopes=True),
564565
request['id'])
565566

566-
environment = jedi.api.environment.Environment(sys.prefix, sys.executable)
567567
script = jedi.Script(
568568
source=request.get('source', None), line=request['line'] + 1,
569569
column=request['column'], path=request.get('path', ''),
570-
sys_path=sys.path, environment=environment)
570+
sys_path=sys.path, environment=self.environment)
571571

572572
if lookup == 'definitions':
573573
defs = []

0 commit comments

Comments
 (0)