Skip to content

Add builtin scalar helpers and improve hover tooltip infrastructure#5136

Draft
captbaritone wants to merge 2 commits intofacebook:mainfrom
captbaritone:hover-tooltip-improvements
Draft

Add builtin scalar helpers and improve hover tooltip infrastructure#5136
captbaritone wants to merge 2 commits intofacebook:mainfrom
captbaritone:hover-tooltip-improvements

Conversation

@captbaritone
Copy link
Contributor

Summary

  • Add BUILTIN_SCALAR_NAMES constant and is_builtin_scalar_name() function to the schema crate for consistent handling of GraphQL's built-in scalar types
  • Update schema-set to use BUILTIN_SCALAR_NAMES instead of a hardcoded local array
  • Add TruncatedPrinter with print_field() and print_type_truncated() functions to schema-print crate for hover tooltip SDL generation
  • Add ... truncation indicator when type definitions are truncated in hover tooltips
  • Add module docblock documenting the expected hover tooltip format conventions
  • Simplify Client Schema Extension hover message to always show Relay docs link
  • Add 16 new hover test fixtures covering linked fields, inline fragments, directives, variable definitions, and field arguments

Test plan

  • All hover tests pass
  • schema-set tests pass
  • schema-print tests pass

Add 16 new test fixtures to cover previously untested hover cases:
- Linked fields (direct, nested, deeply nested)
- Inline fragments with type conditions
- Directives (schema and Relay-specific @arguments/@argumentDefinitions)
- Variable definitions (with and without defaults)
- Field arguments (variables, enums, booleans, floats)
- Fields that accept arguments
- Fragment definition type conditions

This improves test coverage for all main HoverBehavior cases in the LSP.
- Add BUILTIN_SCALAR_NAMES constant and is_builtin_scalar_name() function
  to schema crate for consistent builtin scalar handling
- Update schema-set to use BUILTIN_SCALAR_NAMES instead of hardcoded list
- Add TruncatedPrinter with print_field() and print_type_truncated() functions
  to schema-print crate for hover tooltip SDL generation
- Add "..." truncation indicator when type definitions are truncated
- Add module docblock documenting hover tooltip format conventions
- Simplify Client Schema Extension hover message to always show Relay docs link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants