@@ -259,8 +259,14 @@ type ReferenceInfo struct {
259259
260260func (index * Index ) FindReferences (contextFile , name , srcPrefix string , contextLines , outputLimit int ) (
261261 []ReferenceInfo , int , error ) {
262+ // Just in case LLM decides to reference structs/fields with the tag.
263+ name = strings .TrimSpace (strings .TrimPrefix (strings .TrimPrefix (strings .TrimSpace (name ),
264+ "struct " ), "union " ))
265+ // We don't export each field as a separate definition,
266+ // so we do just name-based match for them.
267+ isField := strings .Contains (name , "::" )
262268 target := index .findDefinition (contextFile , name )
263- if target == nil {
269+ if target == nil && ! isField {
264270 return nil , 0 , aflow .BadCallError ("requested entity does not exist" )
265271 }
266272 if srcPrefix != "" {
@@ -278,8 +284,8 @@ func (index *Index) FindReferences(contextFile, name, srcPrefix string, contextL
278284 // the target is a non-static 'foo' in some file,
279285 // the reference is in another file and refers to a static 'foo'
280286 // defined in that file (which is not the target 'foo').
281- if ref .EntityKind != target . Kind || ref .Name != target .Name ||
282- target .IsStatic && target .Body .File != def .Body .File {
287+ if ref .Name != name || ! isField && ( ref .EntityKind != target .Kind ||
288+ target .IsStatic && target .Body .File != def .Body .File ) {
283289 continue
284290 }
285291 totalCount ++
0 commit comments