pss-langserver
Version:
A Language server for the Portable Stimulus Standard
48 lines (47 loc) • 1.76 kB
JavaScript
;
/*
* Copyright (C) 2025 Darshan(@thisisthedarshan)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.notify = notify;
exports.buildASTForFiles = buildASTForFiles;
const helpers_1 = require("./parser/helpers");
const fs_extra_1 = __importDefault(require("fs-extra"));
function notify(conn, message, err = false) {
if (err) {
conn.window.showErrorMessage(message);
}
else {
conn.window.showInformationMessage(message);
}
}
function buildASTForFiles(files) {
let pssAST = {};
for (const file of files) {
const content = fs_extra_1.default.readFileSync(file, 'utf8');
const fileURI = encodeURI("file://" + file);
// updateAST(fileURI, content).then(vars => {
// globalAST = updateASTMeta(globalAST, vars);
// });
(0, helpers_1.updateASTNew)(fileURI, content).then(vars => {
pssAST[fileURI] = vars;
});
}
return pssAST;
}