import * as vscode from 'vscode' ; export function findParentYaml ( document , line ) { const indent = yamlIndentLevel ( document . lineAt ( line ) . text ) ; while ( line >= 0 ) { const txt = document . lineAt ( line ) ; if ( yamlIndentLevel ( txt . text ) < indent ) { return line ; } line = line - 1 ; } return line ; } function yamlIndentLevel ( str ) { let i = 0 ; while ( true ) { if ( str . length <= i || ! isYamlIndentChar ( str . charAt ( i ) ) ) { return i ; } ++ i ; } } function isYamlIndentChar ( ch ) { return ch === ' ' || ch === '-' ; }