#lang racket/base
(require racket/class racket/dict)
(define words
'(("dsr" . "(define-syntax-rule (")
("ds" . "(define-syntax ")
("sr" . "(syntax-rules ()\n [(_ ")
("sc" . "(syntax-case stx ()\n [(_ ")
("lbd" . "(λ(")
("para" . "(parameterize ([current-")
("wh" . "(with-handlers ([exn:")
))
(provide item-callback)
(define (item-callback s #:editor ed)
(define pos (send ed get-end-position))
(define str
(send ed get-text
(send ed get-backward-sexp pos)
pos))
(define str-ext (dict-ref words str #f))
(and str-ext
(send ed select-backward-sexp)
str-ext))