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
Emacs で LSP を使ってみたよ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Taiju Aoki
January 23, 2019
Programming
1.5k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Emacs で LSP を使ってみたよ
Slide for M3 TechTalk
Taiju Aoki
January 23, 2019
More Decks by Taiju Aoki
See All by Taiju Aoki
本番運用中 Oracle を破壊してしまった話 ~ 破壊と創世 ~ / Oracle Destruction and Creation
blue0513
0
3.2k
オンプレ to オンプレした話/on-premises2on-premises
blue0513
0
3.2k
GitもCIもテストもないプロジェクトでデプロイを自動化するまでの道 / rebuild of DevOps
blue0513
0
3.4k
Git & GitLab & コードレビューって? / about Git, GitLab, CodeReview
blue0513
0
270
ElectronでSlackをさらに便利にしちゃう / Slack with Electron
blue0513
3
920
GitHub の README をいい感じにする / Cool Readme
blue0513
3
1.7k
Emacs × Sound やってみた / Emacs with Sound
blue0513
1
1.1k
Slack を TweetDeck にしてみた件 / slackdeck-proto
blue0513
0
3.1k
知ってるとお得な iTerm2 と zsh/bash の小技
blue0513
3
890
Other Decks in Programming
See All in Programming
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
240
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
190
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
840
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
act1-costs.pdf
sumedhbala
0
200
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
1
470
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
460
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
240
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
270
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
840
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
260
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.7k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
410
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Paper Plane
katiecoart
PRO
1
52k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
Evolving SEO for Evolving Search Engines
ryanjones
0
240
Ruling the World: When Life Gets Gamed
codingconduct
0
280
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
490
Transcript
Emacs Ͱ LSP ΛͬͯΈͨΑ @blue_1617
Who Am I ‣ VTuber ͱ Emacs ͖ͷ ‣ ࣾձਓ
10ϲ݄ ͷεʔύʔΤϯδχΞ blue (@blue_1617) ࠷ۙͷ Emacs ͳ׆ಈ ‣ ౦ژ Emacs ձ 2018 ‣ (nth 2 shibuyaku-elisp) ‣ GitHub/flycheck-flash-mode-line ‣ GitHub/electron-desktop-character ࠷ۙͷ OSS ͳ׆ಈ ‣ GitHub/cycle-frame-transparency ࠷ۙͷ Qiita ͳ׆ಈ ‣ Emacs Ͱ LSP Λ׆༻ͯ͠ΈΔ ‣ 2018͚ͩͲσεΫτοϓϚείοτΛ ࡞Γ͔ͨͬͨΜͩ ‣ Emacs ΛϫϯίϚϯυͰಁաͤ͞Δ ‣ flycheck Ͱ Emacs ͷ Mode Line ΛޫΒͤΔ ‣ counsel-recentf ͷରΛ Project ϑΝΠϧ ʹߜΔ ‣ Emacs Ͱࣗ࡞ؔΛͬͯΈΔ ࠷ۙ࡞ͬͨϙʔτϑΥϦΦ (https://blue0513.github.io/show_room/)
ࣄͷൃ Emacs ͬͯ V̋Cőe ʹൺͯ ิͱ͔ఆٛࢀরೳྗ͕͘ͳ͍ʁ ͱͯେ͖ͳͩ…… LSP Λ͑ղܾ͢ΔΒ͍͠
ࣄͷൃ Emacs ͬͯ V̋Cőe ʹൺͯ ิͱ͔ఆٛࢀরೳྗ͕͘ͳ͍ʁ ͱͯେ͖ͳͩ…… LSP Λ͑ղܾ͢ΔΒ͍͠ LSP
Ͱ Emacs Λڧ͍ͨ͘͠ʂ
LSPͱʁ Language Server Protocol (JSON-RPC) Development Tool Notification: textDocument/didChange; Params:
{documentURI, changes} Notification: textDocument/publishDiagnostics; Params: Diagnostic[] Language Server Request: textDocument/definition; Params: {documentURI, position} Notification: textDocument/didOpen; Params: document Open document Edit document Goto definition Publish Publish Response: textDocument/definition; Result: Location https://microsoft.github.io/language-server-protocol/overview
LSPͱʁ Language Server Protocol (JSON-RPC) Notification: textDocument/didChange; Params: {documentURI, changes}
Notification: textDocument/publishDiagnostics; Params: Diagnostic[] Language Server Request: textDocument/definition; Params: {documentURI, position} Notification: textDocument/didOpen; Params: document Open document Edit document Goto definition Publish Publish Response: textDocument/definition; Result: Location https://microsoft.github.io/language-server-protocol/overview Development Tool ΤσΟλͱ͔
LSPͱʁ Language Server Protocol (JSON-RPC) Development Tool Notification: textDocument/didChange; Params:
{documentURI, changes} Notification: textDocument/publishDiagnostics; Params: Diagnostic[] Request: textDocument/definition; Params: {documentURI, position} Notification: textDocument/didOpen; Params: document Open document Edit document Goto definition Publish Publish Response: textDocument/definition; Result: Location https://microsoft.github.io/language-server-protocol/overview Language Server ιʔείʔυͷղੳΛͯ͘͠ΕΔαʔό ʢϩʔΧϧʹཱͯΒΕΔʣ
LSPͱʁ https://microsoft.github.io/language-server-protocol/implementors/servers/ ݴޠ͝ͱͷ Language Server ʢ܈༤ׂڌͳঢ়ଶʣ
LSPͱʁ Development Tool Notification: textDocument/didChange; Params: {documentURI, changes} Notification: textDocument/publishDiagnostics;
Params: Diagnostic[] Request: textDocument/definition; Params: {documentURI, position} Notification: textDocument/didOpen; Params: document Open document Edit document Goto definition Publish Publish Response: textDocument/definition; Result: Location https://microsoft.github.io/language-server-protocol/overview Language Server ͜Ε͕ LSP ΤσΟλͱαʔόؒͷ௨৴ϓϩτίϧ Language Server Protocol (JSON-RPC)
LSPͱʁ Language Server Protocol (JSON-RPC) Development Tool Notification: textDocument/didChange; Params:
{documentURI, changes} Notification: textDocument/publishDiagnostics; Params: Diagnostic[] Language Server Request: textDocument/definition; Params: {documentURI, position} Notification: textDocument/didOpen; Params: document Open document Edit document Goto definition Publish Publish Response: textDocument/definition; Result: Location https://microsoft.github.io/language-server-protocol/overview
LSPͱʁ Language Server Protocol (LSP) ͱ..... ݴޠͷղੳͳͲΛߦ͏ Language Server ͱ֤πʔϧʢClientʣ͕
௨৴ɾ࿈ܞ͢ΔࡍͷϓϩτίϧΛنఆ͢Δͷ ‣ ֤πʔϧ Language Server ͕ͲͷݴޠΛѻ͍ͬͯΔ͔Λҙࣝ͢ Δ͜ͱͳ͘ɺิఆٛࢀরΛߦ͑Δ ϝϦοτ..... https://microsoft.github.io/language-server-protocol/ ‣ Emacs ͷΤσΟλͷ ิɾఆٛࢀরೳྗ্͕ ͢Δ
LSPͱʁ Language Server Protocol (LSP) ͱ..... ݴޠͷղੳͳͲΛߦ͏ Language Server ͱ֤πʔϧʢClientʣ͕
௨৴ɾ࿈ܞ͢ΔࡍͷϓϩτίϧΛنఆ͢Δͷ ‣ ֤πʔϧ Language Server ͕ͲͷݴޠΛѻ͍ͬͯΔ͔Λҙࣝ͢ Δ͜ͱͳ͘ɺิఆٛࢀরΛߦ͑Δ ϝϦοτ..... https://microsoft.github.io/language-server-protocol/ ‣ Emacs ͷΤσΟλͷ ิɾఆٛࢀরೳྗ্͕ ͢Δ LSP Ͱ Emacs ͕ڧ͘ͳΔʂ ͬͨͥ
Emacs Ͱ LSP Λ׆༻ͯ͠ΈΔ Developer Tool Language Server Language Server
Protocol (JSON-RPC) (Host) Development Tool Ruby JavaScript Java Request: textDocument/definition Response: Location https://microsoft.github.io/language-server-protocol/overview
Demo (Emacs & LSP)
ઃఆ Language Server : solargraph Client Package : eglot EmacsͰLSPΛ׆༻ͯ͠ΈΔ
(https://qiita.com/blue0513/items/acc962738c7f4da26656) https://github.com/joaotavora/eglot https://github.com/castwide/solargraph Step1. Install Language Server Step2. Edit init.el $ gem install solargraph (add-hook 'ruby-mode-hook 'eglot-ensure)
ิ ‣ String.class ͳΒɺto_i ͕αδΣετ͞ΕΔ ‣ Array.class ͳΒɺto_h ͕αδΣετ͞ΕΔ
ิ ‣ Πϯελϯεϝιου αδΣετ͞ΕΔ ‣ `Subscription#to_param` ΛαδΣετ
ఆٛࢀর `Subscription.confirm` ʹఆٛδϟϯϓ͢Δʂ
ࢀরݕࡧ 'Subscription.confirm' ͷࢀরՕॴΛݕࡧ͢Δʂ
͓·͚ ~ Rails ͷิ ~ $ yard gems $ solargraph
config 3. `.solargraph.yml` Λฤू 2. `.solargraph.yml` Λੜ 1. Installed gem ʹ document ੜ https://github.com/castwide/solargraph/issues/87
͓·͚ ~ Rails ͷิ ~ `ActiveRecord` ͳͲ͕ީิͱͯ͠αδΣετ͞ΕΔʂ
͓·͚ ~ Rails ͷิ ~ `ActiveRecord` ͳͲ͕ީิͱͯ͠αδΣετ͞ΕΔʂ LSP Ͱ Emacs
͕ڧ͘ͳͬͨʂ ͬͨͥ
Emacs Ͱ LSP Λࢼͨ͠ײ ‣ ิɾఆٛࢀরɾࢀরݕࡧ͔ͳΓߴϨϕϧ ‣ Good Point ‣
Problematic Point ‣ ಋೖ͕ͱͯखܰ ‣ େنϓϩδΣΫτͩͱগ͠ಈ࡞͕ॏ͍ ‣ খنϓϩδΣΫτͳΒߴಈ࡞ ‣ Language Server & Client ͕܈༤ׂڌ
࠷ޙʹ ‣ LSP ੌ͍ ‣ Emacs ੌ͍ ‣ Ruby Project
ͰิఆٛࢀরΛ࣮ߦ ‣ εϐʔυײ͋;ΕΔ։ൃʢΫϥΠΞϯταΠυ܈༤ׂڌʣ ‣ LSP ͷ **ྗ** ΛआΓͯ V̋Cőe ʹෛ͚ͳ͍ิೳྗ ‣ 3rd party ͷ࿈ܞϥΠϒϥϦΛಠࣗ։ൃͰ͖Δ LSP ͱ Emacs ͍͍ͧ