Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
LSPがもたらしたVimプラグインの変化に思いを馳せる
Search
Toshikazu Ohashi
April 18, 2019
Programming
2
1.3k
LSPがもたらしたVimプラグインの変化に思いを馳せる
ゴリラ.vim #3
https://gorillavim.connpass.com/event/126289/
Toshikazu Ohashi
April 18, 2019
Tweet
Share
More Decks by Toshikazu Ohashi
See All by Toshikazu Ohashi
無自覚にメンバーの心理的安全性を奪っていた経験から得た学び
lighttiger2505
142
190k
黒画面が最高のしごと道具である3つの理由
lighttiger2505
0
1.9k
Golangで作るSQL Language Server(sqls)
lighttiger2505
1
830
Connect with many developers from the small plugin
lighttiger2505
0
340
作ってわかる現代のVimのAutoComplete ~そしてVimConf2019へ~
lighttiger2505
3
1.6k
自社サービスのDjangoを 1.3から1.11(LTS)に アップグレードするまでの道のり
lighttiger2505
6
3.4k
ターミナルアプリケーションとしてのVim
lighttiger2505
0
530
Go Language Server 使うべし
lighttiger2505
5
2k
Goで作るインタラクティブなCLIコマンドとそのデザイン
lighttiger2505
0
770
Other Decks in Programming
See All in Programming
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
5
830
nekko cloudにおけるProxmox VE利用事例
irumaru
3
440
선언형 UI에서의 상태관리
l2hyunwoo
0
180
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
870
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
快速入門可觀測性
blueswen
0
400
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
340
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
240
情報漏洩させないための設計
kubotak
3
480
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
270
良いユニットテストを書こう
mototakatsu
8
3k
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Into the Great Unknown - MozCon
thekraken
33
1.5k
How STYLIGHT went responsive
nonsquared
96
5.2k
Agile that works and the tools we love
rasmusluckow
328
21k
Visualization
eitanlees
146
15k
GraphQLとの向き合い方2022年版
quramy
44
13k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Scaling GitHub
holman
459
140k
Side Projects
sachag
452
42k
What's in a price? How to price your products and services
michaelherold
243
12k
Transcript
-41͕ͨΒͨ͠ 7JNϓϥάΠϯͷมԽʹ ࢥ͍ΛͤΔ VimϓϥάΠϯιϜϦΤ(ݟश͍) @lighttiger2505 gollira.vim #3
ΠϯτϩμΫγϣϯ
͔ͳΓલʹ ͜ΜͳهࣄΛॻ͖·ͨ͠ • NeovimͰϞμϯͳPythonڥΛߏங͢Δ • https://qiita.com/lighttiger2505/items/ e0ada17634516c081ee7
શવϞμϯ ͡Όͳ͘ͳͬͯΔʂʁ
ͳ͔ͥ • LSP(Language Server Protocol)ͷӨڹ͕େ͖͍ • NeoVimͷϦϞʔτϓϥάΠϯͱ৽ػೳ͕ߋʹม ԽΛଅ͢
ຊͷςʔϚΰʔϧ • ςʔϚ • LSP͕VimͷϓϥάΠϯʹͲͷΑ͏ͳมԽΛͨ Β͔ͨ͠ • ΰʔϧ • Vimະͩʹൃల్্ʹ͋Δ
• զʑͦͷൃలʹߩݙͰ͖Δ
ΞδΣϯμ • LSP(Language Server Protocol)ͱͳʹ͔ • LSPΫϥΠΞϯτϓϥάΠϯͷհ • ϦϞʔτϓϥάΠϯͱͳʹ͔ •
VimϓϥάΠϯͷมԽ • ·ͱΊ
-41ͱͳʹ͔
-BOHVBHF4FSWFS ݴޠ։ൃπʔϧΛ౷߹ͨ͠αʔό w ࣗಈิ w ఆٛδϟϯϓ w ࢀরݕࡧFUD -BOHVBHF4FSWFS1SPUPDPM -41
-BOHVBHF4FSWFSͱΫϥΠΞϯτؒͰ༻͢Δϓϩτίϧ w .JDSPTPGU͕༷ࡦఆ 74$PEFͷͨΊʁ w +40/31$ϕʔε -41ͱͳʹ͔
͜Ε·ͰΤσΟλຖʹݴޠπʔϧΛར༻͢ΔϓϥάΠϯ͕ඞཁͩͬ ͨ w 74$PEFͷ1ZUIPOϓϥάΠϯ w "UPNͷ1ZUIPOϓϥάΠϯ w 7JNͷ1ZUIPOϓϥάΠϯ w 4VCMJNF5FYU
&NBDT 4PVSDFHSBQIFUD ݴޠίϛϡχςΟͷ։ൃϦιʔεΛ-BOHVBHF 4FSWFSʹूதͯ͠ߴ࣭ͳݴޠ։ൃπʔϧΛ࡞ Δ Ϣʔβ-41ΛαϙʔτΫϥΠΞϯτΛಋೖͯ͠ ͙͢ʹߴ࣭ͳݴޠͷαϙʔτΛڗडͰ͖Δ -41ͳͥඞཁ͔
.FUIPE ػೳ textDocument/completion ࣗಈิ textDocument/definition ఆٛδϟϯϓ textDocument/formatting ϑΥʔϚοτ textDocument/hover ώϯτදࣔ
textDocument/implementation ࣮(ܧঝ/ΠϯλϑΣʔε)ͷϦετ textDocument/rename ໊લมߋ textDocument/references γϯϘϧࢀরݕࡧ textDocument/documentSymbol υΩϡϝϯτγϯϘϧݕࡧ workspace/symbol ϫʔΫεϖʔεγϯϘϧݕࡧ -41ͷఏڙ͢Δػೳ
#FGPSF"GUFS
KFEJ HPDPEF BVUPQFQ qBLF JTPSU ZBSQ CMBDL HPEFG JNQM HVSV
HPMJOU 7JN ϦϯλʔϑΥʔϚολ ϓϥάΠϯ "-& ࣗಈิ EFPQMFUF (PݴޠπʔϧϓϥάΠϯ WJNHP 1ZUIPOݴޠπʔϧϓϥάΠϯ KFEJWJN 1ZUIPOิ EFPQMFUFKFEJ (Pิ EFPQMFUFHP
KFEJ HPDPEF BVUPQFQ qBLF JTPSU ZBSQ CMBDL HPEFG JNQM HVSV
HPMJOU ϦϯλʔϑΥʔϚολ ϓϥάΠϯ "-& ࣗಈิ EFPQMFUF (PݴޠπʔϧϓϥάΠϯ WJNHP 1ZUIPOݴޠπʔϧϓϥάΠϯ KFEJWJN 1ZUIPOิ EFPQMFUFKFEJ (Pิ EFPQMFUFHP 7JN 7JN
KFEJ HPDPEF BVUPQFQ qBLF JTPSU ZBSQ CMBDL HPEFG JNQM HVSV
HPMJOU 7JN ϦϯλʔϑΥʔϚολ ϓϥάΠϯ "-& ࣗಈิ EFPQMFUF (PݴޠπʔϧϓϥάΠϯ WJNHP 1ZUIPOݴޠπʔϧϓϥάΠϯ KFEJWJN 1ZUIPOิ EFPQMFUFKFEJ (Pิ EFPQMFUFHP 7JNϓϥάΠϯ
7JN ϦϯλʔϑΥʔϚολ ϓϥάΠϯ "-& ࣗಈิ EFPQMFUF (PݴޠπʔϧϓϥάΠϯ WJNHP 1ZUIPOݴޠπʔϧϓϥάΠϯ KFEJWJN
1ZUIPOิ EFPQMFUFKFEJ (Pิ EFPQMFUFHP KFEJ HPDPEF BVUPQFQ qBLF JTPSU ZBSQ CMBDL HPEFG JNQM HVSV HPMJOU ݴޠ։ൃπʔϧ
#FGPSF"GUFS
ࣗಈิ (deoplete) LSPิ (deoplete- vim-lsp) QZMT HPQMT Language Server Client
(vim-lsp) 7JN -41
ࣗಈิ (deoplete) LSPิ (deoplete- vim-lsp) QZMT HPQMT 7JN Language Server
Client (vim-lsp) -41 -BOHVBHF4FSWFS$MJFOU
ࣗಈิ (deoplete) LSPิ (deoplete- vim-lsp) 7JN Language Server Client (vim-lsp)
QZMT HPQMT -41 -BOHVBHF4FSWFS
Ϧιʔεͷूத (PݴޠπʔϧϓϥάΠϯ WJNHP 1ZUIPOݴޠπʔϧϓϥάΠϯ KFEJWJN Language Server Client (vim-lsp) 7JNTDSJQU
(P 7JNTDSJQU 1ZUIPO
(PݴޠπʔϧϓϥάΠϯ WJNHP 1ZUIPOݴޠπʔϧϓϥάΠϯ KFEJWJN Language Server Client (vim-lsp) 7JNTDSJQU0OMZ Ϧιʔεͷूத
Ϧιʔεͷूத (PݴޠπʔϧϓϥάΠϯ WJNHP (PݴޠπʔϧϓϥάΠϯ WTDPEFHP gopls 7JN (P 74$PEF (P
Ϧιʔεͷूத (PݴޠπʔϧϓϥάΠϯ WJNHP (PݴޠπʔϧϓϥάΠϯ WTDPEFHP gopls HPQMT
-41ΫϥΠΞϯτ ϓϥάΠϯͷհ
-41ࡾॐ࢜ • vim-lsp • LanguageClient-neovim • coc.nvim
WJNMTQ • Vim script • VimͱNeoVimͱߴͳޓੑ • NeoVimͷ৽ػೳैੵۃత
8JUI"VUP$PNQMFUF • asyncomplete.vim • asyncomplete-lsp.vim • deoplete.nvim • deoplete-vim-lsp •
ncm2 • ncm2-vim-lsp
-BOHVBHF$MJFOUOFPWJN • Rust(ϦϞʔτϓϥάΠϯ) • NeoVimͱ͍͍ͭͯΔ͕VimͰಈ͘ • LSPΫϥΠΞϯτͱͯ͠vim-lspͱಉఔͷ࣮ • fzfͳͲdenite.nvimͳͲͷ֎෦࿈ܞएׯڧ͍
ҹ
8JUI"VUP$PNQMFUF • deoplete.nvim • LanguageClient source(ϦϙδτϦʹಉࠝ) • ncm2
DPDOWJN • Type Script(ϦϞʔτϓϥάΠϯ) • nvimͱ͍͍ͭͯΔ͕VimͰಈ͘ • ࣗಈิʙͦͷଞΠϯςϦηϯε·Ͱશ෦ೖΓ • FloatingWindowରԠͷ͞
ϦϞʔτϓϥάΠϯ ͱͳʹ͔
/FP7JNʹ͍ͭͯҎԼࢀর • Differences between Nvim and Vim full version •
https://www.slideshare.net/Shougo/ differences-between-nvim-and-vim-full-version • Neovim͕Ͳ͏͍͏ϓϩδΣΫτͳͷ͔·ͱΊ • https://qiita.com/lighttiger2505/items/ 440c32e40082dc310c1e
ͬ͘͟Γ • Improve the extensibility power with a new plugin
architecture based on coprocesses. Plugins will be written in any programming language without any explicit support from the editor. • https://github.com/Neovim/Neovim/wiki/ Introduction • VimϓϥάΠϯΛVim scriptҎ֎ͷ͋ΒΏΔϓϩά ϥϜݴޠͰॻ͚Δ
ৄղ • :h remote_plugin • NeoVimRPCΛ௨ͯ͡ຊମૢ࡞Λߦ͑ΔAPIΛ උ͑Δ • ϦϞʔτϓϥάΠϯຊମͱผϓϩηεͰىಈ ͠msgpack-RPCͰ্هAPIͱ௨৴͢Δ
• ଟ͘ͷ߹௨৴ϥούʔ͞ΕͨϥΠϒϥϦΛ ༻͍Δ
/FP7JNͰ͔͠ಈ͔ͳ͍ʁ • NeoVimͷϦϞʔτϓϥάΠϯΛVimͰ༻Ͱ͖ΔΑ͏ ʹ͢Δϥούʔ͋Δ • ͔͠͠·࣮ͩݧతͳཱͪҐஔ • nvim-yarp • https://github.com/roxma/nvim-yarp
• vim-hug-neovim-rpc • https://github.com/roxma/vim-hug-neovim-rpc
7JNϓϥάΠϯͷมԽ
-41ΫϥΠΞϯτΔ͜ͱ ͕ͨ͘͞Μ • ࣗಈิ • ੩తղੳ • ίʔυδϟϯϓ • γϯϘϧݕࡧ/දࣔ
• ฤूதͷϑΝΠϧಉظ
-41ΫϥΠΞϯτΔ͜ͱ ͕ͨ͘͞Μ • Language Serverͱͷ௨৴(JSON-RPC2) • ඇಉظ • ߴ
-41ొʹΑΓ ϓϥάΠϯͷΔ͜ͱ͕ ͲΜͲΜ૿͍͑ͯ͘
7JNTDSJQUͷಛੑ • Vimʹࡌ͞Ε͍ͯΔͨΊɺผ్ϥϯλΠϜෆཁ • VimಠࣗͷείʔϓɺΠϕϯτϋϯυϦϯά • ΦϒδΣΫτࢦ(Ϋϥε)ͳͲݱతͳϓϩάϥ ϛϯάػೳͷܽ
ϦϞʔτϓϥάΠϯͰ ࡞ͬͨ΄͏͕ྑ͍ʁ • Vim scriptͷ΄͏͕؆୯ʹ͔͚Δ໘͋Δ • Vimͱͷೖग़ྗҎ֎ͷϩδοΫ͕૿͑ଓ͚Δͱ൚ ༻ϓϩάϥϜݴޠͷ΄͏͕༗རͳ໘͋Δ • ϞδϡʔϧԽɺߏԽ
·ͱΊ • LSPͷొʹΑͬͯϓϥάΠϯʹେ͖ͳมԽ • ݴޠΠϯςϦηϯεΛಘΔୈҰͷखஈͱͯ͠LSPΫϥΠΞϯτ ͕ొ • ͜Ε·ͰݸผʹඞཁͩͬͨϓϥάΠϯ͕LSPΫϥΠΞϯτ ʹ·ͱ·Δ •
LSPΫϥΠΞϯτ͕େ͖ͳϓϥάΠϯʹ • ϦϞʔτϓϥάΠϯͰ࣮͞ΕΔLSPΫϥΠϯτͷొ
Ͳ͏ͳΔͷ͔Θ͔Βͳ͍ • coc.nvimͷΑ͏ͳLSPΫϥΠΞϯτʹଞͷϓϥά Πϯͷػೳ͕શ෦Γ͜·ΕΔͷ͔ • খ͞ͳಛఆػೳͷϓϥάΠϯΛΈ߹Θ͍ͤͯ͘ ͷ͔ • ϕετϓϥΫςΟεͳ͘·ͩΈΜͳࡧ͍ͯ͠ Δঢ়گ
7JNʹ ·ͩ·ͩՄೳੑ͕͋Δ • VimރΕͯΔͱࢥ͕ͬͨͦΜͳ͜ͱͳ͔ͬͨ • ৽͍͠ϓϥάΠϯͲΜͲΜग़ͯ͘Δ • deoplete-vim-lsp࡞͕ͬͨΧ݄ޙ͏ϨΨγʔʹͳ ΔͷͰʁ •
·ͩ·֤ͩLSPΫϥΠΞϯτʹΓͳ͍෦ͳͲͨ͘͞ Μ͋Δ • ࢲୡߩݙ͢Δ͜ͱ͕Ͱ͖Δ
-FU`TFOKPZ ZPVS7JNMJGF