-
Notifications
You must be signed in to change notification settings - Fork 125
Run Button for Circuit Files - Standalone and Project #2455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…oth project and standalone scenarios
…s no way to get the circuit file this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss design before proceeding with this. In general, I'm not sure the Run / Debug drop-down is the right place to add this functionality. compared to just a "Run" button in the editor or something. I'm not sure putting it in there is that discoverable or convenient (I'm guessing/hoping F5 still runs the project and not the circuit?)
Does it integrate with actual debugging (i.e. can you step through the circuit and see quantum state evolve)?
vscode/package.json
Outdated
@@ -146,24 +146,33 @@ | |||
"menus": { | |||
"editor/title/run": [ | |||
{ | |||
"command": "qsharp-vscode.runEditorContents", | |||
"when": "resourceLangId == qsharp || resourceLangId == openqasm", | |||
"command": "qsharp-vscode.runQsharp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did all these get changed to *Qsharp
from *Editor
though? These apply to OpenQASM files also now, not just qsharp.
@@ -43,13 +43,11 @@ suite("OpenQASM Debugger Tests", function suite() { | |||
vscode.debug.removeBreakpoints(vscode.debug.breakpoints); | |||
}); | |||
|
|||
test("Launch with debugEditorContents command", async () => { | |||
test("Launch with debugQsharp command", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't get why the command name changed, and we should change it back. This is an OpenQASM test and you invoke debugQsharp
, which is weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, that doesn't accurately describe the case for QASM. I'm renaming these based on Mine's suggestion above to runProgram
and debugProgram
respectively. The reason I'm wanting to move away from the names they had before is because they aren't accurate anymore. Instead of running/debugging the contents of the editor, what they really do is run/debug the project if there is one, or the file you are looking at otherwise. Based on that, runProgram
and debugProgram
more accurately describe what these commands do.
vscode/package.json
Outdated
"command": "qsharp-vscode.debugEditorContents", | ||
"when": "resourceLangId == qsharp || resourceLangId == openqasm" | ||
"command": "qsharp-vscode.runQsharp", | ||
"when": "resourceLangId == qsharp || resourceLangId == openqasm || (qsharp.isProjectFile && resourceLangId == qsharpcircuit)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you need this isProjectFile
context for? There's a lot of clunky code to set it on updates, and anyway the PR description says "This new functionality is available even if the circuit is not part of a Q# project"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was renamed to activeProjectDirectory
but serves the same function. It is needed to know if we allow the Run and Debug commands to circuit files. These commands only make sense when the file is in a project. The Run Circuit command is separate and will always be available, though its internal details will change depending on if the file is part of a project or not. The difference is the Run Circuit command allows the user to run the circuit file by itself, where the Run command will run the project the circuit is a part of, which is the same behavior the Run command has when looking at Q# files.
Adds the VS Code Run button to circuit files so that the Q# project they are a part of can be run or debugged while looking at a circuit file. Also adds a command that the Run button can use for running just the circuit file and producing a dump machine for the circuit. This new functionality is available even if the circuit is not part of a Q# project.