Skip to content

Neovim nvim-cmp source for graphql completions based on schema

License

Notifications You must be signed in to change notification settings

phenax/cmp-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cmp-graphql

Neovim nvim-cmp source for graphql completions based on schema

Instructions

Install phenax/cmp-graphql using your plugin manager

Example -

use 'phenax/cmp-graphql'

Add graphql source to your cmp config

cmp.setup({
  -- ...
  sources = {
    -- ...
    { name = 'graphql' }
  }
})

Generate schema json file (Using @graphql-codegen/cli)

  • Install @graphql-codegen/cli
yarn add -D @graphql-codegen/cli
  • Run codegen init to setup the codegen config file

NOTE: Make sure introspection json is enabled. The only relevant generated file is the schema json file.

yarn graphql-codegen init
  • And then to generate the schema json file
yarn && yarn codegen

Setup cmp-graphql for your project with

require('cmp-graphql').setup({
  schema_path = 'graphql.schema.json', -- Path to generated json schema file in project
})

About

Neovim nvim-cmp source for graphql completions based on schema

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages