Skip to content

Commit

Permalink
Replace template variables with any type in config.
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Nov 13, 2024
1 parent d46260f commit f6b63f7
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lsp_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,18 +1024,11 @@ def read_lang_server_info(lang_server_path):
lang_server_info = json.load(lang_server_path)

# Replace template in command options.
command_args = lang_server_info["command"]
for i, arg in enumerate(command_args):
command_args[i] = replace_template(arg)
lang_server_info["command"] = command_args
lang_server_info["command"] = eval(replace_template(str(lang_server_info["command"])))

# Replace template in initializationOptions.
if "initializationOptions" in lang_server_info:
initialization_options_args = lang_server_info["initializationOptions"]
for i, arg in enumerate(initialization_options_args):
if isinstance(initialization_options_args[arg], str):
initialization_options_args[arg] = replace_template(initialization_options_args[arg])
lang_server_info["initializationOptions"] = initialization_options_args
lang_server_info["initializationOptions"] = eval(replace_template(str(lang_server_info["initializationOptions"])))

return lang_server_info

Expand Down

0 comments on commit f6b63f7

Please sign in to comment.