summaryrefslogtreecommitdiff
path: root/py/context.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--py/context.py (renamed from py/config.py)16
1 files changed, 5 insertions, 11 deletions
diff --git a/py/config.py b/py/context.py
index 7739b27..254cd3b 100644
--- a/py/config.py
+++ b/py/context.py
@@ -3,8 +3,10 @@ import re
import os
import configparser
-def unwrap(input_var):
- return vim.eval(input_var)
+if "PYTEST_VERSION" in os.environ:
+ from utils import *
+
+context_py_imported = True
def merge_deep_recursive(target, source = {}):
source = source.copy()
@@ -22,14 +24,6 @@ def merge_deep(objects):
merge_deep_recursive(result, o)
return result
-def enhance_roles_with_custom_function(roles):
- 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 + "()"))
-
def load_role_config(role):
roles_config_path = os.path.expanduser(vim.eval("g:vim_ai_roles_config_file"))
if not os.path.exists(roles_config_path):
@@ -113,7 +107,7 @@ def make_prompt(role_prompt, user_prompt, user_selection, selection_boundary):
prompt = f"{role_prompt}{delimiter}{prompt}"
return prompt
-def make_config_and_prompt(params):
+def make_ai_context(params):
config_default = params['config_default']
config_extension = params['config_extension']
user_instruction = params['user_instruction']