File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ def pylsp_document_symbols(config, document):
2020 symbols = []
2121 exclude = set ({})
2222 redefinitions = {}
23+ pattern_import = (
24+ re .compile
25+ (r'^\s*(?!#)\s*(from\s+[.\w]+(\.[\w]+)*\s+import\s+[\w\s,()*]+|import\s+[\w\s,.*]+)' )
26+ )
2327
2428 while definitions != []:
2529 d = definitions .pop (0 )
@@ -28,11 +32,8 @@ def pylsp_document_symbols(config, document):
2832 if not add_import_symbols :
2933 # Skip if there's an import in the code the symbol is defined.
3034 code = d .get_line_code ()
31- pattern = (
32- re .compile
33- (r'^\s*(?!#)(from\s+\w+(\.\w+)*\s+import\s+[\w,\s*]+|import\s+[\w,\s]+)' )
34- )
35- if pattern .match (code ):
35+
36+ if pattern_import .match (code ):
3637 continue
3738
3839 # Skip imported symbols comparing module names.
You can’t perform that action at this time.
0 commit comments