diff options
| author | Martin Bielik <mx.bielik@gmail.com> | 2024-03-24 11:29:22 +0100 |
|---|---|---|
| committer | Martin Bielik <mx.bielik@gmail.com> | 2024-03-24 11:29:22 +0100 |
| commit | 6a053767af08d6edfb46b4be72f05a9b3bc7be04 (patch) | |
| tree | 160568ea3abdabbca1273acb9bc423cfa98f1a53 /py/roles.py | |
| parent | 1ae3ebccf6d790e669311d9556335a8fa55b07cc (diff) | |
| download | vim-ai-6a053767af08d6edfb46b4be72f05a9b3bc7be04.tar.gz | |
reusing parsing code
Diffstat (limited to 'py/roles.py')
| -rw-r--r-- | py/roles.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/py/roles.py b/py/roles.py index 6e0a52e..b7d19e1 100644 --- a/py/roles.py +++ b/py/roles.py @@ -1,6 +1,8 @@ import vim -import os -import configparser + +# import utils +plugin_root = vim.eval("s:plugin_root") +vim.command(f"py3file {plugin_root}/py/utils.py") roles_config_path = os.path.expanduser(vim.eval("g:vim_ai_roles_config_file")) if not os.path.exists(roles_config_path): @@ -9,12 +11,7 @@ if not os.path.exists(roles_config_path): roles = configparser.ConfigParser() roles.read(roles_config_path) -if vim.eval("exists('g:vim_ai_roles_config_function')") == '1': - roles_config_function = vim.eval("g:vim_ai_roles_config_function") - if not vim.eval("exists('*" + roles_config_function + "')"): - raise Exception(f"Role config function does not exist: {roles_config_function}") - else: - roles.update(vim.eval(roles_config_function + "()")) +enhance_roles_with_custom_function(roles) role_names = [name for name in roles.sections() if not '.' in name] |