Repository navigation
Add a command to open macro stepper for selected syntax - #148
Conversation
|
Seems like a nice initial approach! 😄 I'm happy to review further once you feel the PR is ready. |
misc: rename to fit its meaning Signed-off-by: Lîm Tsú-thuàn <inbox@dannypsnl.me>
Signed-off-by: Lîm Tsú-thuàn <inbox@dannypsnl.me>
|
Ah, I see it's ready to review now. I'll aim to take a look in the next few days. 😄 (I wish GitHub sent email notifications when PRs changed to ready state...!) |
jryans
left a comment
There was a problem hiding this comment.
Thanks for working on this! 😄 It's quite nice to have a way to launch the macro stepper like this. I've made a few suggestions below.
(I fixed the CI workflows on master, so if you rebase your branch, you should see the workflows pass next time.)
| export function openMacroStepper(repls: Map<string, vscode.Terminal>): void { | ||
| withEditor((editor: vscode.TextEditor) => { | ||
| withFilePath((filePath: string) => { | ||
| withREPL((command: string[]) => { |
There was a problem hiding this comment.
I think it might be better to use withRacket instead of withREPL for this feature. When you use REPL, the REPL session is left open even after closing the macro stepper. If you use the "plain" Racket command, you can send your macro stepper instructions via several --eval options.
There was a problem hiding this comment.
That would need to escape characters in terminal, and I'm not sure if that's possible for all syntax, e.g.
racket --eval "(expand/step #'(define f (latex-lambda (x y) "x^2 + y^2")))"
got
string::26: read: expected a `)` to close `(`
There was a problem hiding this comment.
Hmm, I guess it is fairly annoying to properly shell-escape all possible expressions...
Maybe there's some way to watch an event fired by closing the stepper and then terminate the REPL? Anyway, we can improve that separately from this PR. I don't want to block on this.
| export function openMacroStepper(repls: Map<string, vscode.Terminal>): void { | ||
| withEditor((editor: vscode.TextEditor) => { | ||
| withFilePath((filePath: string) => { | ||
| withREPL((command: string[]) => { |
There was a problem hiding this comment.
Hmm, I guess it is fairly annoying to properly shell-escape all possible expressions...
Maybe there's some way to watch an event fired by closing the stepper and then terminate the REPL? Anyway, we can improve that separately from this PR. I don't want to block on this.
|
I'll plan to release a new version in a few days time... Perhaps we'll find a better way to close the REPL before that release happens. Thanks again! 😄 |
|
Just published version 0.8.0 with this, thanks again for working on it! 😄 |
|
NOTE: There is a LSP method called |


Add a command
magic-racket.openMacroStepperwhich will sendto REPL to execute (then this will open macro stepper GUI).
Also keybinding to
Alt+Shift+EnterThis is originally a racket language server issue jeapostrophe/racket-langserver#145, but I think magic racket can have this immediately by open Racket GUI.