feat(server): add persistent on-type indentation - #1986
Open
rgrinberg wants to merge 1 commit into
Open
Conversation
Implement textDocument/onTypeFormatting by lazily starting a persistent ocp-indent RPC helper and reusing it across newline requests. Package the helper, negotiate its Csexp protocol, support OCaml and ocamllex syntax, and shut it down with the server. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
rgrinberg
force-pushed
the
push-pquxlulnwpov
branch
from
July 30, 2026 11:16
57a3f42 to
ec3e6da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement
textDocument/onTypeFormattingfor OCaml and ocamllex files using a separately packaged, optionalocp-indent-rpchelper.The server resolves the helper lazily, negotiates a canonical S-expression protocol, and serializes requests through one persistent process. Newline-triggered requests update only the new line's leading whitespace; missing or failed helpers degrade to no edits. The helper caches resolved
.ocp-indentconfiguration and is shut down with the server.This also adds package metadata, Nix packaging, documentation, and end-to-end coverage for lazy startup and process reuse.