ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.54k stars 100 forks source link

Autostart with Packer is not working. #191

Closed mkubasz closed 3 years ago

mkubasz commented 3 years ago

Hi, I just want to handle auto start, I founded closed issue with vim.schedule, but is not working.

  local lsp = require('lspconfig')
  require("packer").loader("coq_nvim coq.artifacts")
  local coq = require('coq')
  vim.g.coq_settings = {
    auto_start = true,
    clients = {
      tabnine = {
        enabled = true,
      }
    }
  }
  lsp.pyright.setup(coq.lsp_ensure_capabilities()) 
  lsp.bashls.setup(coq.lsp_ensure_capabilities())
  lsp.denols.setup(coq.lsp_ensure_capabilities())
  lsp.tsserver.setup(coq.lsp_ensure_capabilities())
end)

And in packer

  use { 
    'ms-jpq/coq_nvim', 
    branch = 'coq'
  }
  use { 
    'ms-jpq/coq.artifacts', 
    branch= 'artifacts'
  }

I will be glad for some hints :)

zeertzjq commented 3 years ago

Put vim.g.coq_settings directly in init.lua instead.

zeertzjq commented 3 years ago

IDK about the vim.schedule stuff. Why is that necessary?

ms-jpq commented 3 years ago

It was necessary, not anymore.

Because I only accounted for classic plugin mangers like vimplug and stuff, didnt know packer existed.

it was a temp work around to let packer people use coq before I figured out how to do things "properly"

mkubasz commented 3 years ago

@ms-jpq Maybe you can share with properly solution :) I tried to put into init this part with settings but nothing happens.

ms-jpq commented 3 years ago

move local coq = require('coq')

below vim.g.coq_settings =...

thanks


sorry im in coding mode rn and did read your ticket, i thought it was gonna be annoying to fix, but its super easy lol

ms-jpq commented 3 years ago

ill add it in the FAQ

sleepytraveler commented 3 years ago

The issue is closed, but I thought I'd add this comment for other people's benefit trying to use coq with packer.

An easy way to ensure that the vim.g.coq_settings is called before the local coq = require('coq') is to add the vim.g.coq_settings = ... to setup event in packer and require('coq') in config event.

Example:

       setup = function()                                                                                                                                                                                                                             
         require('plugins.nvim-coq').setup()         -- has vim.g.coq_settings                                                                                                                                                                                                 
       end,                                                                                                                                                                                                                                           
       config = function()                                                                                                                                                                                                                            
         require('plugins.nvim-coq').config()       -- has require('coq')                                                                                                                                                                                                  
      end