Skip to content

Commit

Permalink
Merge pull request #7 from se-buw/soaib-dev
Browse files Browse the repository at this point in the history
Fixed spectra line error highlighing
  • Loading branch information
soaibsafi authored Jul 9, 2024
2 parents e986baf + 2bca706 commit ef4c3c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frontend/src/assets/js/lineHighlightingUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ function getLineToHighlightXmv(result) {
function getLinesToHighlightSpectra(result) {
const regex = /<\s*([\d\s]+)\s*>/;
const match = result.match(regex);
// Regex for line error
const errorRegex = /XtextSyntaxDiagnostic: null:(\d+)/g;
const errorMatches = Array.from(result.matchAll(errorRegex));
const lines = [];
if (match) {
return match[1].split(/\s+/).filter(Boolean).map(Number);
lines.push(...match[1].split(/\s+/).filter(Boolean).map(Number));
}
return [];
if (errorMatches && errorMatches.length > 0) {
errorMatches.forEach(errorMatch => lines.push(parseInt(errorMatch[1])));
}
return lines;
}

function getLinesToHighlightAlloy(result) {
Expand Down

0 comments on commit ef4c3c2

Please sign in to comment.