[racket-dev] check-syntax hack: patch to show how many uses an identifier has
On Jun 21, 2012, at 10:09 AM, Robby Findler wrote:
> I'll try to do something along these lines. It shouldn't be hard to
> make it a tooltip.
Don't spend too much time on it!
John
>
> Robby
>
> On Thu, Jun 21, 2012 at 11:03 AM, John Clements
> <clements at brinckerhoff.org> wrote:
>>
>> On Jun 21, 2012, at 8:58 AM, Matthias Felleisen wrote:
>>
>>>
>>> +a lot; I'd like that
>>
>> Robby, what's the nastiness threshold for getting something like this into the distribution?
>>
>> - is it okay to have a menu item with no action?
>> - is it okay to just say how many arrows--lines, really--radiate from this point, or would I need to go to the binding identifier and figure out how many uses the thing has?
>>
>> John
>>
>>>
>>>
>>> On Jun 20, 2012, at 10:48 PM, John Clements wrote:
>>>
>>>> When I'm using online check syntax, I often look at the lines leaving an identifier and wonder: is that just one line, or are there two or three? When lines overlap, there's no easy way to tell. This can be important in refactoring decisions, or in debugging (how many uses of this thing are there to check?).
>>>>
>>>> Let me show you what I mean:
>>>>
>>>> <Screen Shot 2012-06-20 at 7.44.52 PM.png>
>>>>
>>>> How many uses of 'x' are there?
>>>>
>>>> I decided to spend a few minutes digging through the source, and came up with this *EXTREMELY ROUGH* hack which helps me. :
>>>>
>>>> oiseau:...plt/collects/drracket/private/syncheck clements> git diff gui.rkt
>>>> diff --git a/collects/drracket/private/syncheck/gui.rkt b/collects/drracket/private/syncheck/gui.rkt
>>>> index 5f691bd..e69b9c7 100644
>>>> --- a/collects/drracket/private/syncheck/gui.rkt
>>>> +++ b/collects/drracket/private/syncheck/gui.rkt
>>>> @@ -1069,6 +1069,11 @@ If the namespace does not, they are colored the unbound color.
>>>> [var-arrows (filter var-arrow? arrows)]
>>>> [add-menus (append (map cdr (filter pair? vec-ents))
>>>> (filter procedure? vec-ents))])
>>>> + (make-object menu-item%
>>>> + (string-append ">> " (number->string (length arrows))
>>>> + " arrows from this identifier")
>>>> + menu
>>>> + (λ (item evt) (void)))
>>>> (unless (null? arrows)
>>>> (make-object menu-item%
>>>> (string-constant cs-tack/untack-arrow)
>>>>
>>>>
>>>> Let me just emphasize how rough this hack is: when I use it on a use of an identifier rather than a definition, it just shows the number 1, because that's the number of arrows--that is, the one that goes back to the definition.
>>>>
>>>> Keeping its limitations in mind, though, it's really nice to be able to see:
>>>>
>>>> <Screen Shot 2012-06-20 at 7.46.24 PM.png>
>>>>
>>>>
>>>> Would others find this useful?
>>>>
>>>> John
>>>>
>>>>
>>>> _________________________
>>>> Racket Developers list:
>>>> http://lists.racket-lang.org/dev
>>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4800 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120627/c158487a/attachment.p7s>