Shougo / deoplete.nvim

:stars: Dark powered asynchronous completion framework for neovim/Vim8
Other
5.94k stars 295 forks source link

[Question] How can I prevent the completion from appearing after the semicolon? #1166

Closed nabezokodaikon closed 3 years ago

nabezokodaikon commented 3 years ago

Problems summary

After typing a semicolon at the end, a completion popup appears.

Expected

I don't want the completion popup to appear after I type a semicolon at the end.

Environment Information

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if &compatible
    set nocompatible
endif

filetype off
filetype plugin indent off

let $CACHE = expand('~/.cache')
if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif

let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif

if !dein#load_state(s:dein_dir)
    finish
endif

call dein#begin(s:dein_dir, expand('<sfile>'))

call dein#add('neovim/nvim-lspconfig')
call dein#add('Shougo/deoplete.nvim')
call dein#add('Shougo/deoplete-lsp')

call dein#end()
call dein#save_state()

if has('vim_starting') && dein#check_install()
    call dein#install()
endif

lua require'lspconfig'.tsserver.setup{}

call deoplete#custom#option('sources', {'typescript': ['lsp']})
call deoplete#enable()

How to reproduce the problem from neovim/Vim startup (Required!)

  1. $ mkdir -p issue/src
  2. $ cd issue
  3. $ yarn init -y
  4. $ yarn add --dev typescript
  5. $ yarn add --dev @types/node
  6. $ ./node_modules/.bin/tsc --init --rootDir src --outDir dist --esModuleInterop --resolveJsonModule --lib es6,dom --module commonjs
  7. $ touch src/index.ts
  8. $ nvim src/index.ts

Screenshot (if possible)

スクリーンショット 2021-02-25 1 03 49
Shougo commented 3 years ago

Note: This is not deoplete problem. It is just deoplete-lsp problem.

Shougo commented 3 years ago

You can configure input_pattern.

call deoplete#custom#source('lsp', 'input_pattern', '[a-zA-Z_]\w*$')
nabezokodaikon commented 3 years ago

Note: This is not deoplete problem. It is just deoplete-lsp problem.

I made a mistake again. sorry.

nabezokodaikon commented 3 years ago

You can configure input_pattern.

call deoplete#custom#source('lsp', 'input_pattern', '[a-zA-Z_]\w*$')

it is complete. Thank you for teaching me.

Shougo commented 3 years ago

lsp source checks all inputs unfortunately.

nabezokodaikon commented 3 years ago

I see.