Git Product home page Git Product logo

cmp-graphql's Introduction

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
})

cmp-graphql's People

Contributors

phenax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cmp-graphql's Issues

Deprecated `get_node_at_pos` use @ `get_ts_node_under_cursor`

๐Ÿ‘‹๐Ÿผ Hi, thanks for the plugin.

While trying to get the plugin to work, I noticed this warning

vim.treesitter.get_node_at_pos() is deprecated, use vim.treesitter.get_node() instead. :help deprecated
This feature will be removed in Nvim version 0.10
stack traceback:
        ...m/HEAD-e23c6eb/share/nvim/runtime/lua/vim/treesitter.lua:418: in function 'get_ts_node_under_cursor'
        ...te/pack/packer/start/cmp-graphql/lua/cmp-graphql/cmp.lua:16: in function 'is_available'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:99: in function 'get_sources'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:311: in function 'fn'
        .../site/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:57: in function <.../site/pack/packer/start/n
vim-cmp/lua/cmp/utils/async.lua:55>

PS - got it to work. Thanks again for this amazing plugin!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.