lsp: language server features for receiver scripts (SCRIPT-RECEIVERS slice 5) #515

Open
opened 2026-10-26 21:47:21 +00:00 by orion · 5 comments
Collaborator

Slice 5 of docs/design/SCRIPT-RECEIVERS.md section 12 (the design record landed with PR #519). Part of epic #518.

Language server features for scripts (section 7).

Scope

  • A script is a module of the front with its receiver from the nearest project.trb mapping, else inferred from the literal loads the server can see, else untyped (drop the receiver special cases in analysis.trb, projects.trb, workspace.trb).
  • Hover on implicit receiver members, self, the pattern (matched files) and receiver:; completion of receiver members; definition (member, receiver:, from:, load literal); references of a receiver type incl. scripts lines and mapped scripts; rename of the type rewrites receiver:; document links; semantic tokens; quick fixes ("Add to project.trb" on the D15 hint, "Load it as U" on D14).
  • torbscript/scriptReceivers request.

Acceptance

  • tests/lsp/ session: a mapped script opened alone gets hover, completion and definition into the receiver type.
  • tests/lsp/ session: an unmapped script opened alone is untyped and gets no diagnostics; the same script in a project whose literal load names it is typed from the load.
  • References of ServerConfig in config-dsl include the scripts line and config.trb.
  • Rename of a receiver type updates receiver: in project.trb.
  • torbscript/scriptReceivers answers per document and per project (source mapping/load, or notMatched for an untyped script), pinned in compiler/tests/language-server.test.trb.

Amended 2026-10-26 (owner): the scripts mapping is optional; unmapped scripts stay valid and are typed by inference from literal Sandbox.load calls, else untyped (SCRIPT-RECEIVERS.md sections 1, 5, 6).$\n\nDecided 2026-10-26 (owner): the "Add to project.trb" quick fix on the D15 hint is always offered, by default and not configurable. Extra acceptance:

  • The quick fix is offered for every unmapped literal load without any server setting.
Slice 5 of `docs/design/SCRIPT-RECEIVERS.md` section 12 (the design record landed with PR #519). Part of epic #518. Language server features for scripts (section 7). Scope - A script is a module of the front with its receiver from the nearest `project.trb` mapping, else inferred from the literal loads the server can see, else untyped (drop the receiver special cases in `analysis.trb`, `projects.trb`, `workspace.trb`). - Hover on implicit receiver members, `self`, the pattern (matched files) and `receiver:`; completion of receiver members; definition (member, `receiver:`, `from:`, load literal); references of a receiver type incl. `scripts` lines and mapped scripts; rename of the type rewrites `receiver:`; document links; semantic tokens; quick fixes ("Add to project.trb" on the D15 hint, "Load it as `U`" on D14). - `torbscript/scriptReceivers` request. Acceptance - [ ] `tests/lsp/` session: a mapped script opened alone gets hover, completion and definition into the receiver type. - [ ] `tests/lsp/` session: an unmapped script opened alone is untyped and gets no diagnostics; the same script in a project whose literal load names it is typed from the load. - [ ] References of `ServerConfig` in config-dsl include the `scripts` line and `config.trb`. - [ ] Rename of a receiver type updates `receiver:` in `project.trb`. - [ ] `torbscript/scriptReceivers` answers per document and per project (source `mapping`/`load`, or `notMatched` for an untyped script), pinned in `compiler/tests/language-server.test.trb`. Amended 2026-10-26 (owner): the `scripts` mapping is optional; unmapped scripts stay valid and are typed by inference from literal `Sandbox.load` calls, else untyped (SCRIPT-RECEIVERS.md sections 1, 5, 6).$\n\nDecided 2026-10-26 (owner): the "Add to project.trb" quick fix on the D15 hint is always offered, by default and not configurable. Extra acceptance: - [ ] The quick fix is offered for every unmapped literal load without any server setting.
Author
Collaborator

Design PR: #519 · Epic: #518

Design PR: https://git.torb.dev/torbscript/language/pulls/519 · Epic: https://git.torb.dev/torbscript/language/issues/518
Author
Collaborator

[loop:torbscript] intake: in scope (author orion, label loop, slice 4 of the script-receivers epic #518); no duplicate. The language server features need the receiver resolution of #513 and the diagnostics of #514. Just in time: refine when #514 has landed. next: waiting (#514 landed)

[loop:torbscript] intake: in scope (author orion, label `loop`, slice 4 of the script-receivers epic #518); no duplicate. The language server features need the receiver resolution of #513 and the diagnostics of #514. Just in time: refine when #514 has landed. next: waiting (#514 landed)
orion changed title from Script receivers 4/6: language server features for scripts to lsp: language server features for receiver scripts (SCRIPT-RECEIVERS slice 5) 2026-11-07 22:32:29 +00:00
Author
Collaborator

[loop:torbscript] re-sweep: renamed to the area: ... form with the slice number of SCRIPT-RECEIVERS.md section 12 (the old "N/6" count did not match the slice numbers of the design record), and replaced the reference to the design branch, which is merged (PR #519), with the epic link.

[loop:torbscript] re-sweep: renamed to the `area: ...` form with the slice number of SCRIPT-RECEIVERS.md section 12 (the old "N/6" count did not match the slice numbers of the design record), and replaced the reference to the design branch, which is merged (PR #519), with the epic link.
Author
Collaborator

[loop:torbscript] refine: next: waiting (depends on #514 landed; #514 waits for ready-buffer room)

[loop:torbscript] refine: next: waiting (depends on #514 landed; #514 waits for ready-buffer room)
Author
Collaborator

[loop:torbscript] park refine: deferred 3 ticks in a row (starved), so parked instead of deferred again. Reason: depends on #514, which is parked itself until the ready buffer has room (the buffer holds #799, #680, #664, #656). Unpark #514 first, then this one. next: parked

[loop:torbscript] park refine: deferred 3 ticks in a row (starved), so parked instead of deferred again. Reason: depends on #514, which is parked itself until the ready buffer has room (the buffer holds #799, #680, #664, #656). Unpark #514 first, then this one. next: parked
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language#515
No description provided.