aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/graphql/init.lua
blob: 5bfac4fe1889b4bf57a9bd4a9c04d901b0d980b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local util = require "lspconfig.util"

local server = require "nvim-lsp-installer.server"
local npm = require "nvim-lsp-installer.installers.npm"

local root_dir = server.get_server_root_path "graphql"

return server.Server:new {
    name = "graphql",
    root_dir = root_dir,
    installer = npm.packages { "graphql-language-service-cli@latest", "graphql" },
    default_options = {
        cmd = { npm.executable(root_dir, "graphql-lsp"), "server", "-m", "stream" },
        filetypes = { "typescriptreact", "javascriptreact", "graphql" },
        root_dir = util.root_pattern(
            -- Sourced from https://graphql-config.com/usage/ and https://git.io/Js2dt
            "package.json",
            "graphql.config.json",
            "graphql.config.js",
            "graphql.config.ts",
            "graphql.config.toml",
            "graphql.config.yaml",
            "graphql.config.yml",
            ".graphqlrc",
            ".graphqlrc.json",
            ".graphqlrc.toml",
            ".graphqlrc.yaml",
            ".graphqlrc.yml",
            ".graphqlrc.js",
            ".graphqlrc.ts"
        ),
    },
}