MCPcopy Create free account
hub / github.com/tree-sitter/tree-sitter-javascript / LinesTileComponent

Class LinesTileComponent

examples/text-editor-component.js:3603–3878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3601}
3602
3603class LinesTileComponent {
3604 constructor (props) {
3605 this.props = props
3606 etch.initialize(this)
3607 this.createLines()
3608 this.updateBlockDecorations({}, props)
3609 }
3610
3611 update (newProps) {
3612 if (this.shouldUpdate(newProps)) {
3613 const oldProps = this.props
3614 this.props = newProps
3615 etch.updateSync(this)
3616 if (!newProps.measuredContent) {
3617 this.updateLines(oldProps, newProps)
3618 this.updateBlockDecorations(oldProps, newProps)
3619 }
3620 }
3621 }
3622
3623 destroy () {
3624 for (let i = 0; i < this.lineComponents.length; i++) {
3625 this.lineComponents[i].destroy()
3626 }
3627 this.lineComponents.length = 0
3628
3629 return etch.destroy(this)
3630 }
3631
3632 render () {
3633 const {height, width, top} = this.props
3634
3635 return $.div(
3636 {
3637 style: {
3638 contain: 'layout style',
3639 position: 'absolute',
3640 height: height + 'px',
3641 width: width + 'px',
3642 transform: `translateY(${top}px)`
3643 }
3644 }
3645 // Lines and block decorations will be manually inserted here for efficiency
3646 )
3647 }
3648
3649 createLines () {
3650 const {
3651 tileStartRow, screenLines, lineDecorations, textDecorations,
3652 nodePool, displayLayer, lineComponentsByScreenLineId
3653 } = this.props
3654
3655 this.lineComponents = []
3656 for (let i = 0, length = screenLines.length; i < length; i++) {
3657 const component = new LineComponent({
3658 screenLine: screenLines[i],
3659 screenRow: tileStartRow + i,
3660 lineDecoration: lineDecorations[i],

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…