Shougo / ddc-source-line

Line completion for ddc.vim
MIT License
9 stars 0 forks source link

It cannot complete when complex lines exists in vim filetype #1

Closed mopp closed 1 year ago

mopp commented 1 year ago

What I faced

The line auto completion does not work on some vim files. The other completion candidates also disappear in the case.

How to reproduce

I've used neovim.

:version
NVIM v0.10.0-dev-1299+g9abced6ad
Build type: Release
LuaJIT 2.1.1695653777
Run ":verbose version" for more info

minimal config

set nocompatible

noremap ; :
noremap : ;

let s:dein_base = '~/dein/'
let s:dein_src = '~/dein/repos/github.com/Shougo/dein.vim'
execute 'set runtimepath+=' .. s:dein_src

call dein#begin(s:dein_base)

call dein#add(s:dein_src)

call dein#add('Shougo/ddc.vim')
call dein#add('vim-denops/denops.vim')

call dein#add('Shougo/ddc-ui-native')

call dein#add('Shougo/ddc-source-around')
call dein#add('Shougo/ddc-source-line')

call dein#add('Shougo/ddc-filter-converter_remove_overlap')
call dein#add('Shougo/ddc-filter-matcher_head')
call dein#add('Shougo/ddc-filter-matcher_vimregexp')
call dein#add('Shougo/ddc-filter-sorter_rank')

call dein#end()

filetype plugin indent on

call ddc#custom#patch_global(#{
            \ ui: 'native',
            \ sources: ['around', 'line'],
            \ sourceOptions: #{
            \   _: #{
            \     matchers: ['matcher_head'],
            \     sorters: ['sorter_rank'],
            \     converters: ['converter_remove_overlap'],
            \   },
            \   around: #{mark: '[around]'},
            \   line: #{
            \     mark: '[line]',
            \     matchers: ['matcher_vimregexp'],
            \     maxAutoCompleteLength: 1000,
            \   },
            \ },
            \ })
call ddc#enable()

syntax enable

target vim file

noremap <silent> j gj
noremap <silent> k gk
noremap ; :
noremap : ;

autocmd BufWinEnter *.nas                nested setlocal filetype=nasm
autocmd BufWinEnter *.plt                nested setlocal filetype=gnuplot
autocmd BufWinEnter *.sh                 nested setlocal filetype=sh
autocmd BufWinEnter *.toml               nested setlocal filetype=toml
autocmd BufWinEnter *.{md,mdwn,mkd,mkdn} nested setlocal filetype=markdown
autocmd BufWinEnter *.{pde,ino}          nested setlocal filetype=arduino

" These lines exist
" can complete when inputting `no`
" cannot complete when inputting `autocmd`
autocmd FileType * setlocal nu nu nu nu nu nu nu nu nu nu nu nu nu nu nu nu nu
autocmd FileType * setlocal wildignorecase wildignorecase wildignorecase

" This line exitsts
" cannot complete when inputting `no`
" can complete when inputting `nor`
" cannot complete when inputting `autocmd`
autocmd FileType lisp setlocal nocindent nosmartindent lisp lispwords=define

" It works
" Probably, the length of the line or the number of spaces in the line affects?
autocmd FileType * setlocal nu nu nu nu nu nu nu nu nu nu nu nu nu nu nu nu

References

Shougo commented 1 year ago

Reproduced. But it is feature of ddc.vim.

  " NOTE: If the input text is longer than 'textwidth', the completed text
  " will be the next line.  It breaks auto completion behavior.
Shougo commented 1 year ago

Fixed. Please update ddc.vim.

mopp commented 1 year ago

I confirmed that it works as I expected after the commit. Thank you for your support :+1: https://github.com/Shougo/ddc.vim/commit/1ebbb24b8d4aa297f9c1733581aa92b47a0b17f6