Skip to content
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

Add verbose run to extension command, Removed workspace launch config… #61

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 33 additions & 40 deletions qutes-vscode/extension.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,52 @@
const vscode = require('vscode');

function runQutes(runs, params = []){
let activeEditor = vscode.window.activeTextEditor;
if (!activeEditor || activeEditor.document.languageId !== 'qutes') {
return; // no active editor or the active file is not a Qutes file
}

let filePath = activeEditor.document.uri.fsPath;

// Define a debug configuration
let debugConfiguration = {
name: "Run Qutes File",
type: "debugpy",
request: "launch",
program: "src/qutes.py",
console: "integratedTerminal",
args: [params,"-image","-circuit","-iter",runs,filePath],
justMyCode: true
};

// Start debugging with the defined configuration
vscode.debug.startDebugging(undefined, debugConfiguration);
}

/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
let runQutesFileCommand = vscode.commands.registerCommand('qutes.runQutesFile', function () {
let activeEditor = vscode.window.activeTextEditor;
if (!activeEditor || activeEditor.document.languageId !== 'qutes') {
return; // no active editor or the active file is not a Qutes file
}

let filePath = activeEditor.document.uri.fsPath;

// Define a debug configuration
let debugConfiguration = {
name: "Run Qutes File",
type: "debugpy",
request: "launch",
program: "src/qutes.py",
console: "integratedTerminal",
args: ["-image","-circuit","-iter","1",filePath],
justMyCode: true

};

// Start debugging with the defined configuration
vscode.debug.startDebugging(undefined, debugConfiguration);
runQutes("1");
});

let runQutesFile100Command = vscode.commands.registerCommand('qutes.runQutesFile100', function () {
let activeEditor = vscode.window.activeTextEditor;
if (!activeEditor || activeEditor.document.languageId !== 'qutes') {
return; // no active editor or the active file is not a Qutes file
}

let filePath = activeEditor.document.uri.fsPath;
runQutes("100");
});

// Define a debug configuration
let debugConfiguration = {
name: "Run Qutes File",
type: "debugpy",
request: "launch",
program: "src/qutes.py",
console: "integratedTerminal",
args: ["-image","-circuit","-iter","100",filePath],
justMyCode: true

};
let runQutesFileVerboseCommand = vscode.commands.registerCommand('qutes.runQutesFileVerbose', function () {
runQutes("1", ["--verbose"]);
});

// Start debugging with the defined configuration
vscode.debug.startDebugging(undefined, debugConfiguration);
let runQutesFile100VerboseCommand = vscode.commands.registerCommand('qutes.runQutesFileVerbose100', function () {
runQutes("100", ["--verbose"]);
});

context.subscriptions.push(runQutesFileCommand);
context.subscriptions.push(runQutesFile100Command);
context.subscriptions.push(runQutesFileVerboseCommand);
context.subscriptions.push(runQutesFile100VerboseCommand);
}

function deactivate() {}
Expand Down
25 changes: 19 additions & 6 deletions qutes-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Gabriele Messina",
"publisher": "GabrieleMessina",
"license": "MIT",
"version": "1.1.1",
"version": "1.1.2",
"engines": {
"vscode": "^1.52.0"
},
Expand Down Expand Up @@ -50,6 +50,14 @@
"command": "qutes.runQutesFile100",
"title": "Run Qutes File 100 times",
"icon": "$(run-all)"
},
{
"command": "qutes.runQutesFileVerbose",
"title": "Run Qutes File with Verbose output"
},
{
"command": "qutes.runQutesFileVerbose100",
"title": "Run Qutes File 100 times with Verbose output"
}
],
"menus": {
Expand All @@ -63,14 +71,19 @@
"command": "qutes.runQutesFile100",
"group": "navigation",
"when": "resourceLangId == qutes"
},
{
"command": "qutes.runQutesFileVerbose",
"group": "navigation",
"when": "resourceLangId == qutes"
},
{
"command": "qutes.runQutesFileVerbose100",
"group": "navigation",
"when": "resourceLangId == qutes"
}
],
"editor/title": [
{
"command": "qutes.runQutesFile",
"group": "navigation",
"when": "resourceLangId == qutes"
},
{
"command": "qutes.runQutesFile100",
"group": "navigation",
Expand Down
45 changes: 0 additions & 45 deletions qutes.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -46,51 +46,6 @@
"args": ["-image","-circuit","-iter","1","./specification/grammar/grammar_tests.qut"],
"justMyCode": true
},
{
"name": "Qutes: Run Test example",
"type": "debugpy",
"request": "launch",
"program": "src/qutes.py",
"console": "integratedTerminal",
"args": ["-image","-circuit","-iter","100","./playground/examples/test.qut"],
"justMyCode": true
},
{
"name": "Qutes: Run Superdense Coding example",
"type": "debugpy",
"request": "launch",
"program": "src/qutes.py",
"console": "integratedTerminal",
"args": ["-image","-circuit","-iter","100","./playground/examples/superdense_coding.qut"],
"justMyCode": true
},
{
"name": "Qutes: Run Grover Search example",
"type": "debugpy",
"request": "launch",
"program": "src/qutes.py",
"console": "integratedTerminal",
"args": ["-image","-iter","1","./playground/examples/grover_search.qut"],
"justMyCode": true
},
{
"name": "Qutes: Run Quantum Teleportation example [WIP]",
"type": "debugpy",
"request": "launch",
"program": "src/qutes.py",
"console": "integratedTerminal",
"args": ["-image","-circuit","-iter","1","./playground/examples/quantum_teleportation.qut"],
"justMyCode": true
},
{
"name": "Qutes: Run Quantum key Distribution BB84 example",
"type": "debugpy",
"request": "launch",
"program": "src/qutes.py",
"console": "integratedTerminal",
"args": ["-image","-circuit","-iter","1","./playground/examples/quantum_key_distribution_bb84.qut"],
"justMyCode": true
},
]
}
}
Loading