/**
 * TextmateHighlighting.DebugScopesTest
 *
 * Validate the 'editor.textMateHighlighting.debugScopes' functionality
 */ import * as assert from "assert" ; import * as Oni from "oni-api" ; import * as types from "vscode-languageserver-types" ; import { createNewFile , getElementByClassName } from "./Common" ; export const test = async ( oni ) => { await oni . automation . waitForEditors ( ) ; await createNewFile ( "ts" , oni , "const test = 1;" ) ; const currentBuffer = oni . editors . activeEditor . activeBuffer ; const editorAsAny = oni . editors . activeEditor ; const syntaxHighlighter = editorAsAny . syntaxHighlighter ; let tokens = null ; await oni . automation . waitFor ( ( ) => { tokens = syntaxHighlighter . getHighlightTokenAt ( currentBuffer . id , types . Position . create ( 0 , 0 ) ) ; return tokens && tokens . scopes && tokens . scopes . length > 0 ; } , 120000 ) ; oni . automation . sendKeys ( "w" ) ; let element = null ; await oni . automation . waitFor ( ( ) => { element = getElementByClassName ( "quick-info-debug-scopes" ) ; return ! ! element ; } , 120000 ) ; await oni . automation . waitFor ( ( ) => { const items = element . getElementsByTagName ( "li" ) ; return items . length > 0 ; } ) ; assert . ok ( element . textContent . indexOf ( "DEBUG: TextMate Scopes" ) >= 0 , "Validate debug scopes showed up" ) ; } ; export const settings = { config : { "editor.textMateHighlighting.debugScopes" : true , } , } ;