@@ -57,6 +57,8 @@ export class InMemoryDocumentStore {
5757 }
5858}
5959
60+ type ListenerFn = ( ...args : unknown [ ] ) => unknown ;
61+
6062export function positionAt ( text : string , needle : string , offsetInNeedle = 0 ) : { line : number ; character : number } {
6163 const index = text . indexOf ( needle ) ;
6264 if ( index < 0 ) {
@@ -96,7 +98,7 @@ export function makeFakeConnection(options?: {
9698} ) {
9799 const sentDiagnostics : Array < { uri : string ; diagnostics : Diagnostic [ ] } > = [ ] ;
98100 const configurationRequests : Array < unknown > = [ ] ;
99- const listeners : Record < string , Function [ ] > = { } ;
101+ const listeners : Record < string , ListenerFn [ ] > = { } ;
100102
101103 const connection = {
102104 workspace : {
@@ -114,16 +116,16 @@ export function makeFakeConnection(options?: {
114116 sendDiagnostics ( payload : { uri : string ; diagnostics : Diagnostic [ ] } ) {
115117 sentDiagnostics . push ( payload ) ;
116118 } ,
117- onExit ( cb : Function ) {
119+ onExit ( cb : ListenerFn ) {
118120 ( listeners [ 'exit' ] ||= [ ] ) . push ( cb ) ;
119121 } ,
120- onReferences ( cb : Function ) {
122+ onReferences ( cb : ListenerFn ) {
121123 ( listeners [ 'references' ] ||= [ ] ) . push ( cb ) ;
122124 } ,
123- onRenameRequest ( cb : Function ) {
125+ onRenameRequest ( cb : ListenerFn ) {
124126 ( listeners [ 'rename' ] ||= [ ] ) . push ( cb ) ;
125127 } ,
126- onPrepareRename ( cb : Function ) {
128+ onPrepareRename ( cb : ListenerFn ) {
127129 ( listeners [ 'prepareRename' ] ||= [ ] ) . push ( cb ) ;
128130 } ,
129131 } as unknown as import ( 'vscode-languageserver' ) . Connection ;
0 commit comments