Skip to content

Lsp owns transpile and rules - #180

Merged
KotlinIsland merged 2 commits into
mainfrom
lsp-owns-transpile-and-rules
Aug 17, 2026
Merged

Lsp owns transpile and rules#180
KotlinIsland merged 2 commits into
mainfrom
lsp-owns-transpile-and-rules

Conversation

@KotlinIsland

Copy link
Copy Markdown
Owner

No description provided.

Base automatically changed from format to main August 17, 2026 06:15
@KotlinIsland
KotlinIsland force-pushed the lsp-owns-transpile-and-rules branch 4 times, most recently from ccf7833 to 4c1fcbb Compare August 17, 2026 08:05
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

ecosystem check

Linter (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
KotlinIsland changed the base branch from main to fix-django-tests August 17, 2026 08:10
@KotlinIsland
KotlinIsland force-pushed the lsp-owns-transpile-and-rules branch from 4c1fcbb to 5ffc63e Compare August 17, 2026 08:18
Base automatically changed from fix-django-tests to main August 17, 2026 08:52
@KotlinIsland
KotlinIsland force-pushed the lsp-owns-transpile-and-rules branch 3 times, most recently from d8080c6 to e65259f Compare August 17, 2026 10:24
…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
KotlinIsland force-pushed the lsp-owns-transpile-and-rules branch from e65259f to cb47b26 Compare August 17, 2026 10:27
@KotlinIsland
KotlinIsland merged commit 3ee6399 into main Aug 17, 2026
49 of 56 checks passed
@KotlinIsland
KotlinIsland deleted the lsp-owns-transpile-and-rules branch August 17, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant