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

No lsp-autocompletion. #192

Closed TornaxO7 closed 3 years ago

TornaxO7 commented 3 years ago

Hello! Thank you for this plugin!

I've a little problem. If I open a python file and start typing, then I don't get any autocompletion suggestion.

This is my setup:

local nvim_lsp = require('lspconfig')
local coq = require('coq')

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true

vim.g.lsp_utils_location_opts = {
    height = 40,
    mode = 'editor',
    preview = {
        title = 'Location Preview',
        border = true,
        broder_chars = border_chars
    },
    keymaps = {n = {['<C-n>'] = 'j', ['<C-p>'] = 'k'}},
    list = {
        border = true,
        numbering = true,
        title = 'References',
        border_chars = border_chars,
        highlight = 'Normal',
        selection_highlight = 'Visual',
        matching_highlight = 'Identifier'
    }
}

local function on_attach(client, bufnr)
    -- Find the clients capabilities
    local cap = client.resolved_capabilities

    if cap.document_highlight then
        vim.cmd('augroup LspHighlight')
        vim.cmd('autocmd!')
        vim.cmd(
            'autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()')
        vim.cmd(
            'autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()')
        vim.cmd('augroup END')
    end
end

nvim_lsp.pyright.setup(coq.lsp_ensure_capabilities({
    on_attach = on_attach,
    autostart = true,
    settings = {
        python = {
            pythonPath = "/usr/bin/python3/python3",
            analysis = {
                logLevel = "Trace",
            }
        }
    }
}))

What am I doing wrong?

ms-jpq commented 3 years ago

no idea, your settings look correct, is it only the LSP that doesnt work?

TornaxO7 commented 3 years ago

no, I don't get any autocompletion at all. Hm... I'll try that again

ms-jpq commented 3 years ago

did you run :COQnow?

because the whole thing is lazy loaded and wont start unless you tell it to

ms-jpq commented 3 years ago

please read the FAQ.

TornaxO7 commented 3 years ago

Oh ok, I just found out that the deps where missing "again", so it couldn't start. Hm... but I have this in my config:

let g:coq_settings = { 'auto_start': v:true}
ms-jpq commented 3 years ago

please run :COQdeps if you have received an update that requires it. those aren't super frequent though.

TornaxO7 commented 3 years ago

ok, I ran it now but how can I enable autostart? My setting above doesn't seem to work.

ms-jpq commented 3 years ago

did you put

let g:coq_settings = { 'auto_start': v:true}

before the require("coq")?

if you run :COQnow this is what you should see.

图片

TornaxO7 commented 3 years ago

oh, I didn't put this above require('coq')... it works now, thanks!

ms-jpq commented 3 years ago

yeah its in the faq, lol well hope you enjoy!

TornaxO7 commented 3 years ago

Oh god... I just found it....

This must be set BEFORE require("coq")

I'm sorry!

ms-jpq commented 3 years ago

haha dw! glad to help