Skip to content

feat: default struct field values #7

Description

@SchoolyB

Summary

Grayscale structs support default field values (STANDARD.md §3.2.3). The LSP symbol scanner does not currently handle the = expr suffix on struct fields.

Example

const Config struct {
    host string = "localhost"
    port int = 8080
    verbose bool = false
}

const Point struct {
    x, y int = 0
    z int = 1
}

When a struct is created with new() or a struct literal that omits a field, the default value is used instead of zero-initialization. #json structs cannot have default field values.

Scope

  • Update the symbol scanner in symbols.ts to handle field type = value syntax when parsing struct fields
  • Ensure hover/completion for struct fields includes the default value when present

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions