Skip to content

Support for magic comments or functions #96

@Axxxx0n

Description

@Axxxx0n

New graphql codegen client preset is not using template strings for graphql queries. It uses graphql() function with string arguments. Using this we don't get syntax highlighting.

const query = graphql(`
    query ExampleQuery {
        example {
           id
        }
    }
`)

Possible solutions:

  1. Similar to g:graphql_javascript_tags option we could use something as g:graphql_javascript_function=["graphql", "gql"] and mark the string inside function for syntax highlighting

  2. Use magic comment as many graphql tools and extensions do:

const query = graphql(/* GraphQL */`
    query ExampleQuery {
        example {
           id
        }
    }
`)
  1. Add prefixes and document let g:graphql_javascript_tags = ["gql", "graphql", "Relay.QL", "gql(", "graphql("]

Vim Version

NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions