Skip to content

Skip generated symbols without a module path - #729

Open
natesute wants to merge 1 commit into
python-lsp:developfrom
natesute:fix/generated-symbols
Open

natesute wants to merge 1 commit into
python-lsp:developfrom
natesute:fix/generated-symbols

Conversation

@natesute

Copy link
Copy Markdown

Importing a class produced by collections.namedtuple can make textDocument/documentSymbol fail with TypeError when Jedi supplies generated members whose module_path is None.

Skip those members before constructing a Path. The imported class and the document's own symbols retain their locations. Regression coverage exercises both values of all_scopes and include_import_symbols with a real relative import.

Fixes #635.

Validation: two regression cases fail before the fix and two controls pass. The symbols, definitions and type-definition suites pass after the fix (19 passed, 1 platform-specific test skipped). Ruff 0.9.4 lint and formatting checks pass for both changed files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

textDocument/documentSymbol causes pylsp_document_symbols to throw a TypeError when there is an import for a namedtuple type

1 participant