Lsp owns transpile and rules - #180
Merged
Merged
Conversation
KotlinIsland
force-pushed
the
lsp-owns-transpile-and-rules
branch
4 times, most recently
from
August 17, 2026 08:05
ccf7833 to
4c1fcbb
Compare
Contributor
ecosystem checkLinter (stable)✅ ecosystem check detected no linter changes. Linter (preview)✅ ecosystem check detected no linter changes. Formatter (stable)✅ ecosystem check detected no format changes. Formatter (preview)✅ ecosystem check detected no format changes. |
KotlinIsland
force-pushed
the
lsp-owns-transpile-and-rules
branch
from
August 17, 2026 08:18
4c1fcbb to
5ffc63e
Compare
KotlinIsland
force-pushed
the
lsp-owns-transpile-and-rules
branch
3 times, most recently
from
August 17, 2026 10:24
d8080c6 to
e65259f
Compare
…both to a subprocess Three questions an editor asks that only this server can answer correctly, and that clients were spawning a CLI for: `by/transpile` gives the python a document lowers to, or the basedpython a python file reverses into. The difference from `by transpile <path>` is what it reads: a subprocess reads the file, and an editor's copy of a file is the buffer. Asking about a document with unsaved edits returned the last saved version of it, which is the wrong answer and a silent one. Answering here also transpiles against the project db the session already holds, so cross-module types resolve and the result cannot disagree with the diagnostics in the same window. `by/explainRule` and `buff/explainRule` give the documentation for one rule. Two tools own two disjoint sets of rules and neither knows the other's, so each answers for its own and reports a miss — not an error — for a name it does not have, leaving the client free to ask the other. Both renderers moved down into the crates that own the rules, so `by explain rule`, `buff rule` and the editor all show one rendering rather than three that drift. A transpile that fails travels as a result carrying the reason, not as a protocol error: source that does not lower yet is an ordinary state for a file being edited.
…r than from the text `by/explainTranspilation` reports every basedpython-specific construct in a document and what each lowers to. A client that wanted this had to guess from the source text — one regex for `?.`, another for `??`, another for `data class` — and a regex cannot tell an operator from the same characters inside a string or a comment, cannot see that `?` in a type position means something else, and drifts from the language the moment a construct is added. The parser here is the one the transpiler runs, so the answer is the one the lowering is about to act on. `?.` in particular is not looked for at all: the parser records it as a flag on the access, so this reports what was written rather than what the characters resemble. `by/transpile` also takes a fragment now. A selection has no document of its own, and the alternative — writing it to a temp file and running the CLI over that — is the thing the request exists to remove; the document it names is only what routes the request to a server.
KotlinIsland
force-pushed
the
lsp-owns-transpile-and-rules
branch
from
August 17, 2026 10:27
e65259f to
cb47b26
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.
No description provided.