Conversation
Add test input files and baseline snapshot output covering all four categories of missing documentation from issue #108: - Constants/variables in grouped declarations (get block doc instead of per-item doc) - Struct field doc comments (lost entirely due to nil parent) - Interface method doc comments (lost due to self-referencing parent) - Types in grouped type declarations (get block doc instead of per-type doc)
Pass the *ast.ValueSpec as parent instead of *ast.GenDecl when registering const/var names. This makes extractHoverText consult ValueSpec.Doc (the per-item doc comment) instead of GenDecl.Doc (the block-level doc). Items without their own doc comment now correctly get no documentation rather than inheriting the unrelated block-level comment. Fixes the const/var portion of #108.
Pass the *ast.Field as parent instead of nil when registering named struct field symbols in both visitor_type.go and visitor_var.go. This allows extractHoverText to reach the Field.Doc and Field.Comment nodes that carry doc and inline comments. Fixes the struct field portion of #108.
Pass the *ast.Field as parent instead of the method's *ast.Ident when registering interface method symbols. Previously the Ident was passed as both parent and node, causing a self-referencing delegation in extractHoverText that always returned empty string. Fixes the interface method portion of #108.
When an *ast.Ident delegates to a *ast.GenDecl parent in extractHoverText, first check if the ident belongs to a TypeSpec within that GenDecl and route through the TypeSpec case instead. This lets TypeSpec.Doc (the per-type doc comment) take priority, with fallback to GenDecl.Doc (the block-level doc) when no per-type doc exists. Fixes the grouped type portion of #108.
When a symbol lives inside a grouped declaration (const/var/type block) that has its own doc comment, append the block-level doc as a second entry in Documentation. SCIP's Documentation is a repeated string field, and Sourcegraph's hover tooltip renders all entries. This gives richer hover info: the per-item doc first, then the group context. Items whose only doc is the block-level fallback get it once without duplication.
359652a to
31cb8da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.