racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
444 stars 93 forks source link

add syncheck:import-or-export-prefix-ranges #617

Closed rfindler closed 1 year ago

rfindler commented 1 year ago

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

greghendershott commented 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.

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.

rfindler commented 1 year ago

Oh! Okay! Thanks, Greg.

greghendershott commented 1 year ago

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-references, 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.

rfindler commented 1 year ago

I can give this a try, yes and thanks for pointing out the lack!