It did run some tests, if there is a chance to be implemented as a standard saver. It needs to look more like this:
title: $:/ndarilek/vscode-integration/saver.js
type: application/javascript
module-type: saver
(function () {
"use strict";
var VscodeSaver = function (wiki) {
this.vscode = acquireVsCodeApi();
this.wiki = wiki;
};
VscodeSaver.prototype.save = function (text, method, callback) {
this.vscode.postMessage({ command: "save", text });
// Errors are surfaced in VS Code.
callback(null);
return true;
};
/*
Information about this saver
*/
VscodeSaver.prototype.info = {
name: "vscode",
priority: 4000,
capabilities: ["save", "autosave"]
};
/*
Static method that returns true if this saver is capable of working
*/
exports.canSave = function (wiki) {
if (typeof acquireVsCodeApi !== "undefined") return true;
return false;
};
/*
Create an instance of this saver
*/
exports.create = function (wiki) {
return new VscodeSaver(wiki);
};
})();