@@ -8,17 +8,22 @@ import { URI } from 'vs/base/common/uri';
88import 'vs/css!./media/searchEditor' ;
99import { isDiffEditor , ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
1010import { TrackedRangeStickiness } from 'vs/editor/common/model' ;
11- import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
11+ import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
1212import { ILabelService } from 'vs/platform/label/common/label' ;
1313import { SearchResult } from 'vs/workbench/contrib/search/common/searchModel' ;
1414import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
1515import { SearchEditor } from 'vs/workbench/contrib/search/browser/searchEditor' ;
1616import { getOrMakeSearchEditorInput , SearchEditorInput } from 'vs/workbench/contrib/search/browser/searchEditorInput' ;
1717import { serializeSearchResultForEditor , serializeSearchConfiguration } from 'vs/workbench/contrib/search/browser/searchEditorSerialization' ;
18+ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
1819
1920
2021export const openNewSearchEditor =
21- async ( editorService : IEditorService , instantiationService : IInstantiationService ) => {
22+ async ( accessor : ServicesAccessor ) => {
23+ const editorService = accessor . get ( IEditorService ) ;
24+ const telemetryService = accessor . get ( ITelemetryService ) ;
25+ const instantiationService = accessor . get ( IInstantiationService ) ;
26+
2227 const activeEditor = editorService . activeTextEditorWidget ;
2328 let activeModel : ICodeEditor | undefined ;
2429 let selected = '' ;
@@ -41,17 +46,27 @@ export const openNewSearchEditor =
4146 }
4247 }
4348
49+ telemetryService . publicLog2 < { } , { } > ( 'searchEditor/openNewSearchEditor' ) ;
50+
4451 const input = instantiationService . invokeFunction ( getOrMakeSearchEditorInput , { text : serializeSearchConfiguration ( { query : selected } ) } ) ;
4552 await editorService . openEditor ( input , { pinned : true } ) ;
4653 } ;
4754
4855export const createEditorFromSearchResult =
49- async ( searchResult : SearchResult , rawIncludePattern : string , rawExcludePattern : string , labelService : ILabelService , editorService : IEditorService , instantiationService : IInstantiationService ) => {
56+ async ( accessor : ServicesAccessor , searchResult : SearchResult , rawIncludePattern : string , rawExcludePattern : string ) => {
5057 if ( ! searchResult . query ) {
5158 console . error ( 'Expected searchResult.query to be defined. Got' , searchResult ) ;
5259 return ;
5360 }
5461
62+ const editorService = accessor . get ( IEditorService ) ;
63+ const telemetryService = accessor . get ( ITelemetryService ) ;
64+ const instantiationService = accessor . get ( IInstantiationService ) ;
65+ const labelService = accessor . get ( ILabelService ) ;
66+
67+
68+ telemetryService . publicLog2 < { } , { } > ( 'searchEditor/createEditorFromSearchResult' ) ;
69+
5570 const labelFormatter = ( uri : URI ) : string => labelService . getUriLabel ( uri , { relative : true } ) ;
5671
5772 const { text, matchRanges } = serializeSearchResultForEditor ( searchResult , rawIncludePattern , rawExcludePattern , 0 , labelFormatter , true ) ;
0 commit comments