Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rename identifier quickscript, like in the right-click menu item
#lang racket/base
(require quickscript
racket/class
racket/gui/base
string-constants)
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
(script-help-string "Rename the identifier under the cursor (if check syntax succeeded)")
(define-script rename-identifier
#:label "Rename &Identifier"
#:menu-path ("Re&factor")
(λ (selection #:definitions defs)
(define kmap (send defs get-keymap))
;; The last `#true` argument ensures that all keymaps in the chain are tried.
(send kmap call-function (string-constant cs-rename-id) defs (new event%) #true)))
(module url2script-info racket/base
(provide filename url)
(define filename "rename-identifier.rkt")
(define url "https://gist.github.com/Metaxal/a9dc34faaff4ec7e3c7872b63cc1b76f"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment