Launch.nvim icon indicating copy to clipboard operation
Launch.nvim copied to clipboard

Adding helm_ls is a pain: Cannot access configuration for helm_ls

Open xcfw opened this issue 2 years ago • 1 comments

I get this error:

[lspconfig] Cannot access configuration for helm_ls. Ensure this server is listed in `server_configurations.md` or added as a custom server.

With the following config:

$ cat utils/init.lua
local M = {}

M.servers = {
  "lua_ls",
  "cssls",
  "html",
  "docker_compose_language_service",
  "tsserver",
  "pyright",
  "dockerls",
  "solargraph",
  "bashls",
  "jsonls",
  "helm_ls",
  "terraformls"
}

return M
$ cat settings/helm_ls.lua
local lspconfig = require('lspconfig')
local util = require('lspconfig.util')

return {
  settings = {
    helm = {
      cmd = {"helm_ls", "serve"},
      filetypes = {'helm'},
      root_dir = function(fname)
        return util.root_pattern('Chart.yaml')(fname)
      end,
    },
  },
  lspconfig.helm_ls.setup {
    filetypes = {"helm"},
    cmd = {"helm_ls", "serve"},
  },
}
$ cat user/null-ls.lua
local M = {
  "jose-elias-alvarez/null-ls.nvim",
  event = "BufReadPre",
  commit = "60b4a7167c79c7d04d1ff48b55f2235bf58158a7",
  dependencies = {
    {
      "nvim-lua/plenary.nvim",
      commit = "9a0d3bf7b832818c042aaf30f692b081ddd58bd9",
      lazy = true,
    },
  },
}

function M.config()
  local null_ls = require "null-ls"
  -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
  local formatting = null_ls.builtins.formatting
  -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
  local diagnostics = null_ls.builtins.diagnostics

  -- https://github.com/prettier-solidity/prettier-plugin-solidity
  null_ls.setup {
    debug = false,
    sources = {
      formatting.prettier.with {
        extra_filetypes = { "toml" },
        extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
      },
      formatting.black.with { extra_args = { "--fast" } },
      formatting.stylua,
      formatting.google_java_format,
      formatting.rubocop,
      diagnostics.flake8,
      diagnostics.rubocop,
    },
  }
end

return M
$ cat user/vim-helm.lua
local M = {
  "towolf/vim-helm",
  commit = "c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb",
  event = "VeryLazy",
}

return M

Mason successfully installed helm_ls and it's accessible in console:

$ helm_ls
  /\  /\___| |_ __ ___   / / ___ 
 / /_/ / _ \ | '_ ' _ \ / / / __|
/ __  /  __/ | | | | | / /__\__ \
\/ /_/ \___|_|_| |_| |_\____/___/

Usage:
  helm_ls [flags]
  helm_ls [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  lint        Lint a helm project
  serve       Start helm lint language server
  version     Print current version of helm_ls

Flags:
  -h, --help   help for helm_ls

Use "helm_ls [command] --help" for more information about a command.

image

xcfw avatar Sep 20 '23 07:09 xcfw

Hey all! Any news on this issue? It maybe my misunderstanding and lack of lua knowledge, please advise.

xcfw avatar Oct 17 '23 07:10 xcfw