Reputation: 958
I try to write an SQL beautifier as VS Code extension. The SQL beautifier engine/parser is already availabe as .dll, because I wrote it a couple of years ago in C# (more than 10K lines of code). As VS code extensions are written in typescript / Javascript it looks like you can not call a dll or maybe I am too stupid!? Do you know how I can call my dll out of a VS code Extension? Thx.
Upvotes: 3
Views: 2501
Reputation: 1927
You can run your dll, jar or exe files by putting them in assets folder. It can be done using child_process.
const vscode = require('vscode');
const path = require('path');
const child_process = require('child_process')
let myAppPath = vscode.Uri.file(path.join(context.extensionPath, "assets/myapp.dll"));
let execCommand = `dotnet ${myAppPath.fsPath}`;
child_process.exec(execCommand, (err, stdout, stderr) => {
if (stdout) {
vscode.window.showInformationMessage(stdout);
}
if (stderr) {
vscode.window.showWarningMessage(stderr);
}
if (err) {
vscode.window.showErrorMessage("" + err);
}
});
Upvotes: 1
Reputation: 275957
because I wrote it a couple of years ago in C#
You can invoke C# code from JavaScript (TypeScript) using Edge
Official docs https://github.com/tjanczuk/edge
Upvotes: 1