graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.
MIT License
16.12k stars 1.73k forks source link

[lsp-server] Add support for custom regions via comments #3791

Open wesharper opened 1 month ago

wesharper commented 1 month ago

Current Behavior (if applicable)

query {
  foo {
    bar
    baz
    # region
    zim
    zam
    zop
    # endregion
  }
}

The region/endregion comments do not activate custom code folding regions.

Desired Behavior

# region and # endregion or some variant like # :region and # :endregion should allow for custom code folding regions. This is especially useful for large queries within one resolver.

This specific syntax is an existing feature for other languages in VS Code and there are other mechanisms for other editors. Regardless of the actual implementation, first-party support for some sort of custom folding would be greatly appreciated!