Closed rfindler closed 1 year ago
It seems potentially useful for other folks, but not quite what I need for pdb. I plan to submit a PR for that, but TL;DR: pdb needs to know about all imports and exports; the new stx prop is just an additional detail about those.
pdb needs to know about each fully expanded #%provide
clause. One way to look at this is, something like add-definition-target
, but for exports (i.e. "add-export-target"). When it's a rename
clause, it needs to know both the local-id and export-id. Given those, it can directly check for the property on the latter.
pdb needs to know about each fully expanded #%require
clause, too. Here both as a source for completion candidates, and also when it's a rename
clause, both the local-id and imported-id. Given the local-id it, can look for the stx prop.
The analyze-more.rkt
file shows roughly what I would propose to add in check-syntax traversals.rkt
(if not necessarily the exact new syncheck method signature and style).
But again I plan to prepare a PR for this, for you to review.
Oh! Okay! Thanks, Greg.
If I should make a fresh issue for this, please let me know, but:
A potential to-do would be for check-syntax to add arrows for prefixes described by this new syntax property.
In other words, generalize how it handles the single prefix case, indicated by the low-level prefix
clause in #%require
, to one or more prefixes.
So for things like (prefix-in A: (prefix-in B: mod))
it would do more add-arrow-*
s and more add-prefixed-require-reference
s, for both A:
and B:
, whereas today it does none.
[The only reason I need the syntax property, for imports^1, is to draw more arrows that check-syntax currently doesn't draw for me in the first place.^2]
Is that something you'd be willing to do? (I took an initial look in traversals.rkt
. I feel like you'd be able to do this more quickly -- and to your greater satisfaction -- than me attempting it. And I have plenty else on my plate right now. But if you don't have time I can attempt this later and do a PR.)
^1: For prefixed exports it's a different, bigger story, involving potentially both this property and sub-range-binders (e.g. (prefix-out foo- (struct-out bar))
). But I think that's much lower-priority; I have it working in pdb, and the value to end users visually in e.g. DrRacket seems much less.
^2: There are some other reasons I draw more arrows, but the prefix arrows are one subset.
I can give this a try, yes and thanks for pointing out the lack!
Not sure if this is immediately (or ever?) useful, but it was easy to make and it seems like it fits here, so I made it.
Related to racket/racket#4649