lsp: definition jumps to export line; unused-import linter descends into libraries
- (sigil docs types) export-details gains a line field (1-based). - (sigil docs lookup) reads the compiler-emitted "line" field from each export's JSON entry, so module-details-exports exposes it. - (sigil lsp definition) returns that line in the LSP Location (converted to 0-based for the protocol). Previously the location always pointed at line 0. - (sigil lsp lint) now descends into (define-library ... (begin body)) clauses when collecting used symbols. Without this, any file that lived inside a define-library wrapper (all of sigil-stdlib, sigil-json, etc.) reported every import as unused because no symbols were scanned at all. Rewritten with fold-left over a pre-flattened form list to avoid the nested-mutation pattern that tripped the CPS capture analyzer.
src/sigil/docs/lookup.sgl | 5 ++++-
src/sigil/docs/types.sgl | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)src/sigil/docs/lookup.sglmodified
export-details-description export-details-examples export-details-source-module export-details-line syntax-details syntax-details? source-module: (let ((src (dict-ref json-export source_module: #f))) (if (and src (not (equal? src 'null))) src #f)))) #f)) line: (let ((ln (dict-ref json-export line: 0))) (if (integer? ln) ln 0)))) ;; Convert JSON module dict to module-details struct (define (json->module-details json-doc module-name doc-path)src/sigil/docs/types.sglmodified
export-details-description export-details-examples export-details-source-module export-details-line ;; Syntax details syntax-details (signature) ; For procedures: (name arg ...) or #f (description) ; Docstring (examples) ; List of example snippets (source-module)) ; For re-exports: source module name string, or #f (source-module) ; For re-exports: source module name string, or #f (line default: 0)) ; 1-based source line where the form lives (define-struct syntax-details (name) ; Symbol