@@ -12,6 +12,7 @@ import { MainThreadDocumentsShape } from 'vs/workbench/api/common/extHost.protoc
1212import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel' ;
1313import { mock } from 'vs/base/test/common/mock' ;
1414import * as perfData from './extHostDocumentData.test.perf-data' ;
15+ import { setDefaultGetWordAtTextConfig } from 'vs/editor/common/core/wordHelper' ;
1516
1617suite ( 'ExtHostDocumentData' , ( ) => {
1718
@@ -316,14 +317,22 @@ suite('ExtHostDocumentData', () => {
316317 perfData . _$_$_expensive
317318 ] , '\n' , 1 , 'text' , false ) ;
318319
319- let range = data . document . getWordRangeAtPosition ( new Position ( 0 , 1_177_170 ) , regex ) ! ;
320- assert . strictEqual ( range , undefined ) ;
321-
322- const pos = new Position ( 0 , 1177170 ) ;
323- range = data . document . getWordRangeAtPosition ( pos ) ! ;
324- assert . ok ( range ) ;
325- assert . ok ( range . contains ( pos ) ) ;
326- assert . strictEqual ( data . document . getText ( range ) , 'TaskDefinition' ) ;
320+ // this test only ensures that we eventually give and timeout (when searching "funny" words and long lines)
321+ // for the sake of speedy tests we lower the timeBudget here
322+ const config = setDefaultGetWordAtTextConfig ( { maxLen : 1000 , windowSize : 15 , timeBudget : 30 } ) ;
323+ try {
324+ let range = data . document . getWordRangeAtPosition ( new Position ( 0 , 1_177_170 ) , regex ) ! ;
325+ assert . strictEqual ( range , undefined ) ;
326+
327+ const pos = new Position ( 0 , 1177170 ) ;
328+ range = data . document . getWordRangeAtPosition ( pos ) ! ;
329+ assert . ok ( range ) ;
330+ assert . ok ( range . contains ( pos ) ) ;
331+ assert . strictEqual ( data . document . getText ( range ) , 'TaskDefinition' ) ;
332+
333+ } finally {
334+ config . dispose ( ) ;
335+ }
327336 } ) ;
328337
329338 test ( 'Rename popup sometimes populates with text on the left side omitted #96013' , function ( ) {
0 commit comments