resyntax
resyntax copied to clipboard
A Racket refactoring engine
How should `resyntax` surface suggestions to users? I can think of several possibilities: - A DrRacket plugin that shows you suggestions for the current file. Maybe something similar for `racket-mode`,...
Many macros written in terms of `define-syntax` and `syntax-parse` can be simplified to use `define-syntax-parse-rule`. Resyntax should suggest rewriting these macros, as `define-syntax-parse-rule` macros have a lot less boilerplate and...
Saw [this code](https://github.com/jackfirth/yaragg/commit/9d48ab7152003e39aa6c1bab11a601d3723143fa#diff-dc70b3329cf8b1b6ea61529383803830acc294f93a8552442d7c669767060b81R118) today: ```scheme (λ () (define t (get-token-grammar i)) t) ``` The `t` variable is immediately returned and therefore useless. This can be refactored to just: `(λ ()...
This code: ```scheme (for ([x (in-range a (add1 b))]) body ...) ``` Can be refactored to this: ```scheme (for ([x (in-inclusive-range a b)]) body ...) ``` See this discussion with...
The expression `(sequence-tail (in-vector vec) i)` can be rewritten to `(in-vector vec i)`.
See first commit message below.
It would be nice to have an interactive fix mode, that would allow for applying rules selectively, and avoid cognitive overload by letting the user focus on changes one by...
```racket (read-comment-locations (open-input-string "(list #;abc z #| c d |# \"#;efg\" ; ijk \n l m) ")) # ``` but this should return instead 3 comment ranges (0-indexed): [6, 11),...
Saw this code today: ```scheme (display size) (display "\n") ``` That can just be `(displayln size)`. Catching this is tricky because it's kind of a splicing pattern, rather than a...
Here are some ideas for using resyntax on Typed Racket code. These are quite superficial and don't depend on any knowledge of the types. + Singleton union types: rewrite the...