Skip to content

Commit 1ba3fad

Browse files
FynnMazurkiewiczColinDuquesnoy
authored andcommitted
Fix #74 Jedi API incompatibilities (#36)
* Fixed an AttributeError with a new version of the Jedi API. * Added a test case for the _extract_def. * Added myself to the list of contributors. * Fixed test_extract_def.
1 parent a22104d commit 1ba3fad

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Colin Duquesnooy (@ColinDuquesnoy) <colin.duquesnoy@gmail.com>
55

66
Contributors
77
============
8+
9+
Fynn Mazurkiewicz <FynnMazurkiewicz@'Googles-Email-Service'.com>

pyqode/python/backend/workers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def goto_assignments(request_data):
7676

7777

7878
def _extract_def(d, path):
79-
d_line, d_column = d.start_pos
79+
d_line, d_column = d.line, d.column
8080
# use full name for import type
8181
if d.type == 'function':
8282
try:

test/test_backend/test_workers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Test all workers in pyqode.python.backend.workers.
33
"""
44
import sys
5+
6+
import jedi
57
from pyqode.core.modes import CheckerMessages
68
from pyqode.core.share import Definition
79

@@ -60,6 +62,20 @@ def test_goto_assignments():
6062
assert len(results) == 0
6163

6264

65+
def test_extract_def():
66+
code = """
67+
import pyqode.python.widgets
68+
import PyQt5.QtWidgets as QtWidgets
69+
app = QtWidgets.QApplication([])
70+
editor = pyqode.python.widgets.PyCyodeEdit()
71+
editor.file.open(__file__)
72+
editor.show()
73+
app.exec()
74+
"""
75+
for definition in jedi.defined_names(code):
76+
result = workers._extract_def(definition, "")
77+
assert result
78+
6379
def test_defined_names():
6480
filename = __file__
6581
with open(filename, 'r', encoding='utf-8') as file:

0 commit comments

Comments
 (0)