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
黒画面が最高のしごと道具である3つの理由
lighttiger2505
0
200
Golangで作るSQL Language Server(sqls)
lighttiger2505
1
680
Connect with many developers from the small plugin
lighttiger2505
0
290
作ってわかる現代のVimのAutoComplete ~そしてVimConf2019へ~
lighttiger2505
3
1.5k
自社サービスのDjangoを 1.3から1.11(LTS)に アップグレードするまでの道のり
lighttiger2505
6
3.3k
ターミナルアプリケーションとしてのVim
lighttiger2505
0
470
Go Language Server 使うべし
lighttiger2505
5
1.9k
Goで作るインタラクティブなCLIコマンドとそのデザイン
lighttiger2505
0
720
GUI is not fast enough!! (GUIには速さが足りないっ!!)
lighttiger2505
0
500
Other Decks in Programming
See All in Programming
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
イマのCSSでできる インタラクション最前線 + CSS最新情報
clockmaker
3
440
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.2k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Ruby is Unlike a Banana
tanoku
97
11k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Scaling GitHub
holman
458
140k
Automating Front-end Workflow
addyosmani
1366
200k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
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