Skip to content

Commit a4f164a

Browse files
committed
Fix lang_support warnings
1 parent 87688c2 commit a4f164a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lang_support/__init__.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
def __lldb_init_module(debugger, internal_dict): # pyright: ignore
88
adapter_settings = internal_dict['adapter_settings']
99
langs = adapter_settings.get('sourceLanguages', [])
10+
log.info('languages: {}'.format(langs))
1011
for lang in langs:
11-
try:
12-
ns = __import__('lang_support', fromlist=[lang])
13-
getattr(ns, lang).__lldb_init_module(debugger, internal_dict)
14-
except ImportError:
15-
pass
16-
except Exception as e:
17-
message = 'Failed to initialize language support for {}:'.format(lang)
18-
log.exception(message)
19-
print(message, str(e))
12+
ns = __import__('lang_support', fromlist=[lang])
13+
mod = getattr(ns, lang, None)
14+
if mod is None:
15+
log.debug('No lang support found for {}'.format(lang))
16+
else:
17+
try:
18+
mod.__lldb_init_module(debugger, internal_dict)
19+
except Exception as e:
20+
message = 'Failed to initialize language support for {}'.format(lang)
21+
log.exception(message)
22+
print(message, str(e))

0 commit comments

Comments
 (0)