You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have not seen this anywhere in requests but by adding a GRAPHQL sigil, this way we can use the formatter to format inline queries and also tree sitter can be setup for highlighting inline queries.
Example: https://maartenvanvliet.nl/2022/01/26/absinthe_formatter/
The text was updated successfully, but these errors were encountered:
defmodule GSigil do
def sigil_G(string, []), do: string
end
somewhere where you want to use it
import GSigil
and plugin for formatter
defmodule GqlFormatter do
@behaviour Mix.Tasks.Format
def features(_opts) do
[sigils: [:G]]
end
def format(contents, _opts \\ []) do
Absinthe.Formatter.format(%Absinthe.Blueprint{input: contents})
end
end
add plugin to formatter
plugins: [GqlFormatter]
Usage
@cart_query_end_user ~G"""
query cart {
cart {
id
type
totals {
amountToPay {
amount
currency
}
}
user {
email
}
userId
sessionUid
items {
id
type
productId
productVersionId
productVariantId
productVariantVersionId
quantity
}
}
}
"""
I have not seen this anywhere in requests but by adding a GRAPHQL sigil, this way we can use the formatter to format inline queries and also tree sitter can be setup for highlighting inline queries.
Example: https://maartenvanvliet.nl/2022/01/26/absinthe_formatter/
The text was updated successfully, but these errors were encountered: