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
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Jakarta EE meets AI
ivargrimstad
0
630
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
Amazon Qを使ってIaCを触ろう!
maruto
0
410
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
役立つログに取り組もう
irof
28
9.6k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Speed Design
sergeychernyshev
25
620
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Writing Fast Ruby
sferik
627
61k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
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