Skip to content
Snippets Groups Projects
Commit 91cb19cb authored by Sytze de Witte's avatar Sytze de Witte
Browse files

merge

parents 76e0a017 da9beca6
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,17 @@
}
});
const runButton = document.getElementById("run-button");
runButton.addEventListener("click", event => {
const state = vscode.getState();
for (const file of state.constants) {
if (file.uri === state.currentUri) {
vscode.postMessage({type: "runTool", uri: state.currentUri, toolName: toolDropDown.options[toolDropDown.selectedIndex].value, constants: file.constants, options: []}); // TODO: Actually send option values
break;
}
}
});
function fillTools(tools) {
const select = document.querySelector("#tools");
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="982"
height="982"
id="svg2"
version="1.1">
<defs
id="defs4">
<linearGradient
id="linearGradient4767">
<stop
style="stop-color:#ff0000;stop-opacity:1;"
offset="0"
id="stop4769" />
<stop
style="stop-color:#ff0000;stop-opacity:0;"
offset="1"
id="stop4771" />
</linearGradient>
<linearGradient
id="linearGradient4729">
<stop
style="stop-color:#ffa8a8;stop-opacity:0.48743719;"
offset="0"
id="stop4731" />
<stop
style="stop-color:#c90000;stop-opacity:1;"
offset="1"
id="stop4733" />
</linearGradient>
<linearGradient
id="linearGradient4713">
<stop
style="stop-color:#c90000;stop-opacity:1;"
offset="0"
id="stop4715" />
<stop
style="stop-color:#c90000;stop-opacity:0;"
offset="1"
id="stop4717" />
</linearGradient>
<marker
orient="auto"
refY="0"
refX="0"
id="Arrow1Lstart"
style="overflow:visible">
<path
id="path4035"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
transform="matrix(0.8,0,0,0.8,10,0)" />
</marker>
<linearGradient
id="linearGradient3895">
<stop
id="stop3897"
offset="0"
style="stop-color:#f29494;stop-opacity:1;" />
<stop
style="stop-color:#a90000;stop-opacity:1;"
offset="1"
id="stop3899" />
</linearGradient>
<linearGradient
id="linearGradient3863">
<stop
style="stop-color:#fdefef;stop-opacity:1;"
offset="0"
id="stop3865" />
<stop
id="stop3869"
offset="1"
style="stop-color:#d40000;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3843">
<stop
id="stop3851"
offset="0"
style="stop-color:#e94f4f;stop-opacity:1;" />
<stop
style="stop-color:#de2727;stop-opacity:1;"
offset="0.5"
id="stop3853" />
<stop
style="stop-color:#d40000;stop-opacity:1;"
offset="1"
id="stop3847" />
</linearGradient>
<linearGradient
id="linearGradient3833">
<stop
style="stop-color:#d40000;stop-opacity:1;"
offset="0"
id="stop3835" />
<stop
style="stop-color:#d40000;stop-opacity:0;"
offset="1"
id="stop3837" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient3901-6"
id="linearGradient3907-4"
x1="357.45901"
y1="288.38263"
x2="359.57983"
y2="195.75165"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3901-6">
<stop
style="stop-color:#d40000;stop-opacity:1;"
offset="0"
id="stop3903-0" />
<stop
style="stop-color:#d40000;stop-opacity:0;"
offset="1"
id="stop3905-3" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient3895-2"
id="radialGradient3915-6"
cx="373.7222"
cy="310.69833"
fx="373.7222"
fy="310.69833"
r="156.27032"
gradientTransform="matrix(1,0,0,0.88407719,0,42.692712)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3895-2">
<stop
id="stop3897-4"
offset="0"
style="stop-color:#f29494;stop-opacity:1;" />
<stop
style="stop-color:#a90000;stop-opacity:1;"
offset="1"
id="stop3899-5" />
</linearGradient>
<filter
color-interpolation-filters="sRGB"
id="filter5001">
<feGaussianBlur
stdDeviation="16"
id="feGaussianBlur5387"
in="SourceGraphic"
result="result5" />
<feSpecularLighting
specularExponent="17"
id="feSpecularLighting5005"
in="result5"
specularConstant="0.69999999"
kernelUnitLength="1"
lighting-color="#ffffff"
surfaceScale="10">
<fePointLight
id="fePointLight5385"
x="586"
y="550"
z="512" />
</feSpecularLighting>
<feComposite
k3="1"
k2="0.2"
operator="arithmetic"
result="result4"
in="result5"
k1="0.5"
id="feComposite5009"
k4="0"
in2="SourceGraphic" />
</filter>
<filter
id="filter5403"
color-interpolation-filters="sRGB">
<feGaussianBlur
result="result5"
in="SourceGraphic"
id="feGaussianBlur5405"
stdDeviation="16" />
<feDiffuseLighting
id="feDiffuseLighting5413"
in="result5"
result="result8"
kernelUnitLength="0.01"
diffuseConstant="1.60000002"
surfaceScale="16">
<feDistantLight
id="feDistantLight5427"
azimuth="285"
elevation="45" />
</feDiffuseLighting>
<feGaussianBlur
stdDeviation="1"
id="feGaussianBlur5501"
in="result8"
result="result11" />
<feComposite
id="feComposite5489"
in2="SourceGraphic"
operator="arithmetic"
k1="1"
k2="0"
k3="0"
in="result11"
result="result9"
k4="0" />
<feSpecularLighting
surfaceScale="16"
lighting-color="#ffffff"
kernelUnitLength="0.01"
specularConstant="1"
id="feSpecularLighting5407"
specularExponent="32"
result="result7"
in="result5">
<feDistantLight
id="feDistantLight5443"
azimuth="285"
elevation="35" />
</feSpecularLighting>
<feGaussianBlur
stdDeviation="4"
id="feGaussianBlur5497"
result="result10"
in="result7" />
<feComposite
id="feComposite5491"
operator="arithmetic"
k1="1"
k3="1"
in2="result9"
k2="0.3"
k4="0"
in="result10" />
</filter>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="translate(-19.999997,-40.362198)">
<path
transform="matrix(1.2862629,0.00667725,-0.00667725,1.2862629,238.65411,-203.57129)"
d="M 584.68238,367.00393 487.73696,537.48187 291.62602,538.76365 192.4605,369.56748 289.40593,199.08954 485.51686,197.80776 z"
id="path4739"
style="fill:#FFFFFF;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:21.36583138;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.29999995;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:28.8;marker-start:none" />
<path
transform="matrix(1.2862629,0.00667725,-0.00667725,1.2862629,238.65411,313.68202)"
d="M 584.68238,367.00393 487.73696,537.48187 291.62602,538.76365 192.4605,369.56748 289.40593,199.08954 485.51686,197.80776 z"
id="path4739-5"
style="fill:#FFFFFF;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:21.36583138;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.29999995;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:28.8;marker-start:none" />
<path
transform="matrix(1.2862629,0.00667725,-0.00667725,1.2862629,-211.34589,50.05537)"
d="M 584.68238,367.00393 487.73696,537.48187 291.62602,538.76365 192.4605,369.56748 289.40593,199.08954 485.51686,197.80776 z"
id="path4739-7"
style="fill:#FFFFFF;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:21.36583138;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3.29999995000000010;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:28.80000000000000100;marker-start:none" />
</g>
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 982 982" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="translate(-20 -40.362)" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="21.366">
<path transform="matrix(1.2863 .0066772 -.0066772 1.2863 238.65 -203.57)" d="m584.68 367-96.945 170.48-196.11 1.2818-99.166-169.2 96.945-170.48 196.11-1.2818z" stroke-dashoffset="28.8" stroke-miterlimit="3.3"/>
<path transform="matrix(1.2863 .0066772 -.0066772 1.2863 238.65 313.68)" d="m584.68 367-96.945 170.48-196.11 1.2818-99.166-169.2 96.945-170.48 196.11-1.2818z" stroke-dashoffset="28.8" stroke-miterlimit="3.3"/>
<path transform="matrix(1.2863 .0066772 -.0066772 1.2863 -211.35 50.055)" d="m584.68 367-96.945 170.48-196.11 1.2818-99.166-169.2 96.945-170.48 196.11-1.2818z" stroke-dashoffset="28.8" stroke-miterlimit="3.3"/>
</g>
</svg>
......@@ -205,20 +205,20 @@ export function activate(context: ExtensionContext) {
(res: Result) => copyToClipboard(res.getValue())
);
vscode.commands.registerCommand(
vscode.commands.registerCommand(
"analysisResults.copyItem",
(res: Result) => copyToClipboard(`${res.getLabel()}: ${res.getValue()}`)
);
vscode.commands.registerCommand(
vscode.commands.registerCommand(
"analysisResults.load",
() => loadResults(analysisResultsProvider)
);
vscode.commands.registerCommand(
"analysisResults.export",
() => exportResults(analysisResultsProvider)
);
vscode.commands.registerCommand(
"analysisResults.export",
() => exportResults(analysisResultsProvider)
);
}
function initializeTools() {
......@@ -267,6 +267,18 @@ function getOptions(toolName: string) {
});
}
function runTool(uri: string, toolName: string, constants: { name: string; value: string; }[], options: {name: string; value: string;}[]) {
let jsonObject = {
"TextDocument": TextDocumentIdentifier.create(uri),
"ToolName": toolName,
"Constants": constants,
"Options": options,
};
client?.sendRequest<string>("modest/runTool", jsonObject).then(data => {
console.log(data);
});
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
......@@ -293,11 +305,11 @@ function loadResults(provider: AnalysisResultsProvider) {
}
function exportResults(provider: AnalysisResultsProvider) {
vscode.window.showSaveDialog().then(f => {
if (f) {
fs.writeFileSync(f.path, JSON.stringify(provider.getJsonObject()));
}
});
vscode.window.showSaveDialog().then(f => {
if (f) {
fs.writeFileSync(f.path, JSON.stringify(provider.getJsonObject()));
}
});
}
class ModestSidebarProvider implements vscode.WebviewViewProvider {
......@@ -305,7 +317,7 @@ class ModestSidebarProvider implements vscode.WebviewViewProvider {
private _view?: vscode.WebviewView;
constructor(private readonly _extensionUri: vscode.Uri) {}
constructor(private readonly _extensionUri: vscode.Uri) { }
resolveWebviewView(
webviewView: vscode.WebviewView,
......@@ -344,6 +356,12 @@ class ModestSidebarProvider implements vscode.WebviewViewProvider {
getOptions(data.toolName);
break;
}
case 'runTool': {
console.log(data);
runTool(data.uri, data.toolName, data.constants, data.options);
break;
}
}
});
}
......@@ -367,7 +385,7 @@ class ModestSidebarProvider implements vscode.WebviewViewProvider {
const styleVSCodeUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'vscode.css'));
const styleMainUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'main.css'));
const styleCodicons = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'));
const fontCodicons = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'));
const fontCodicons = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'));
// Use a nonce to only allow a specific script to be run.
const nonce = getNonce();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment