logoalt Hacker News

henrymerrileestoday at 5:08 AM0 repliesview on HN

The relevant points have already been made: (1) LSP is a JSON-RPC protocol, not a CLI app, and (2) Language Servers that implement LSP often utilize AST manipulation, even the resultant manipulations are exposed to the client via character ranges.

Still, these links may be of interest:

TypeScript’s language-service implementation of the “Move to file” refactor: https://github.com/microsoft/TypeScript/blob/main/src/servic...

Documentation for how `typescript-language-server` exposes that refactor as an opt-in code action: https://github.com/typescript-language-server/typescript-lan...

`ast-grep`, an AST-based search and transformation tool that may be closer in spirit to the cli functionality you describe, albeit more general-purpose: https://github.com/ast-grep/ast-grep