Script receivers 4/6: language server features for scripts #515

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

Slice 5 of Design: docs/design/SCRIPT-RECEIVERS.md (branch docs/script-receivers). Part of the script-receivers epic.

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 Design: `docs/design/SCRIPT-RECEIVERS.md` (branch `docs/script-receivers`). Part of the script-receivers epic. 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)
Sign in to join this conversation.
No labels
loop
ready
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.