I totally understand and agree with the motivation!
I can totally do this and if that meets your needs, great.
One scenario I had in mind: Currently analyze-path
has an optional #:import-depth
argument, defaulting to 0:
;; #:import-depth says how many levels to recur and analyze imported
;; files, too. Reasonable values are 0 (none), 1 (just files directly
;; imported by the analyzed file, on the theory the user might access
;; one of them soon), or a very large integer (all that can be found
;; transitively, up to "opaque" modules like #%core and #%kernel).
;; Other values are legal but of dubious value. The analysis of these
;; imported files takes place on another thread, and does not
;; meaningfully delay returning results for the primary file.
I imagine something like {DrRacket VsCode Emacs} would, when the user opens some new file, want to supply analyze-path
an import-depth like 1. Meaning, proactively and analyze/save the immediate imports. That way, if the user eventually opens a requiring file, analyze-path
for that is likely "instant". Also, things like jump-to-definition are more likely to jump to a file that's already analyzed, and therefore moving to the exact location within will also be "instant". (Of course a tool could also let the user choose this depth to be 0 or 1 or whatever.)
If DrRacket depends on getting back expanded syntax from analyze-path
, it can't/won't for one of those pre/eagerly analyzed files, or any file from the db.
But I guess you're saying if analyze-path
were to return (or/c syntax? #f)
-- either fully-expanded syntax or false -- it's OK when it returns false, you can just expand yourself. Is that correct?