Open 0xBADDCAFE opened 2 years ago
@0xBADDCAFE I think, it fix this problem to register autocmd FIieType
for vim_lsp_suggest
.
Sorry, vim_lsp_suggest_ps1
augroup has already defined and registered autocmd FIieType
.
Why did you happen this problem?
本文に英語で記載した内容ですが、私は英語が苦手なので日本語で詳細に記載してみます。
Vim 本体の package 機能でプラグインを管理している場合、 'packpath'
内ディレクトリのプラグインは恐らくディレクトリの alphabet 順に登録されるはずです。その際に vim-lsp-settings よりあとになる filetype plugin(この場合は vim-ps1)があると、autocmd の登録順も vim-lsp-settings よりあとになります(本文のコードブロック参照)。
すると LSP が実行されて欲しいファイルを開いた際に、autocmd 順に従って filetype 設定より先に s:vim_lsp_suggest_plugin()
が実行され、LSP Plugin の前提となるであろう filetype plugin のインストール有無に関わらずインストールするように suggest message が出ます。
vim-lsp-settings
のディレクトリ名を z-vim-lsp-settings
と変更し、package 機能による runtimepath 登録順を変更するとメッセージが表示されなくなりました。
なおここでは package 機能を利用しているため alphabet 順に依存していますが、実際のところは runtimepath に登録された順に依存すると考えたのでこのようなタイトルとしてあります。
なるほど、理解しました。vim-lsp-settings側がインストールしてくださいと指示しているのはLSPではなくpluginなんですね。で、s:vim_lsp_suggest_plugin()
は冒頭で&filetype
が空でなければ終了しています。s:vim_lsp_suggest_plugin()
の実行をfiletypedetect
augroupの終了まで明確に待てば解決する気がします。
My pack path has plugins
vim-lsp-settings
andvim-ps1
. Vim loadvim-lsp-settings
first and next loadvim-ps1
. Soautocmd
order should be there:This causes that
s:vim_lsp_suggest_plugin()
is called beforeset ft=ps1
.Renaming
vim-lsp-setting
toz-vim-lsp-setting
to change order disappears the suggest message.