Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
locationPositions.pipe(withLatestFrom(this.codeViewElements)).subscribe(([position, codeView]) => {
codeView = codeView! // locationPositions is derived from componentUpdates, so this is guaranteed to exist
const codeCells = getCodeElementsInRange({
codeView,
position,
getCodeElementFromLineNumber: domFunctions.getCodeElementFromLineNumber,
})
// Remove existing highlighting
for (const selected of codeView.querySelectorAll('.selected')) {
selected.classList.remove('selected')
}
for (const { line, element } of codeCells) {
this.createLineDecorationAttachmentDOMNode(line, element)
// Highlight row
const row = element.parentElement as HTMLTableRowElement
row.classList.add('selected')
}
// Update overlay position for discussions gutter icon.
locationPositions.pipe(withLatestFrom(this.codeViewElements)).subscribe(([position, codeView]) => {
codeView = codeView! // locationPositions is derived from componentUpdates, so this is guaranteed to exist
const codeCells = getCodeElementsInRange({
codeView,
position,
getCodeElementFromLineNumber: domFunctions.getCodeElementFromLineNumber,
})
// Remove existing highlighting
for (const selected of codeView.querySelectorAll('.selected')) {
selected.classList.remove('selected')
}
for (const { line, element } of codeCells) {
this.createLineDecorationAttachmentDOMNode(line, element)
// Highlight row
const row = element.parentElement as HTMLTableRowElement
row.classList.add('selected')
}
// Update overlay position for discussions gutter icon.