MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / highlightLines

Function highlightLines

app/components/JsonPreview.tsx:153–169  ·  view source on GitHub ↗
(view: EditorView)

Source from the content-addressed store, hash-verified

151});
152
153function highlightLines(view: EditorView) {
154 let highlightRange = view.state.facet(highlightedRange);
155 let builder = new RangeSetBuilder();
156 for (let { from, to } of view.visibleRanges) {
157 for (let pos = from; pos <= to; ) {
158 let line = view.state.doc.lineAt(pos);
159 if (
160 line.number >= highlightRange.from &&
161 line.number <= highlightRange.to
162 ) {
163 builder.add(line.from, line.from, lineHighlightDecoration);
164 }
165 pos = line.to + 1;
166 }
167 }
168 return builder.finish();
169}
170
171const highlightLineRangePlugin = ViewPlugin.fromClass(
172 class {

Callers 2

constructorMethod · 0.85
updateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected