Skip to content
← Back

src/syntax/process/inlay_type.ghul

1
namespace Syntax.Process is
2
use Semantic.Types.Type;
3
use Semantic.Symbols.PARTS;
4
5
use Syntax.Process.Printer.SIGNATURE_RENDERER;
6
7
// Renders a narrowed type for a narrowing inlay's hover body: the same
8
// pretty-print the hover uses (so a long one-of breaks one alternative
9
// per line), with continuation lines hung in far enough to sit beneath
10
// the sigil the merged hint prepends. Names come out minimally
11
// qualified because the type renders while the narrowing site's scope
12
// is still the current build scope.
13
class INLAY_TYPE is
14
// Hover popover budget, matching SIGNATURE_DOC.
15
WIDTH: int static => 60;
16
17
// Body for an introduction inlay (`► <type>` / `> <type>`): the
18
// sigil plus its trailing space is two columns.
19
render(type: Type) -> string static =>
20
SIGNATURE_RENDERER.render_nested(PARTS.type_ref(type), 2, WIDTH);
21
si
22
si