We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c7349d6 commit b8f544eCopy full SHA for b8f544e
1 file changed
pylsp/plugins/symbols.py
@@ -20,6 +20,10 @@ def pylsp_document_symbols(config, document):
20
symbols = []
21
exclude = set({})
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
+ )
27
28
while definitions != []:
29
d = definitions.pop(0)
@@ -28,11 +32,8 @@ def pylsp_document_symbols(config, document):
32
if not add_import_symbols:
33
# Skip if there's an import in the code the symbol is defined.
30
34
code = d.get_line_code()
31
- pattern = (
- re.compile
- (r'^\s*(?!#)(from\s+\w+(\.\w+)*\s+import\s+[\w,\s*]+|import\s+[\w,\s]+)')
- )
35
- if pattern.match(code):
+
36
+ if pattern_import.match(code):
37
continue
38
39
# Skip imported symbols comparing module names.
0 commit comments