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):
20
20
symbols = []
21
21
exclude = set ({})
22
22
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
+ )
23
27
24
28
while definitions != []:
25
29
d = definitions .pop (0 )
@@ -28,11 +32,8 @@ def pylsp_document_symbols(config, document):
28
32
if not add_import_symbols :
29
33
# Skip if there's an import in the code the symbol is defined.
30
34
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 ):
36
37
continue
37
38
38
39
# Skip imported symbols comparing module names.
You can’t perform that action at this time.
0 commit comments