From 88e21467572c97fd59b88875389699744a9f0e1f Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Tue, 18 Nov 2014 17:54:19 -0500 Subject: [PATCH] Use the original syntax to guide tooltip shape original commit: 1d86e173a5a68147d8316332addcd0619fbdb65e --- .../typed-racket-lib/typed-racket/types/type-table.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt index d8f02f48..d4b06b5f 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/type-table.rkt @@ -139,14 +139,16 @@ ;; make-tooltip-vector : Syntax Thunk Int Int -> (Listof Vector) ;; Compute the tooltip info to put in syntax properties (define (make-tooltip-vector stx type-thunk position span) + ;; Try to use the original syntax to guide the shape of the tooltip + (define located (locate-stx stx)) (cond ;; Put the tooltip only on the parens for compound expressions ;; but put them on the whole expression for literals. This avoids ;; overlapping tooltips. - [(or (not (pair? (syntax-e stx))) + [(or (not (pair? (syntax-e located))) ;; special-case quote because there's no worry of overlap ;; in a (quote ...) and because literals expand out to a ;; use of quote. - (let ([fst (car (syntax-e stx))]) + (let ([fst (car (syntax-e located))]) (and (identifier? fst) (free-identifier=? fst #'quote)))) (list (vector stx