Get rid of all completions usages

This commit is contained in:
Dave Halter
2019-12-20 17:47:37 +01:00
parent 5bf6e7048b
commit 7f8ba17990
4 changed files with 20 additions and 21 deletions

View File

@@ -128,9 +128,9 @@ Autocompletion / Goto / Pydoc
Please check the API for a good explanation. There are the following commands:
- ``jedi.Script.goto_assignments``
- ``jedi.Script.completions``
- ``jedi.Script.usages``
- ``jedi.Script.goto``
- ``jedi.Script.complete``
- ``jedi.Script.find_references``
The returned objects are very powerful and really all you might need.

View File

@@ -29,7 +29,7 @@ API Documentation
The API consists of a few different parts:
- The main starting points for completions/goto: :class:`.Script` and :class:`.Interpreter`
- The main starting points for complete/goto: :class:`.Script` and :class:`.Interpreter`
- Helpful functions: :func:`.names`, :func:`.preload_module` and
:func:`.set_debug_function`
- :ref:`API Result Classes <api-classes>`
@@ -76,10 +76,10 @@ Completions:
>>> import jedi
>>> source = '''import json; json.l'''
>>> script = jedi.Script(source, 1, 19, '')
>>> script = jedi.Script(source, path='')
>>> script
<jedi.api.Script object at 0x2121b10>
>>> completions = script.completions()
>>> completions = script.complete(1, 19)
>>> completions
[<Completion: load>, <Completion: loads>]
>>> completions[1]
@@ -102,15 +102,15 @@ Definitions / Goto:
... inception = my_list[2]
...
... inception()'''
>>> script = jedi.Script(source, 8, 1, '')
>>> script = jedi.Script(source, path='')
>>>
>>> script.goto_assignments()
>>> script.goto(8, 1)
[<Definition inception=my_list[2]>]
>>>
>>> script.goto_definitions()
>>> script.infer(8, 1)
[<Definition def my_func>]
Related names:
References:
.. sourcecode:: python
@@ -120,13 +120,12 @@ Related names:
... x = 4
... else:
... del x'''
>>> script = jedi.Script(source, 5, 8, '')
>>> rns = script.related_names()
>>> script = jedi.Script(source, '')
>>> rns = script.find_references(5, 8)
>>> rns
[<RelatedName x@3,4>, <RelatedName x@1,0>]
>>> rns[0].start_pos
(3, 4)
>>> rns[0].is_keyword
False
>>> rns[0].text
'x'
[<Definition full_name='__main__.x', description='x = 3'>,
<Definition full_name='__main__.x', description='x'>]
>>> rns[1].line
5
>>> rns[0].column
8

View File

@@ -47,7 +47,7 @@ def run(code, index, infer=False):
if infer:
result = script.goto_definitions()
else:
result = script.completions()
result = script.complete()
print('Used %ss for the %sth run.' % (time.time() - start, index + 1))
return result

View File

@@ -45,7 +45,7 @@ def run():
print('Process Memory before: %skB' % process_memory())
# After this the module should be cached.
# Need to invent a path so that it's really cached.
jedi.Script(wx_core, path='foobar.py').completions()
jedi.Script(wx_core, path='foobar.py').complete()
gc.collect() # make sure that it's all fair and the gc did its job.
print('Process Memory after: %skB' % process_memory())