Fix playground HTML, tweak playground colors

This commit is contained in:
Max Brunsfeld 2019-06-18 20:36:24 -07:00
parent 07afce0686
commit 10fb9b0e20
2 changed files with 20 additions and 4 deletions

View file

@ -3,11 +3,19 @@ let tree;
(async () => {
const CAPTURE_REGEX = /@\s*([\w\._-]+)/g;
const COLORS_BY_INDEX = [
'red',
'green',
'blue',
'orange',
'violet',
'chocolate',
'darkblue',
'darkcyan',
'darkgreen',
'darkred',
'darkslategray',
'dimgray',
'green',
'indigo',
'navy',
'red',
'sienna',
];
const scriptURL = document.currentScript.getAttribute('src');
@ -213,7 +221,10 @@ let tree;
{row: startRow, column: 0},
{row: endRow, column: 0},
);
let lastNodeId;
for (const {name, node} of captures) {
if (node.id === lastNodeId) continue;
lastNodeId = node.id;
const {startPosition, endPosition} = node;
codeEditor.markText(
{line: startPosition.row, ch: startPosition.column},

View file

@ -37,6 +37,11 @@ permalink: playground
<textarea id="code-input">
</textarea>
<div id="query-container" style="visibility: hidden; position: absolute;">
<h4>Query</h4>
<textarea id="query-input"></textarea>
</div>
<h4>Tree</h4>
<span id="update-time"></span>
<div id="output-container-scroll">