Skip to content

Don't go to definition of builtin modules #687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion pyls/plugins/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ def pyls_definitions(config, document, position):
}
}
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
if d.is_definition() and d.line is not None and d.column is not None and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull this out into a function? It doesn't read very clearly anymore

d.module_path is not None and not d.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 [] == pyls_definitions(config, doc, cursor_pos)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be assert not pyls_definitions(config, doc, cursor_pos)



def test_assignment(config):
Expand Down