Skip to content

Commit e442467

Browse files
committed
Curse you Python 2 on Windows: os.path.samefile not implemented
1 parent 40afab3 commit e442467

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pyls/plugins/symbols.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ def pyls_document_symbols(config, document):
3636
if (not sym_full_name.startswith(module_name) and
3737
not sym_full_name.startswith('__main__')):
3838
continue
39-
40-
if _include_def(d) and os.path.samefile(document.path, d.module_path):
39+
try:
40+
docismodule = os.path.samefile(document.path, d.module_path)
41+
except AttributeError:
42+
# Python 2 on Windows has no .samefile, but then these are
43+
# strings for sure
44+
docismodule = document.path == d.module_path
45+
46+
if _include_def(d) and docismodule:
4147
tuple_range = _tuple_range(d)
4248
if tuple_range in exclude:
4349
continue

0 commit comments

Comments
 (0)