File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -69,20 +69,24 @@ export async function sendRequestWithRetry<TParam, TRet>(
6969 return await ( token
7070 ? client . sendRequest ( reqType , param , token )
7171 : client . sendRequest ( reqType , param ) ) ;
72- } catch ( error ) {
72+ } catch ( error : unknown ) {
7373 if ( delay === null ) {
7474 log . warn ( "LSP request timed out" , { method : reqType . method , param, error } ) ;
7575 throw error ;
7676 }
77- if ( error . code === lc . LSPErrorCodes . RequestCancelled ) {
78- throw error ;
79- }
8077
81- if ( error . code !== lc . LSPErrorCodes . ContentModified ) {
82- log . warn ( "LSP request failed" , { method : reqType . method , param, error } ) ;
83- throw error ;
78+ if ( error instanceof lc . ResponseError ) {
79+ switch ( error . code ) {
80+ case lc . LSPErrorCodes . RequestCancelled :
81+ throw error ;
82+ case lc . LSPErrorCodes . ContentModified :
83+ await sleep ( delay ) ;
84+ continue ;
85+ }
8486 }
85- await sleep ( delay ) ;
87+
88+ log . warn ( "LSP request failed" , { method : reqType . method , param, error } ) ;
89+ throw error ;
8690 }
8791 }
8892 throw "unreachable" ;
You can’t perform that action at this time.
0 commit comments