BetterThanTomorrow / joyride

Making VS Code Hackable like Emacs since 2022
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.joyride
Other
458 stars 17 forks source link

Joyride: Run Workspace Script... error on windows #183

Open tshemeng opened 8 months ago

tshemeng commented 8 months ago

Open any project on Windows, run command Joyride: Run Workspace Script..., select a .js file, VSCode Joyride got error image

PEZ commented 8 months ago

Hi! Looks like you have something in hello.js that JavaScript doesn't like. Can you share the script?

This script should work:

const vscode = require("vscode");

showHelloMessage = async () => {
  const button = await vscode.window.showInformationMessage("Hello World!", "Cancel", "OK");
  if (button === "OK") {
    vscode.window.showInformationMessage("You clicked OK! Try clicking Cancel too?.");
  } else {
    const name = await vscode.window.showInputBox({
      title: "CIA wants to know",
      prompt: "What is your name?",
    });
    vscode.window.showInformationMessage(`Hello ${name}!`);
  }
};

showHelloMessage();
tshemeng commented 8 months ago

@PEZ i test on three computers got same error, here is screen recording test your code: https://github.com/BetterThanTomorrow/joyride/assets/8343797/3cba8142-dbf8-4458-a411-34e857474658

PEZ commented 8 months ago

@tshemeng, thanks for testing that. I don't know what's going on, but could be specific to Windows. I'll get hold of a Windows machine to test this on.

Can you confirm that ClojureScript (.cljs) scripts work? You can try with this one for a direct compare:

(require '["vscode" :as vscode]
         '[promesa.core :as p])

(defn show-hello-message []
  (p/let [button (vscode/window.showInformationMessage "Hello World!" "Cancel" "OK")]
    (if (= "OK" button)
      (vscode/window.showInformationMessage "You clicked OK! Try clicking Cancel too?.")
      (p/let [name (vscode/window.showInputBox #js {:title "CIA wants to know",
                                                    :prompt "What is your name?"})]
        (vscode/window.showInformationMessage (str "Hello " name))))))

(show-hello-message)
tshemeng commented 8 months ago

@PEZ .cljs works fine.