Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Emacs × LSP × Steep
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
a_fujisaki
September 05, 2024
Technology
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Emacs × LSP × Steep
a_fujisaki
September 05, 2024
More Decks by a_fujisaki
See All by a_fujisaki
自作マクロと型生成
aki19035vc
0
57
rails newと同時に型を書く
aki19035vc
6
1.3k
“Rails × 型”での2年間を振り返る
aki19035vc
2
1.2k
rbs-inlineを使ってみた
aki19035vc
0
1.1k
MiniMagickの型を生成したい
aki19035vc
0
170
最近追加した型の紹介とその振り返り
aki19035vc
0
900
Other Decks in Technology
See All in Technology
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
740
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
120
生成AIエージェントを用いた、 手動テスト手順書から自動テストへの 変換手法の検討
magicpod
0
160
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
370
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
510
LLMに渡さなかった仕事
nanaism
0
580
ソフトウェアDNAとクラウドエージェントのススメ
cloudace
0
110
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
130
ユーザー価値を届け続けるためにウォンテッドリーが大切にしている文化
kotaminato
0
170
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
4
1.3k
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
200
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
9
990
Featured
See All Featured
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
430
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
[SF Ruby Conf 2025] Rails X
palkan
3
1.4k
KATA
mclloyd
PRO
35
15k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
GraphQLとの向き合い方2022年版
quramy
50
15k
Faster Mobile Websites
deanohume
310
32k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
580
BBQ
matthewcrist
89
10k
Embracing the Ebb and Flow
colly
88
5.2k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Transcript
Emacs × LSP × Steep omotesando.rb#101 <2024-09-05> @aki19035vc
自己紹介 ❏ 藤崎 亮人 (a_fujisaki) ❏ @aki19035vc ❏ 所属: イタンジ株式会社
❏ バックエンドエンジニア ❏ 物件基盤の開発責任者 ❏ Rails × 型 の話が好き ❏ 学生の頃(2016年くらい)からEmacs使ってます
今日話すこと ❏ Emacs × LSP × Steep の話 ❏ EmacsでSteepを言語サーバとして使う時の困り事
❏ 言語サーバとしてのSteepの良いところ・物足りないところ ❏ 2日ほど業務で実際に使用した感想 ❏ 型が(ほぼ)100%入っており、steep checkに1分30秒くらいかかる ❏ ちょっとしたデモ $ rails stats +----------------------+--------+--------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+--------+--------+---------+---------+-----+-------+ | Controllers | 745 | 492 | 28 | 67 | 2 | 5 | | Jobs | 297 | 170 | 11 | 19 | 1 | 6 | | Models | 18131 | 12031 | 382 | 917 | 2 | 11 | | Libraries | 5634 | 4125 | 41 | 87 | 2 | 45 | | Libs | 397 | 225 | 6 | 22 | 3 | 8 | | Serializers | 4382 | 2998 | 164 | 204 | 1 | 12 | | Validators | 1671 | 846 | 163 | 55 | 0 | 13 | | Batches | 99 | 62 | 3 | 8 | 2 | 5 | | Usecases | 12167 | 8281 | 226 | 676 | 2 | 10 | +----------------------+--------+--------+---------+---------+-----+-------+ | Total | 43523 | 29230 | 1024 | 2055 | 2 | 12 | +----------------------+--------+--------+---------+---------+-----+-------+ Code LOC: 29230 Test LOC: 0 Code to Test Ratio: 1:0.0
用語の簡単な解説 ❏ Emacs ❏ 1970年代からあるテキストエディタ ❏ Emacs Lisp によって拡張できる ❏
Matzも使ってる ❏ LSPと言語サーバ ❏ Language Server Protocol => LSP ❏ コードの補完やシンタックスハイライト、エラーチェックなどの機能をエディタに提供する バックエンドプロセス ❏ Rubyだと Shopifyのruby-lsp や Solargraph が有名 ❏ Steep ❏ Rubyの型検査ツール ❏ 言語サーバとして使うこともできる
使用するバージョンとかライブラリとか ❏ Emacs: 29.2 ❏ LSPクライアントにはlsp-modeを使用 ❏ Eglotやlsp-bridgeについては未検証 ❏ Ruby:
3.3 ❏ Steep: 1.7.1
EmacsでSteepを言語サーバとして使うと、、、 ❏ 普通にやると上手くいかない ❏ lsp-mode付属のクライアントだと、ruby-lspやSolargraphといったメインとなる言語 サーバと同時に起動できない ❏ ruby-lspとSteepを頑張って同時起動できるようにしても、 ruby-lsp側の定義ジャンプ が使えなくなる
❏ Rubyファイルを開くとSteepが強制的に起動してしまう ❏ プロジェクトに Steepfileが存在しないとエラーになる ❏ ファイルを開くたびにエラーメッセージが表示されてしまう
EmacsでSteepを言語サーバとして使えるようにする ❏ 付属のクライアントを無効化し、自前でクライアントを作成・登録し直す ❏ 他の言語サーバと同時起動できるようにする ❏ 任意のディレクトリ以下のRubyファイルのみ有効化できるようにする ❏ メインの言語サーバはSolargraphを使う ❏
Steepと同時起動しても定義ジャンプが競合せず使える 何をしてるか気になる方は .emacs.d/init.elを見てください。 後日、lsp-modeに含まれるsteepのクライアントを拡張する PRは作る予定です。 https://github.com/aki19035vc/.emacs.d/blob/8bd3e263b4d21d3ac59a41f5bde9df165621a137/init.el#L458-L472
デモ: 定義ジャンプと型検査
言語サーバとしての Steep ❏ 良いところ ❏ 型があるオブジェクトに対する補完が完璧 ❏ 型定義へのジャンプができる ❏ 実装と型が一致しない部分が視覚的に分かりやすい
❏ 物足りないところ (※ あくまで自分の環境での話) ❏ rbsファイルが変更される度にsteep checkが走っていそうで、完了するまで激重 ❏ 型検査に時間がかかるようなアプリケーションを開発しているとつらい、、、 ❏ デフォルトだとプロセスが 9個立ち上げているようで、 CPUリソースが枯渇する ❏ rbsファイルを短時間で何度も変更すると型チェックが行われなくなってしまう ❏ 言語サーバを再起動するまで止まったまま
まとめ ❏ Emacs × LSP × Steep はちょっと頑張ればできる ❏ メソッド補完・リアルタイムな型検査による開発体験は素晴らしい
❏ 型検査に時間がかかるようなアプリケーションでは、Emacsが重たくなる → 総合的に見ると少しマイナス、、、 ❏ 今後の予定 ❏ 言語サーバ起動時にプロセス数を指定できそうなので、 Emascから起動する際に調整で きるようにして、プロセス数を抑える ❏ 型検査の実行頻度を減らせないか見てみる ❏ 敵情視察 (VS Code使ってみる)