local root_files = {
  "package.json",
  ".git",
}

local root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1])

vim.api.nvim_create_autocmd("FileType", {
  pattern = "typescript,javascript,javascriptreact,typescriptreact,vue",
  callback = function()
--    vim.lsp.start({
--      name = "typescript-language-server",
--      cmd = { "typescript-language-server", "--stdio" },
--      root_dir = root_dir,
--      settings = {
--        init_options = {
--          completionDisableFilterText = true,
--          plugins = {
--            name = "@vue/typescript-plugin",
--            location = "/home/mordae/.config/yarn/global/node_modules/@vue/language-server",
--            languages = { "vue" }
--          },
--        },
--      },
--    })

    vim.lsp.start({
      name = "volar",
      cmd = { "vue-language-server", "--stdio" },
      root_dir = root_dir,
      init_options = {
        typescript = {
          tsdk = "/home/mordae/.config/yarn/global/node_modules/typescript/lib",
        },
        vue = {
          hybridMode = false,
        },
      },
    })
  end,
})
