Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function updateDiagnostics(document: vscode.TextDocument, collection: vscode.DiagnosticCollection): void {
if(!util.isLgFile(document.fileName) ) {
collection.clear();
return;
}
const engine: Templates = Templates.parseText(document.getText(), document.uri.fsPath);
const diagnostics = engine.diagnostics;
TemplatesStatus.templatesMap.set(document.uri.fsPath, new TemplatesEntity(document.uri, engine));
const vscodeDiagnostics: vscode.Diagnostic[] = [];
const confDiagLevel = vscode.workspace.getConfiguration().get('LG.Expression.ignoreUnknownFunction');
const confCustomFuncListSetting: string = vscode.workspace.getConfiguration().get('LG.Expression.customFunctionList');
let customFunctionList: string[] = [];
if (confCustomFuncListSetting.length >= 1) {
customFunctionList = confCustomFuncListSetting.split(",").map(u => u.trim());
}
diagnostics.forEach(u => {
const isUnkownFuncDiag: boolean = u.message.includes("it's not a built-in function or a custom function");
if (isUnkownFuncDiag === true){
let ignored = false;
const funcName = extractFuncName(u.message);
async function changeEntityEnumLG(oldPath: string, oldFileList: string[], newFileList: string[], mergedPath: string, filename: string, feedback: Feedback): Promise {
let oldFilePath = oldFileList.filter(file => file.match(filename))[0]
let oldText = await fs.readFile(oldFilePath, 'utf8')
let oldStatements = oldText.split(os.EOL)
let oldTemplates = Templates.parseText(oldText)
let newFilePath = newFileList.filter(file => file.match(filename))[0]
let newText = await fs.readFile(newFilePath, 'utf8')
let newStatements = newText.split(os.EOL)
let newTemplates = Templates.parseText(newText)
let mergedStatements: string[] = []
let recordPart: object[] = []
for (let oldTemplate of oldTemplates) {
let oldBody = oldTemplate.templateBodyParseTree
if (oldBody === undefined) {
continue
}
if (oldBody instanceof SwitchCaseBodyContext) {
for (let newTemplate of newTemplates) {
if (newTemplate.name !== oldTemplate.name) {
continue
}
let newBody = newTemplate.templateBodyParseTree
async function changeEntityEnumLG(oldPath: string, oldFileList: string[], newFileList: string[], mergedPath: string, filename: string, feedback: Feedback): Promise {
let oldFilePath = oldFileList.filter(file => file.match(filename))[0]
let oldText = await fs.readFile(oldFilePath, 'utf8')
let oldStatements = oldText.split(os.EOL)
let oldTemplates = Templates.parseText(oldText)
let newFilePath = newFileList.filter(file => file.match(filename))[0]
let newText = await fs.readFile(newFilePath, 'utf8')
let newStatements = newText.split(os.EOL)
let newTemplates = Templates.parseText(newText)
let mergedStatements: string[] = []
let recordPart: object[] = []
for (let oldTemplate of oldTemplates) {
let oldBody = oldTemplate.templateBodyParseTree
if (oldBody === undefined) {
continue
}
if (oldBody instanceof SwitchCaseBodyContext) {