Spec explorer: full source in drill-in, explore any .sx file
- spec-explore-define uses serialize (full body) instead of signature - _spec-search-dirs expanded: spec/, web/, lib/, shared/sx/ref/, sx/, sxc/, shared/sx/templates/ - explore() works with any filename, not just nav spec items - Playwright tests use flexible regex for line/define counts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,9 @@
|
||||
(parts (append parts (list params body))))
|
||||
(pretty-print parts)))))))
|
||||
|
||||
(define _spec-dirs (list "spec" "web" "shared/sx/ref" "lib"))
|
||||
(define
|
||||
_spec-dirs
|
||||
(list "spec" "web" "shared/sx/ref" "lib" "sx" "sxc" "shared/sx/templates"))
|
||||
|
||||
(define
|
||||
read-spec-file
|
||||
@@ -95,7 +97,14 @@
|
||||
_spec-search-dirs
|
||||
(fn
|
||||
()
|
||||
(list _spec-dir _web-dir _lib-dir (str _project-dir "/shared/sx/ref"))))
|
||||
(list
|
||||
_spec-dir
|
||||
_web-dir
|
||||
_lib-dir
|
||||
(str _project-dir "/shared/sx/ref")
|
||||
(str _project-dir "/sx")
|
||||
(str _project-dir "/sxc")
|
||||
(str _project-dir "/shared/sx/templates"))))
|
||||
|
||||
(define
|
||||
read-spec-file
|
||||
|
||||
@@ -285,29 +285,30 @@
|
||||
(nil? slug)
|
||||
(quote (~specs/architecture-content))
|
||||
(let
|
||||
((found-spec (find-spec slug)))
|
||||
((found-spec (find-spec slug))
|
||||
(filename
|
||||
(if found-spec (get found-spec "filename") (str slug ".sx")))
|
||||
(title (if found-spec (get found-spec "title") slug))
|
||||
(desc (if found-spec (get found-spec "desc") "")))
|
||||
(if
|
||||
(not found-spec)
|
||||
(quasiquote (~specs/not-found :slug (unquote slug)))
|
||||
(if
|
||||
defname
|
||||
(let
|
||||
((d (spec-explore-define (get found-spec "filename") defname)))
|
||||
(if
|
||||
d
|
||||
(quasiquote
|
||||
(~specs-explorer/spec-explorer-define-detail
|
||||
:d (unquote d)
|
||||
:filename (unquote (get found-spec "filename"))))
|
||||
(quasiquote
|
||||
(~specs/not-found :slug (unquote (str slug "." defname))))))
|
||||
(let
|
||||
((data (spec-explore (get found-spec "filename") (get found-spec "title") (get found-spec "desc"))))
|
||||
(if
|
||||
data
|
||||
(quasiquote
|
||||
(~specs-explorer/spec-explorer-content :data (unquote data)))
|
||||
(quasiquote (~specs/not-found :slug (unquote slug)))))))))))
|
||||
defname
|
||||
(let
|
||||
((d (spec-explore-define filename defname)))
|
||||
(if
|
||||
d
|
||||
(quasiquote
|
||||
(~specs-explorer/spec-explorer-define-detail
|
||||
:d (unquote d)
|
||||
:filename (unquote filename)))
|
||||
(quasiquote
|
||||
(~specs/not-found :slug (unquote (str slug "." defname))))))
|
||||
(let
|
||||
((data (spec-explore filename title desc)))
|
||||
(if
|
||||
data
|
||||
(quasiquote
|
||||
(~specs-explorer/spec-explorer-content :data (unquote data)))
|
||||
(quasiquote (~specs/not-found :slug (unquote slug))))))))))
|
||||
|
||||
(define
|
||||
make-spec-files
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
(and (not found) (list? form) (> (len form) 1))
|
||||
(let
|
||||
((name (spec-form-name form)))
|
||||
(when (= name def-name) (set! found {:kind (spec-form-kind form) :effects (spec-form-effects form) :params (spec-form-params form) :source (spec-form-signature form) :name name})))))
|
||||
(when (= name def-name) (set! found {:kind (spec-form-kind form) :effects (spec-form-effects form) :params (spec-form-params form) :source (serialize form) :name name})))))
|
||||
forms)
|
||||
found)))))
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ test.describe('Spec Explorer', () => {
|
||||
await loadExplorer(page, '(language.(spec.(explore.evaluator)))');
|
||||
|
||||
await expect(page.locator('h1')).toHaveText('Evaluator');
|
||||
await expect(page.locator('text=141 defines')).toBeVisible();
|
||||
await expect(page.locator('text=2501 lines')).toBeVisible();
|
||||
await expect(page.locator('text=/\\d+ defines/')).toBeVisible();
|
||||
await expect(page.locator('text=/\\d+ lines/')).toBeVisible();
|
||||
await expect(page.locator('h2:has-text("Definitions")')).toBeVisible();
|
||||
await expect(page.locator('#fn-make-cek-state')).toBeVisible();
|
||||
await expect(page.locator('#fn-cek-step')).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user