How do you get the graphql lsp to work? #1023
Replies: 1 comment 1 reply
-
Hey I just got mine working sometime after seeing your thread here. I thought I'd share my answer as it seems there aren't that many people out there that have solved this and written their configs online. I was in a certain situation like you. I needed to follow this advice
EDIT: I actually found out I did not need the graphql-language-service-server and it ended up giving an error staying in my lazy-vim config, so I have removed it below. For me I'm using LazyVim which uses lazy.nvim plugin manager. To solve the above issue. I did it in my lazyvim configs like so: First I added those two dependencies and ensured they were installed when installing mason.nvim: {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
-- ...elided others
"graphql-language-service-cli", -- required for graphql-lsp
},
},
}, Add graphql to nvim-lspconfig {
"neovim/nvim-lspconfig",
opts = {
servers = {
-- ...elided other servers
"graphql", -- required for graphql-lsp
},
},
}, Bonus: Add highlighting through nvim-treesitter {
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
-- ...elided other configs
"graphql",
},
},
}, |
Beta Was this translation helpful? Give feedback.
-
I've installed it through mason and also added a
.graphqlrc
file that points to the schema as well as all the graphql files.When checking
LspInfo
graphql is attached but I can't bring up the lsp completions and it doesn't show me any lsp if I misspell anything.I would assume that it would use the schema to know what to provide me but maybe I am missing something?
Beta Was this translation helpful? Give feedback.
All reactions