resyntax
resyntax copied to clipboard
A Racket refactoring engine
Saw [this code](https://github.com/racket/drracket/pull/611/files/8dc532eb09d2283a2631b6bd5e3baa1ac60ce7b3#diff-4dba050951f75b9ab16953379130039cfd32a5699b68bd4af4be280f6c437923R307-R320) today: ```scheme (let* ([f (new frame% (label "Break DrRacket"))] [b (new button% (label "Break Main Thread") (callback (λ (x y) (break-thread to-break))) (parent f))] [b (new button%...
The `function-definition-suggestions` refactoring suite suggests changing this code: ```scheme (define (f a b c) (lambda () body ...)) ``` to this: ```scheme (define ((f a b c)) body ...) ```...
See racket/scribble#295 for context. Fixing this is tricky, because it requires knowing that all uses of the `make-` constructor can be rewritten. This requires first making a pass over the...
In uses of `syntax-parse`, clauses whose tail expression is a `with-syntax` form can be replaced with `#:with` pattern directives. For example, given this expression: ```scheme (syntax-parse stx [foo:id (with-syntax ([bar...
Resyntax currently refactors this code: ```scheme (ormap (lambda (p) (ormap (lambda (e) (and (exporting-libraries? e) e)) (part-to-collect p))) (collect-info-parents ci)) ``` Into this: ```scheme (for/or ([p (in-list (collect-info-parents ci))]) (ormap...
This required adjusting the core expansion observation code to make a note of visited identifiers. That way the `headers-assq-to-headers-assq*` rule can fire on uses of just the `headers-assq` identifier, regardless...
Currently if a replacement generated by a rule produces code that fails to compile, it's applied anyway. The tool doesn't even check for compilation success afterwards, so this _silently_ produces...
If a replacement generates code that needs additional `require` statements to be added before it compiles, `resyntax` should be able to insert the needed imports. It should be possible to...
Example: ```scheme (make-immutable-hash `((body . ,body) (event . ,event) (comments . ,(map github-review-comment-jsexpr comments)))) ``` If the keys are statically known, `hash` is simpler. The same goes for quasiquoted `#hash()`...
Similar to jeapostrophe/racket-langserver#45 ``` $ resyntax help Unable to init server: Could not connect: Connection refused Gtk initialization failed for display ":0" context...: body of "/usr/local/stow/racket-8.0/share/racket/pkgs/gui-lib/mred/private/wx/gtk/queue.rkt" body of "/usr/local/stow/racket-8.0/share/racket/pkgs/gui-lib/mred/private/wx/platform.rkt" ```