From 9a77de31dc9759708ce9c2d14ea7c0876c214e71 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Wed, 16 Sep 2026 00:53:52 +0200 Subject: config and engine can load with unsaved text --- internal/engine/engine.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/engine/engine.go') diff --git a/internal/engine/engine.go b/internal/engine/engine.go index 958e4f9..cc776e6 100644 --- a/internal/engine/engine.go +++ b/internal/engine/engine.go @@ -80,7 +80,14 @@ type Rule struct { // Engine and every diagnostic: krino never acts on a configuration it only // partly understood. Duplicate names are ignored after their first use. func Load(mainFile string, names ...string) (*Engine, []*config.Diag) { - cfg, errs := config.Load(mainFile, dedupeNames(names)...) + return LoadWith(mainFile, nil, names...) +} + +// LoadWith is Load with some configuration files' text supplied by the +// caller (config.LoadWith): the GUI checks unsaved editor text with it, +// compiled exactly as a run would compile it (GUI design ยง1.3). +func LoadWith(mainFile string, overrides map[string][]byte, names ...string) (*Engine, []*config.Diag) { + cfg, errs := config.LoadWith(mainFile, overrides, dedupeNames(names)...) if cfg == nil { return nil, errs } -- cgit v1.3