MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / startRequest

Method startRequest

src/cm/lsp/tooltipExtensions.ts:672–713  ·  view source on GitHub ↗
(plugin: LSPPlugin, context: SignatureHelpContext)

Source from the content-addressed store, hash-verified

670 }
671
672 startRequest(plugin: LSPPlugin, context: SignatureHelpContext) {
673 if (this.delayedRequest) {
674 clearTimeout(this.delayedRequest);
675 this.delayedRequest = 0;
676 }
677
678 const { view } = plugin;
679 const pos = view.state.selection.main.head;
680
681 if (this.activeRequest) this.activeRequest.drop = true;
682 const request = (this.activeRequest = { pos, drop: false });
683
684 getSignatureHelp(plugin, pos, context).then(
685 (result) => {
686 if (request.drop) return;
687
688 if (result && result.signatures.length) {
689 const current = view.state.field(signatureState);
690 const same = current && sameSignatures(current.data, result);
691 const active =
692 same && context.triggerKind === 3
693 ? current!.active
694 : (result.activeSignature ?? 0);
695
696 if (same && sameActiveParam(current!.data, result, active)) return;
697
698 view.dispatch({
699 effects: signatureEffect.of({
700 data: result,
701 active,
702 pos: same ? current!.tooltip.pos : request.pos,
703 }),
704 });
705 } else if (view.state.field(signatureState, false)) {
706 view.dispatch({ effects: signatureEffect.of(null) });
707 }
708 },
709 context.triggerKind === 1
710 ? (error) => plugin.reportError("Signature request failed", error)
711 : undefined,
712 );
713 }
714
715 close() {
716 if (this.delayedRequest) {

Callers 2

scheduleRequestMethod · 0.45
showSignatureHelpFunction · 0.45

Calls 3

getSignatureHelpFunction · 0.85
sameSignaturesFunction · 0.85
sameActiveParamFunction · 0.85

Tested by

no test coverage detected