Skip to content

Commit

Permalink
Convert languages array to new syntax to avoid debug warnings (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored Jun 26, 2020
1 parent 5301097 commit 6ab09ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions st3/lsp_utils/npm_client_handler_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def configuration(cls) -> Tuple[sublime.Settings, str]:
settings = sublime.load_settings(basename)
settings.set('enabled', True)
settings.set('command', ['node', cls.__server.binary_path] + cls.get_binary_arguments())
languages = settings.get('languages', None)
if languages:
settings.set('languages', cls._upgrade_languages_list(languages))
cls.on_settings_read(settings)
# Read into a dict so we can call old API "on_client_configuration_ready" and then
# resave potentially changed values.
Expand All @@ -93,6 +96,19 @@ def configuration(cls) -> Tuple[sublime.Settings, str]:

return settings, filepath

@classmethod
def _upgrade_languages_list(cls, languages):
upgraded_list = []
for language in languages:
if 'scopes' in language:
upgraded_list.append({
'languageId': language.get('languageId'),
'document_selector': ' | '.join(language.get('scopes')),
})
else:
upgraded_list.append(language)
return upgraded_list

@classmethod
def get_binary_arguments(cls):
"""
Expand Down

0 comments on commit 6ab09ed

Please sign in to comment.