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
a_fujisaki
September 05, 2024
Technology
300
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
59
rails newと同時に型を書く
aki19035vc
6
1.3k
“Rails × 型”での2年間を振り返る
aki19035vc
2
1.2k
rbs-inlineを使ってみた
aki19035vc
0
1.1k
MiniMagickの型を生成したい
aki19035vc
0
170
最近追加した型の紹介とその振り返り
aki19035vc
0
910
Other Decks in Technology
See All in Technology
AIに攻撃される前に、AIに攻撃させる
tsuchikazu
0
160
freeeらしさをAIとともに作る / Creating the freee Experience with AI
ymrl
0
210
私の推しは「聞いてから進む」AIです -AI-DLCに一人でアプリを作らせた話
yama3133
1
180
Deep Data Security 機能解説
oracle4engineer
PRO
2
730
AI時代だからこそ推したい!Gitコマンド再入門
munakata
0
160
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
340
Lambda MicroVMsが分からなすぎたので使い所を1から考えてみた
tsukuboshi
2
430
しろおびから始める!ログ活用の第一歩
shumei_ito
0
700
go-sqletch
moznion
0
110
The seven pitfalls of AI (revised version)
ufried
0
300
無理せず続ける、子育てエンジニアの学び
codmoninc
PRO
0
490
AI駆動開発、viviONの1年 ── うまくいったこと・いかなかったこと
vivion
0
270
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
580
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
350
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
530
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Building Applications with DynamoDB
mza
96
7.2k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
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使ってみる)