@@ -277,14 +277,14 @@ class APIReferenceProvider implements IAPIReferenceProvider {
277
277
class ResourceReferencesProvider implements IResourceReferencesProvider {
278
278
constructor ( private lspClient : SpxLSPClient ) { }
279
279
async provideResourceReferences ( ctx : ResourceReferencesContext ) : Promise < ResourceReference [ ] > {
280
- return this . lspClient . getResourceReferences ( ctx . textDocument . id )
280
+ return this . lspClient . getResourceReferences ( { signal : ctx . signal } , ctx . textDocument . id )
281
281
}
282
282
}
283
283
284
284
class InputHelperProvider implements IInputHelperProvider {
285
285
constructor ( private lspClient : SpxLSPClient ) { }
286
286
async provideInputSlots ( ctx : InputHelperContext ) : Promise < InputSlot [ ] > {
287
- const slots = await this . lspClient . getInputSlots ( ctx . textDocument . id )
287
+ const slots = await this . lspClient . getInputSlots ( { signal : ctx . signal } , ctx . textDocument . id )
288
288
return slots . filter ( ( slot ) => {
289
289
if ( slots . some ( ( s ) => s !== slot && rangeContains ( s . range , slot . range ) ) ) return false
290
290
return true
@@ -295,10 +295,13 @@ class InputHelperProvider implements IInputHelperProvider {
295
295
class InlayHintProvider implements IInlayHintProvider {
296
296
constructor ( private lspClient : SpxLSPClient ) { }
297
297
async provideInlayHints ( ctx : InlayHintContext ) : Promise < InlayHintItem [ ] > {
298
- const lspInlayHints = await this . lspClient . textDocumentInlayHint ( {
299
- textDocument : ctx . textDocument . id ,
300
- range : toLSPRange ( ctx . textDocument . getFullRange ( ) )
301
- } )
298
+ const lspInlayHints = await this . lspClient . textDocumentInlayHint (
299
+ { signal : ctx . signal } ,
300
+ {
301
+ textDocument : ctx . textDocument . id ,
302
+ range : toLSPRange ( ctx . textDocument . getFullRange ( ) )
303
+ }
304
+ )
302
305
const result : InlayHintItem [ ] = [ ]
303
306
if ( lspInlayHints == null ) return result
304
307
for ( const ih of lspInlayHints ) {
@@ -393,9 +396,12 @@ class DiagnosticsProvider
393
396
394
397
private async getLSDiagnostics ( ctx : DiagnosticsContext ) {
395
398
const diagnostics : Diagnostic [ ] = [ ]
396
- const report = await this . lspClient . textDocumentDiagnostic ( {
397
- textDocument : ctx . textDocument . id
398
- } )
399
+ const report = await this . lspClient . textDocumentDiagnostic (
400
+ { signal : ctx . signal } ,
401
+ {
402
+ textDocument : ctx . textDocument . id
403
+ }
404
+ )
399
405
if ( report . kind !== lsp . DocumentDiagnosticReportKind . Full )
400
406
throw new Error ( `Report kind ${ report . kind } not supported` )
401
407
for ( const item of report . items ) {
@@ -419,7 +425,7 @@ class HoverProvider implements IHoverProvider {
419
425
420
426
private async getExplainAction ( textDocument : TextDocumentIdentifier , position : Position ) {
421
427
let definition : DefinitionDocumentationItem | null = null
422
- const defId = await this . lspClient . getDefinition ( textDocument , position )
428
+ const defId = await this . lspClient . getDefinition ( { } , textDocument , position )
423
429
if ( defId == null ) return null
424
430
definition = await this . documentBase . getDocumentation ( defId )
425
431
if ( definition == null ) return null
@@ -438,7 +444,10 @@ class HoverProvider implements IHoverProvider {
438
444
private async getGoToDefinitionAction ( position : Position , lspParams : lsp . TextDocumentPositionParams ) {
439
445
const lspClient = this . lspClient
440
446
const [ definition , typeDefinition ] = (
441
- await Promise . all ( [ lspClient . textDocumentDefinition ( lspParams ) , lspClient . textDocumentTypeDefinition ( lspParams ) ] )
447
+ await Promise . all ( [
448
+ lspClient . textDocumentDefinition ( { } , lspParams ) ,
449
+ lspClient . textDocumentTypeDefinition ( { } , lspParams )
450
+ ] )
442
451
) . map ( ( def ) => {
443
452
if ( def == null ) return null
444
453
if ( Array . isArray ( def ) ) return def [ 0 ]
@@ -461,7 +470,7 @@ class HoverProvider implements IHoverProvider {
461
470
462
471
private async getRenameAction ( ctx : HoverContext , position : Position , lspParams : lsp . TextDocumentPositionParams ) {
463
472
const lspClient = this . lspClient
464
- const result = await lspClient . textDocumentPrepareRename ( lspParams )
473
+ const result = await lspClient . textDocumentPrepareRename ( { signal : ctx . signal } , lspParams )
465
474
if ( result == null || ! lsp . Range . is ( result ) ) return null // For now, we support Range only
466
475
return {
467
476
command : builtInCommandRename ,
@@ -480,7 +489,7 @@ class HoverProvider implements IHoverProvider {
480
489
textDocument : ctx . textDocument . id ,
481
490
position : toLSPPosition ( position )
482
491
}
483
- const lspHover = await this . lspClient . textDocumentHover ( lspParams )
492
+ const lspHover = await this . lspClient . textDocumentHover ( { signal : ctx . signal } , lspParams )
484
493
if ( lspHover == null ) return null
485
494
const contents : DefinitionDocumentationString [ ] = [ ]
486
495
if ( lsp . MarkupContent . is ( lspHover . contents ) ) {
@@ -544,10 +553,13 @@ class CompletionProvider implements ICompletionProvider {
544
553
}
545
554
546
555
async provideCompletion ( ctx : CompletionContext , position : Position ) : Promise < CompletionItem [ ] > {
547
- const items = await this . lspClient . getCompletionItems ( {
548
- textDocument : ctx . textDocument . id ,
549
- position : toLSPPosition ( position )
550
- } )
556
+ const items = await this . lspClient . getCompletionItems (
557
+ { signal : ctx . signal } ,
558
+ {
559
+ textDocument : ctx . textDocument . id ,
560
+ position : toLSPPosition ( position )
561
+ }
562
+ )
551
563
const lineContent = ctx . textDocument . getLineContent ( position . line )
552
564
const isLineEnd = lineContent . length === position . column - 1
553
565
const maybeItems = await Promise . all (
@@ -603,8 +615,8 @@ class ContextMenuProvider implements IContextMenuProvider {
603
615
private documentBase : DocumentBase
604
616
) { }
605
617
606
- private async getExplainMenuItemForPosition ( { textDocument } : ContextMenuContext , position : Position ) {
607
- const defId = await this . lspClient . getDefinition ( textDocument . id , position )
618
+ private async getExplainMenuItemForPosition ( { signal , textDocument } : ContextMenuContext , position : Position ) {
619
+ const defId = await this . lspClient . getDefinition ( { signal } , textDocument . id , position )
608
620
if ( defId == null ) return null
609
621
const definition = await this . documentBase . getDocumentation ( defId )
610
622
if ( definition == null ) return null
@@ -620,12 +632,12 @@ class ContextMenuProvider implements IContextMenuProvider {
620
632
}
621
633
}
622
634
623
- private async getRenameMenuItemForPosition ( { textDocument } : ContextMenuContext , position : Position ) {
635
+ private async getRenameMenuItemForPosition ( { textDocument, signal } : ContextMenuContext , position : Position ) {
624
636
const lspParams = {
625
637
textDocument : textDocument . id ,
626
638
position : toLSPPosition ( position )
627
639
}
628
- const result = await this . lspClient . textDocumentPrepareRename ( lspParams )
640
+ const result = await this . lspClient . textDocumentPrepareRename ( { signal } , lspParams )
629
641
if ( result == null || ! lsp . Range . is ( result ) ) return null // For now, we support Range only
630
642
return {
631
643
command : builtInCommandRename ,
@@ -959,10 +971,13 @@ export class CodeEditor extends Disposable {
959
971
async formatTextDocument ( id : TextDocumentIdentifier ) {
960
972
const textDocument = this . getTextDocument ( id )
961
973
if ( textDocument == null ) return
962
- const edits = await this . lspClient . textDocumentFormatting ( {
963
- textDocument : id ,
964
- options : lsp . FormattingOptions . create ( tabSize , insertSpaces )
965
- } )
974
+ const edits = await this . lspClient . textDocumentFormatting (
975
+ { } ,
976
+ {
977
+ textDocument : id ,
978
+ options : lsp . FormattingOptions . create ( tabSize , insertSpaces )
979
+ }
980
+ )
966
981
if ( edits == null ) return
967
982
textDocument . pushEdits ( edits . map ( fromLSPTextEdit ) )
968
983
}
@@ -988,7 +1003,7 @@ export class CodeEditor extends Disposable {
988
1003
}
989
1004
990
1005
async diagnosticWorkspace ( ) : Promise < WorkspaceDiagnostics > {
991
- const diagnosticReport = await this . lspClient . workspaceDiagnostic ( { previousResultIds : [ ] } )
1006
+ const diagnosticReport = await this . lspClient . workspaceDiagnostic ( { } , { previousResultIds : [ ] } )
992
1007
const items : TextDocumentDiagnostics [ ] = [ ]
993
1008
for ( const report of diagnosticReport . items ) {
994
1009
if ( report . kind === 'unchanged' ) continue // For now, we support 'full' reports only
@@ -1002,18 +1017,21 @@ export class CodeEditor extends Disposable {
1002
1017
1003
1018
/** Update code for renaming */
1004
1019
async rename ( id : TextDocumentIdentifier , position : Position , newName : string ) {
1005
- const edit = await this . lspClient . textDocumentRename ( {
1006
- textDocument : id ,
1007
- position : toLSPPosition ( position ) ,
1008
- newName
1009
- } )
1020
+ const edit = await this . lspClient . textDocumentRename (
1021
+ { } ,
1022
+ {
1023
+ textDocument : id ,
1024
+ position : toLSPPosition ( position ) ,
1025
+ newName
1026
+ }
1027
+ )
1010
1028
if ( edit == null ) return
1011
1029
this . applyWorkspaceEdit ( edit )
1012
1030
}
1013
1031
1014
1032
/** Update code for resource renaming, should be called before model name update */
1015
1033
async renameResource ( resource : ResourceIdentifier , newName : string ) {
1016
- const edit = await this . lspClient . workspaceExecuteCommandSpxRenameResources ( { resource, newName } )
1034
+ const edit = await this . lspClient . workspaceExecuteCommandSpxRenameResources ( { } , { resource, newName } )
1017
1035
if ( edit == null ) return
1018
1036
this . applyWorkspaceEdit ( edit )
1019
1037
}
0 commit comments