'use strict' ; import { Range , TextEditor , window , TextDocument } from 'vscode' ; export function decorateWithoutWhitespace ( ranges , target , line , offset ) { let start = 0 ; let newWord = true ; let i = 0 ; for ( ; i < target . length ; ++ i ) { if ( target [ i ] === ' ' || target [ i ] === '\t' || target [ i ] === '\n' ) { if ( ! newWord ) { newWord = true ; ranges . push ( new Range ( line , offset + start , line , offset + i ) ) ; } } else { if ( newWord ) { newWord = false ; start = i ; } } } if ( ! newWord ) { ranges . push ( new Range ( line , offset + start , line , offset + i ) ) ; } } export function getTextEditor ( document ) { return window . visibleTextEditors . find ( editor => editor . document === document ) ; }