Skip to content

Commit 3d045b8

Browse files
Mic92delta003
andauthored
fix with compatibility with jedi master (#851)
- Newer versions of parso/jedi uses Path instead of str - by converting to str pyls is compatibility with both old and new versions Co-authored-by: Marko Bakovic <[email protected]>
1 parent c279982 commit 3d045b8

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

pyls/plugins/definition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def pyls_definitions(config, document, position):
1616

1717
return [
1818
{
19-
'uri': uris.uri_with(document.uri, path=d.module_path),
19+
'uri': uris.uri_with(document.uri, path=str(d.module_path)),
2020
'range': {
2121
'start': {'line': d.line - 1, 'character': d.column},
2222
'end': {'line': d.line - 1, 'character': d.column + len(d.name)},

pyls/plugins/highlight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def is_valid(definition):
1414
return definition.line is not None and definition.column is not None
1515

1616
def local_to_document(definition):
17-
return not definition.module_path or definition.module_path == document.path
17+
return not definition.module_path or str(definition.module_path) == document.path
1818

1919
return [{
2020
'range': {

pyls/plugins/jedi_rename.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def pyls_rename(config, workspace, document, position, new_name): # pylint: dis
1919
log.debug('Finished rename: %s', refactoring.get_diff())
2020
changes = []
2121
for file_path, changed_file in refactoring.get_changed_files().items():
22-
uri = uris.from_fs_path(file_path)
22+
uri = uris.from_fs_path(str(file_path))
2323
doc = workspace.get_maybe_document(uri)
2424
changes.append({
2525
'textDocument': {

pyls/plugins/references.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def pyls_references(document, position, exclude_declaration=False):
1616

1717
# Filter out builtin modules
1818
return [{
19-
'uri': uris.uri_with(document.uri, path=d.module_path) if d.module_path else document.uri,
19+
'uri': uris.uri_with(document.uri, path=str(d.module_path)) if d.module_path else document.uri,
2020
'range': {
2121
'start': {'line': d.line - 1, 'character': d.column},
2222
'end': {'line': d.line - 1, 'character': d.column + len(d.name)}

test/plugins/test_references.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_references(tmp_workspace): # pylint: disable=redefined-outer-name
6868
def test_references_builtin(tmp_workspace): # pylint: disable=redefined-outer-name
6969
# Over 'UnicodeError':
7070
position = {'line': 4, 'character': 7}
71-
doc2_uri = uris.from_fs_path(os.path.join(tmp_workspace.root_path, DOC2_NAME))
71+
doc2_uri = uris.from_fs_path(os.path.join(str(tmp_workspace.root_path), DOC2_NAME))
7272
doc2 = Document(doc2_uri, tmp_workspace)
7373

7474
refs = pyls_references(doc2, position)

0 commit comments

Comments
 (0)