-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
From manual debugging it seems that includeDeclaration gets handled correctly here:
python-lsp-server/pylsp/python_lsp.py
Lines 753 to 757 in 6c168d0
| def m_text_document__references( | |
| self, textDocument=None, position=None, context=None, **_kwargs | |
| ): | |
| exclude_declaration = not context["includeDeclaration"] | |
| return self.references(textDocument["uri"], position, exclude_declaration) |
and here:
python-lsp-server/pylsp/python_lsp.py
Lines 516 to 524 in 6c168d0
| def references(self, doc_uri, position, exclude_declaration): | |
| return flatten( | |
| self._hook( | |
| "pylsp_references", | |
| doc_uri, | |
| position=position, | |
| exclude_declaration=exclude_declaration, | |
| ) | |
| ) |
but when it is passed to pylsp_references here:
python-lsp-server/pylsp/plugins/references.py
Lines 10 to 17 in 6c168d0
| @hookimpl | |
| def pylsp_references(document, position, exclude_declaration=False): | |
| code_position = _utils.position_to_jedi_linecolumn(document, position) | |
| usages = document.jedi_script().get_references(**code_position) | |
| if exclude_declaration: | |
| # Filter out if the usage is the actual declaration of the thing | |
| usages = [d for d in usages if not d.is_definition()] |
the default value is always used. It looks like the pluggy weirdness with it failing to pass arguments correctly. Reproduced in 1.8.0 with pluggy 1.2.0 and 1.3.0 on Python 3.11.
Removing the default value (exclude_declaration=False → exclude_declaration) fixes the issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working