Monday, June 21, 2021

Re: syntaxcomplete#Complete() and nested filetypes

On 2021-06-21, Lifepillar <lifepillar@lifepillar.me> wrote:
> I would like to use syntaxcomplete#Complete() in a filetype that
> includes a nested filetype.

This is what I have so far, which appears to be working in filetype
`foobar` with nested filetype `xyz`:

def foobarcomplete#Complete(findstart: number, base: string): any
if findstart == 1
syntaxcomplete#OmniSyntaxClearCache()

if len(synstack(line("."), 1)) > 0 &&
synIDattr(synstack(line("."), 1)[0], "name") ==# '^xyz'
g:omni_syntax_group_include_foobar = 'xyz\w\+'
else
unlet! g:omni_syntax_group_include_foobar
endif
endif

return syntaxcomplete#Complete(findstart, base)
enddef

If you have better ideas, let me know! I especially do not like that
I have to clear the cache.

Thanks,
Life.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/sappac%243eh%242%40ciao.gmane.io.

No comments:

Post a Comment