logoalt Hacker News

firasdyesterday at 10:54 PM1 replyview on HN

LSPs don't really do this. They're like a better way to grep for something (so they do address the previous thing I said about listing all function names etc.) But they often don't say (depending on the particular LSP setup etc) this function ends at this char and they definitely don't then provide the text editing tool


Replies

throw478239yesterday at 11:42 PM

This is not accurate. Most LSPs do provide text editing tools, which the Language Server Protocol calls "code actions". These actions do things like: reorganizing imports, expanding macros, extracting a selection into a function, or converting one type of control flow into another (e.g. if to match). Common LSPs, like rust-analyzer and Ruff (Python) support code actions. Editors also expose code actions: Zed, for instance, exposes actions under the default keymap with the binding Command + .

source: https://microsoft.github.io/language-server-protocol/specifi... and https://microsoft.github.io/language-server-protocol/specifi...

show 1 reply