mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Get rid of all completions usages
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user