Skip to content

Commit

Permalink
highlighting almost
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Jan 16, 2025
1 parent ed5d144 commit 0d83b36
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions kabelsalat.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,19 @@
kabelsalat.run(code);

if (window.parent.strudelWindow && patterns.length) {
const miniLocations = getDoubleQuotedStringLocations(code);
// console.log('miniLocations', miniLocations);
// TODO: make this less ugly
const doubleQuotedStringLocations = getDoubleQuotedStringLocations(code);
let miniLocations = [];
doubleQuotedStringLocations.forEach((loc) => {
const part = code.slice(...loc);
const atoms = window.parent.strudelWindow.getLeafLocations(`"${part}"`);
atoms.forEach((atom) => {
const [begin, end] = atom;
miniLocations.push([loc[0] + begin - 1, loc[0] + end - 1]);
});
});
window.parent.strudel.onUpdateMiniLocations(docId, miniLocations);
// uglyness ends here
const docPattern = window.parent.strudelWindow.stack(...patterns);
window.parent.strudel.setDocPattern(docId, docPattern);
}
Expand Down

0 comments on commit 0d83b36

Please sign in to comment.