Skip to content

Commit

Permalink
Merge pull request #61 from GabrieleMessina/development
Browse files Browse the repository at this point in the history
Add verbose run to extension command, Removed workspace launch config…
  • Loading branch information
GabrieleMessina authored Apr 8, 2024
2 parents 210e441 + 1f9a803 commit d871793
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 91 deletions.
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
},
]
}
}

0 comments on commit d871793

Please sign in to comment.