diff --git a/codetide/agents/tide/agent.py b/codetide/agents/tide/agent.py index cf39e99..13e69b1 100644 --- a/codetide/agents/tide/agent.py +++ b/codetide/agents/tide/agent.py @@ -1,7 +1,7 @@ from codetide import CodeTide -from codetide.search.code_search import SmartCodeSearch from ...mcp.tools.patch_code import file_exists, open_file, process_patch, remove_file, write_file, parse_patch_blocks from ...core.defaults import DEFAULT_ENCODING, DEFAULT_STORAGE_PATH +from ...search.code_search import SmartCodeSearch from ...parsers import SUPPORTED_LANGUAGES from ...autocomplete import AutoComplete from .models import Steps diff --git a/codetide/parsers/typescript_parser.py b/codetide/parsers/typescript_parser.py index a362689..4d81be2 100644 --- a/codetide/parsers/typescript_parser.py +++ b/codetide/parsers/typescript_parser.py @@ -396,6 +396,7 @@ def _process_variable_declarator(cls, node: Node, code: bytes, codeFile: CodeFil value = None next_is_value = False raw = cls._get_content(code, node) + previous_child = None for child in node.children: if child.type == "identifier" and name is None: name = cls._get_content(code, child) @@ -403,9 +404,14 @@ def _process_variable_declarator(cls, node: Node, code: bytes, codeFile: CodeFil type_hint = cls._get_content(code, child) elif child.type == "=": next_is_value = True + if previous_child is not None and name is None: + name = cls._get_content(code, previous_child) elif next_is_value: value = cls._get_content(code, child) next_is_value = False + + previous_child = child + codeFile.add_variable(VariableDeclaration( name=name, type_hint=type_hint,