Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Adding Truffle Exec context menu #73

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

kevinbluer
Copy link
Member

@kevinbluer kevinbluer commented May 4, 2022

Pretty simple feature that adds a right-click context menu for running truffle exec path/to/script.js as per the screenshot.

Screen Shot 2022-05-27 at 4 23 02 PM

@kevinbluer kevinbluer linked an issue May 4, 2022 that may be closed by this pull request
Copy link
Contributor

@michaeljohnbennett michaeljohnbennett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, just mostly questions on how you work with the output of the exec call.

Telemetry.sendEvent("TruffleCommands.execScript.truffleInstallation");
await required.installTruffle(required.Scope.locally);
}
await outputCommandHelper.executeCommand(getWorkspaceRoot(), "npx", RequiredApps.truffle, "exec", uri.fsPath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you not want to do something with the output of this call?

Does this output to the outputChannel or similar? Debugging any issues will be problematic otherwise. Especially any exceptions (non 0 return codes).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @michaeljohnbennett (apols for the delay), yup it does currently output to Truffle for VSCode channel...does that make sense from your perspective?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinbluer, just a heads up: if we have more than one Truffle Project opened, or even a root directory without any truffle-config.js file, the function getWorkspaceRoot() might not work (e.g.: deploy function). The fix for that is on: fix/compile-from-working-dir

await truffleExtensionAdapter.execScript(Uri.file("./test.js"));

// Assert
assert.strictEqual(execScriptMock.calledOnce, true, "TruffleCommands.execScript should be called once");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly should this test mock something lower down and return a true/false on the success/failure of the exec call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly 🙃 do you mean whether the script actually executes (irrespective of its success / failure)? i feel this is more of a QOL of update and whether the script actually succeeds / fails doesn't matter too much as long as the output is accessible (as per the above)...it would be awesome if it auto-open to the output channel though

@kevinbluer kevinbluer marked this pull request as ready for review May 27, 2022 21:22
@kevinbluer kevinbluer requested a review from xhulz May 27, 2022 21:24
Copy link
Contributor

@xhulz xhulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinbluer, looks awesome! :) Only concern is regarding open more than one project and try to execute the scripts. I've left a comment about this function: getWorkspaceRoot()

@michaeljohnbennett
Copy link
Contributor

@kevinbluer what do you want to do with this one? Shall i look at this next week?

@michaeljohnbennett
Copy link
Contributor

whats the status of this @kevinbluer ?

@kevinbluer
Copy link
Member Author

Hey @michaeljohnbennett, totally missed the comments here, sorry about that 🤦 Low priority (as a feature) but no harm in getting it added if we can wrangle the merge conflicts. Perhaps we role over to the v2.5 sprint?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to right-click and run truffle exec based scripts
3 participants