fix: Go tree-sitter query captures field_declaration not field_declaration_list

Post-review fix: the Go struct field query incorrectly put @definition.property
on field_declaration_list (the list container) instead of field_declaration
(the individual field). Also removed unused `language` parameter from
extractPropertyDeclaredType.
This commit is contained in:
Gergo Magyar 2026-03-18 09:36:14 +00:00
parent ac8957f211
commit 69a611e0f5
2 changed files with 3 additions and 3 deletions

View file

@ -255,7 +255,7 @@ export const GO_QUERIES = `
; Struct fields — named field declarations inside struct types
(field_declaration_list
(field_declaration
name: (field_identifier) @name)) @definition.property
name: (field_identifier) @name) @definition.property)
; Struct embedding (anonymous fields = inheritance)
(type_declaration

View file

@ -64,7 +64,7 @@ import { extractSimpleTypeName } from '../type-extractors/shared.js';
*
* Returns the normalized type name, or undefined if no type can be extracted.
*/
const extractPropertyDeclaredType = (definitionNode: any, language: SupportedLanguages): string | undefined => {
const extractPropertyDeclaredType = (definitionNode: any): string | undefined => {
if (!definitionNode) return undefined;
// Strategy 1: Look for a `type` or `type_annotation` named field
@ -1218,7 +1218,7 @@ const processFileGroup = (
} else if (nodeLabel === 'Property' && definitionNode) {
// Extract the declared type for property/field nodes.
// Walk the definition node for type annotation children.
declaredType = extractPropertyDeclaredType(definitionNode, language);
declaredType = extractPropertyDeclaredType(definitionNode);
}
result.nodes.push({