Shougo / neocomplcache.vim

Ultimate auto-completion system for Vim.
http://www.vim.org/scripts/script.php?script_id=2620
1.72k stars 135 forks source link

neocomplcache使用時にVimが暴走する #423

Closed Shougo closed 11 years ago

Shougo commented 11 years ago

https://github.com/vim-jp/issues/issues/403 から移転。

scriptencoding utf-8

set nocompatible
filetype off

set rtp+=$VIM/dotfiles/neobundle.vim/

if has('vim_starting')
    call neobundle#rc(expand($VIM."/.vim/neobundle"))
endif

NeoBundle "Shougo/neocomplcache"
NeoBundle "cakebaker/scss-syntax.vim"

filetype plugin indent on

" 有効にする
let g:neocomplcache_enable_at_startup=1
再現手順

    vim を起動
    set filetype = scss.css
    Insert に入って適当に書き込む
    フリーズ(補完処理が走るタイミング?)

状況

タイミング的には補完処理が走る時にフリーズしたような感じがしました。
上の vimrc で neocomplcache を使用しないようにしたらフリーズしなくなったのでそこら辺に原因があるのではないでしょうか。
また Kaoriya 版 Vim 7.3.969 でも同様の環境、手順で試してみましたがこちらのバージョンでは再現しませんでした。
Shougo commented 11 years ago

7.3.969で再現しないという事は、neocomplcacheが使用している正規表現パターンがNFAエンジンのバグを付いている可能性もあります。neocomplcacheの単なるバグで無限ループになっている可能性もあります。

ひとまず、私の環境で再現するかの調査から始めます。

Shougo commented 11 years ago

すみません。私の環境では再現できませんでした。

使用したスクリプトは以下です。私の環境に合わせ、スクリプトを少し書き直しました。この.vimrcを起動時に読み込むだけで自動に処理を行うようにしています。 なぜかset filetype=scssとやってもsyntax/scss.vimが読み込まれなかったので、無理やりruntime!で読み込むことにしました。

scriptencoding utf-8

set nocompatible
filetype off

set rtp+={最新版のneobundle.vimへのパス}
set rtp+={最新版のneocomplcache.vimへのパス}

if has('vim_starting')
    call neobundle#rc('~/.bundle')
endif

NeoBundle "cakebaker/scss-syntax.vim"

filetype plugin indent on

" 有効にする
call neocomplcache#initialize()

set filetype=scss

runtime! syntax/scss.vim

autocmd VimEnter * NeoComplCacheCachingSyntax

neocomplcacheにデバッグメッセージを埋め込みましたが、syntax補完は正常に候補を出しています。

Shougo commented 11 years ago

使用したVim: 7.3.1078 neocomplcache: a20f1c9

Shougo commented 11 years ago

それっぽいのが再現しました。osyoさんの手順だと再現が無理で、scssファイルを用意してそれを開いた際にフリーズするようです。<c-c>で復帰できます。

Shougo commented 11 years ago

原因が判明しました。filetypeの判別で無限ループになっているようです。今は時間がないので、修正にはもう少しかかります。

Shougo commented 11 years ago

問題の修正が完了しました。syntaxファイルの有無は関係なく、:set filetype=css.scssとするだけで暴走していました。

nyangry commented 11 years ago

:smiley: