@@ -73,6 +73,7 @@ async def find_in_file(
7373 max_results : Annotated [int , "Cap results to avoid huge payloads" ] = 200 ,
7474 ignore_case : Annotated [bool | str | None , "Case insensitive search" ] = True ,
7575) -> dict [str , Any ]:
76+ # project_root is currently unused but kept for interface consistency
7677 unity_instance = get_unity_instance_from_context (ctx )
7778 await ctx .info (
7879 f"Processing find_in_file: { uri } (unity_instance={ unity_instance or 'default' } )" )
@@ -100,7 +101,7 @@ async def find_in_file(
100101 try :
101102 contents = base64 .b64decode (data .get ("encodedContents" , "" ).encode (
102103 "utf-8" )).decode ("utf-8" , "replace" )
103- except Exception :
104+ except ( ValueError , TypeError , base64 . binascii . Error ) :
104105 contents = contents or ""
105106
106107 if contents is None :
@@ -120,18 +121,6 @@ async def find_in_file(
120121 except re .error as e :
121122 return {"success" : False , "message" : f"Invalid regex pattern: { e } " }
122123
123- matches = []
124- lines = contents .splitlines ()
125-
126- # Helper to map index to line number
127- def get_line_number (index , content_lines ):
128- # This is a bit slow for large files if we do it for every match,
129- # but robust.
130- # Better: iterate matches and count newlines?
131- # Or just search line by line?
132- # Searching line by line is safer for line-based results, but regex might span lines.
133- pass
134-
135124 # If the regex is not multiline specific (doesn't contain \n literal match logic),
136125 # we could iterate lines. But users might use multiline regexes.
137126 # Let's search the whole content and map back to lines.
0 commit comments