kabouzeid / nvim-lspinstall

Provides the missing :LspInstall for nvim-lspconfig
MIT License
526 stars 67 forks source link

Need help Integrating nvim-lspInstall with ncm2 #139

Closed marvindore closed 2 years ago

marvindore commented 2 years ago

Hello, I am new to neovim so I'm sure I'm missing something simple. I have installed nvim-lspinstall as well as an autocompletion plugin ncm2 but I am lost at how to register the completion sources for ncm2. Is anyone using ncm2 willing to share an example config snippet?

This is what I have tried so far


-- get all installed servers
  local servers = require'lspinstall'.installed_servers()
  -- ... and add manually installed servers
  --table.insert(servers, "clangd")
  --table.insert(servers, "sourcekit")

  for _, server in pairs(servers) do
    local config = make_config()

    -- language specific config
    if server == "lua" then
      config.settings = lua_settings
    end
    if server == "sourcekit" then
      config.filetypes = {"swift", "objective-c", "objective-cpp"}; -- we don't want c and cpp!
    end
    if server == "clangd" then
      config.filetypes = {"c", "cpp"}; -- we don't want objective-c and objective-cpp!
    end

    -- Begin ncm2
    source_opt = {
        name = server,
        priority = 9,
        mark = server,
        sorter = 'none',
        on_complete = {function(s:on_complete, [server]) end},
        completion_pattern = capabilities
    }
    call ncm2#register_source(source_opt)
    -- End ncm2
    require'lspconfig'[server].setup(config)
  end```

That creates the error message:

`')' expected near ':' on line with on_complete`