@abaplint/core
Version:
abaplint - Core API
35 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LSPEdit = void 0;
const LServer = require("vscode-languageserver-types");
class LSPEdit {
static mapEdits(edits) {
const workspace = { changes: {} };
for (const edit of edits) {
for (const filename in edit) {
if (workspace.changes[filename] === undefined) {
workspace.changes[filename] = [];
}
workspace.changes[filename] = workspace.changes[filename].concat(this.mapText(edit[filename]));
}
}
return workspace;
}
static mapEdit(edit) {
const workspace = { changes: {} };
for (const filename in edit) {
workspace.changes[filename] = this.mapText(edit[filename]);
}
return workspace;
}
static mapText(edit) {
const result = [];
for (const e of edit) {
const range = LServer.Range.create(e.range.start.getRow() - 1, e.range.start.getCol() - 1, e.range.end.getRow() - 1, e.range.end.getCol() - 1);
result.push({ range, newText: e.newText });
}
return result;
}
}
exports.LSPEdit = LSPEdit;
//# sourceMappingURL=_edit.js.map