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

Class CustomGutterComponent

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

Source from the content-addressed store, hash-verified

3402}
3403
3404class CustomGutterComponent {
3405 constructor (props) {
3406 this.props = props
3407 this.element = this.props.element
3408 this.virtualNode = $.div(null)
3409 this.virtualNode.domNode = this.element
3410 etch.updateSync(this)
3411 }
3412
3413 update (props) {
3414 this.props = props
3415 etch.updateSync(this)
3416 }
3417
3418 destroy () {
3419 etch.destroy(this)
3420 }
3421
3422 render () {
3423 return $.div(
3424 {
3425 className: 'gutter',
3426 attributes: {'gutter-name': this.props.name},
3427 style: {
3428 display: this.props.visible ? '' : 'none'
3429 }
3430 },
3431 $.div(
3432 {
3433 className: 'custom-decorations',
3434 style: {height: this.props.height + 'px'}
3435 },
3436 this.renderDecorations()
3437 )
3438 )
3439 }
3440
3441 renderDecorations () {
3442 if (!this.props.decorations) return null
3443
3444 return this.props.decorations.map(({className, element, top, height}) => {
3445 return $(CustomGutterDecorationComponent, {
3446 className,
3447 element,
3448 top,
3449 height
3450 })
3451 })
3452 }
3453}
3454
3455class CustomGutterDecorationComponent {
3456 constructor (props) {

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…