Skip to content

textDocument/documentSymbol returns empty result for non-existing files #301

Closed
@rear1019

Description

@rear1019

textDocument/documentSymbol returns an empty result for non-existing files even though Jedi does provide symbol information. The culprit us the following code:

try:
docismodule = os.path.samefile(document.path, d.module_path)
except (TypeError, FileNotFoundError):
# Python 2 on Windows has no .samefile, but then these are
# strings for sure
docismodule = document.path == d.module_path

This can reproduced by creating a new file in Spyder: No symbol information is available in the Symbols Switcher and Outline plugin as long as the file is not saved¹. Code folding and linting does work.

¹ Note: Saving the new file is not sufficient to fix the issue in Spyder <= 5.4.0 due an another unrelated bug. See spyder/spyder-ide#20047.

EDIT: Formatting

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions