From 3996dc68e61991b51622e5aa97ddfbe57212b455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=94=E8=B5=A4?= Date: Mon, 15 Jan 2024 17:48:32 +0800 Subject: [PATCH] bugfix for txt filetype completion --- autoload/easycomplete/popup.vim | 7 +++++-- autoload/easycomplete/util.vim | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/easycomplete/popup.vim b/autoload/easycomplete/popup.vim index e7390728..c6cd5f5c 100644 --- a/autoload/easycomplete/popup.vim +++ b/autoload/easycomplete/popup.vim @@ -331,7 +331,7 @@ function! s:popup(info) endif return endif - call s:InitBuf(info, 'popup', &filetype) + call s:InitBuf(info, 'popup', getbufvar(bufnr(), "&filetype")) let prevw_width = easycomplete#popup#DisplayWidth(info, g:easycomplete_popup_width) let prevw_height = easycomplete#popup#DisplayHeight(info, prevw_width, 'popup') - 1 let opt = { @@ -408,7 +408,10 @@ endfunction " buftype: float/popup " ft: filetype function! s:InitBuf(info, buftype, ft) - let ft = empty(a:ft) ? &filetype : a:ft + let ft = empty(a:ft) ? getbufvar(bufnr(), "&filetype") : a:ft + if empty(ft) + let ft = "txt" + endif if !s:buf[a:buftype] if s:is_vim noa let s:buf[a:buftype] = bufadd('') diff --git a/autoload/easycomplete/util.vim b/autoload/easycomplete/util.vim index f3ea883c..b502a118 100644 --- a/autoload/easycomplete/util.vim +++ b/autoload/easycomplete/util.vim @@ -1523,6 +1523,10 @@ function! easycomplete#util#GetLspItem(vim_item) return lsp_item endfunction " }}} +function! s:filetype() + return getbufvar(bufnr(), "&filetype") +endfunction + " {{{ BadBoy " 对 lsp response 的过滤,这个过滤本来应该 lsp 给做掉,但实际 lsp " 偷懒都给过来了, 导致渲染很慢, v:true === isBad