girishji / vimcomplete

Async autocompletion for Vim.
MIT License
111 stars 4 forks source link

Cannot use omnifunc for some filetypes when LSP is enabled (for any other filetype) #65

Closed khardix closed 3 months ago

khardix commented 3 months ago

I'm trying to use omnifunc for filetypes where a LSP is not available or not suitable for me. Minimal example:

vim9script

final complete_options = {
    omnifunc: {
        enable: true,
        filetypes: ['tex'],
    },
    lsp: {
        enable: true,
        filetypes: ['python'],
    },
}
autocmd VimEnter * g:VimCompleteOptionsSet(complete_options)

When editing *.tex file, the omnifunc completor is reported as enabled:

{'name': 'omnifunc', 'priority': 8, 'completor': function('vimcomplete#omnifunc#Completor')}

However, no entries are being completed unless I directly invoke <C-x><C-o>. On the other hand, when I set lsp: {enable: false, …} in the options, the omnifunc completions springs to life automatically as I would expect. No LSP for Python then, though. 🙁

I suspect the following line is the culprit: https://github.com/girishji/vimcomplete/blob/4c80d44b8776c125a55cd506b6e5a4478c3d0d7d/autoload/vimcomplete/omnifunc.vim#L14

This should probably check if LSP is enabled for the current buffer, not globally (if I'm reading that correctly).

girishji commented 3 months ago

Fixed the bug. Please try again.

khardix commented 3 months ago

Now it works! Thanks!