Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pyls/plugins/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def pyls_definitions(config, document, position):
'end': {'line': d.line - 1, 'character': d.column + len(d.name)},
}
}
for d in definitions
if d.is_definition() and d.line is not None and d.column is not None and d.module_path is not None
for d in definitions if d.is_definition() and _not_internal_definition(d)
]


def _not_internal_definition(definition):
return (
definition.line is not None and
definition.column is not None and
definition.module_path is not None and
not definition.in_builtin_module()
)
2 changes: 1 addition & 1 deletion test/plugins/test_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_builtin_definition(config):

# No go-to def for builtins
doc = Document(DOC_URI, DOC)
assert len(pyls_definitions(config, doc, cursor_pos)) == 1
assert not pyls_definitions(config, doc, cursor_pos)


def test_assignment(config):
Expand Down