@@ -21,7 +21,7 @@ pub trait IpcClient: Send {
2121/// will canonicalize to a list of [`SymbolDef`][] structures.
2222///
2323/// Note that `Symbols` is not actually a [`DialectFunction`][].
24- /// It is only intended for use as the value of a *function argument*
24+ /// It is only intended for use as the value of a *function argument*
2525/// -- it doesn't have a canonical function format.
2626#[ derive( Debug , Clone , Serialize , Deserialize ) ]
2727#[ serde( untagged) ]
@@ -271,7 +271,7 @@ impl<U: IpcClient> DialectFunction<U> for GitDiff {
271271/// - `{"comment": {"location": {"search": {"path": "src/", "regex": "fn main"}}, "icon": "warning", "content": ["Entry point"]}}`
272272#[ derive( Deserialize ) ]
273273pub struct Comment {
274- pub location : serde_json :: Value , // Dialect program that resolves to a location
274+ pub location : ResolvedLocation ,
275275 pub icon : Option < String > ,
276276 pub content : Vec < String > ,
277277}
@@ -281,14 +281,13 @@ pub struct Comment {
281281pub enum ResolvedLocation {
282282 FileRange ( FileRange ) ,
283283 SymbolDef ( SymbolDef ) ,
284- SymbolRef ( SymbolRef ) ,
285284 SearchResults ( Vec < FileRange > ) ,
286285}
287286
288287#[ derive( Serialize ) ]
289288pub struct ResolvedComment {
290289 pub location : FileRange ,
291- pub icon : Option < String > ,
290+ pub icon : Option < String > ,
292291 pub content : Vec < String > ,
293292}
294293
@@ -301,17 +300,10 @@ impl<U: IpcClient> DialectFunction<U> for Comment {
301300 self ,
302301 interpreter : & mut DialectInterpreter < U > ,
303302 ) -> anyhow:: Result < Self :: Output > {
304- // Evaluate the location Dialect program
305- let location_result = interpreter. evaluate ( self . location ) . await ?;
306-
307- // Deserialize to our typed enum for proper handling
308- let resolved_location: ResolvedLocation = serde_json:: from_value ( location_result) ?;
309-
310303 // Normalize different location types to FileRange
311- let file_range = match resolved_location {
304+ let file_range = match self . location {
312305 ResolvedLocation :: FileRange ( range) => range,
313306 ResolvedLocation :: SymbolDef ( def) => def. defined_at ,
314- ResolvedLocation :: SymbolRef ( ref_) => ref_. referenced_at ,
315307 ResolvedLocation :: SearchResults ( mut results) => {
316308 if results. is_empty ( ) {
317309 return Err ( anyhow:: anyhow!( "Location resolved to empty search results" ) ) ;
@@ -356,7 +348,11 @@ fn matches_extension(file_path: &str, extension_filter: &Option<String>) -> bool
356348 }
357349}
358350
359- fn process_file ( file_path : & str , extension_filter : & Option < String > , regex : & regex:: Regex ) -> Vec < FileRange > {
351+ fn process_file (
352+ file_path : & str ,
353+ extension_filter : & Option < String > ,
354+ regex : & regex:: Regex ,
355+ ) -> Vec < FileRange > {
360356 if matches_extension ( file_path, extension_filter) {
361357 if let Ok ( content) = std:: fs:: read_to_string ( file_path) {
362358 return search_file_content ( file_path, & content, regex) ;
0 commit comments