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
141
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
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Security_for_introducing_eBPF
kentatada
0
110
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
3
370
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
Symfony Mapper Component
soyuka
2
730
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
From Translations to Multi Dimension Entities
alexanderschranz
2
130
Featured
See All Featured
Done Done
chrislema
181
16k
A Philosophy of Restraint
colly
203
16k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Optimizing for Happiness
mojombo
376
70k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
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