66 */
77
88import type { LocationLink , Position , Range , TextDocumentPositionParams } from 'vscode-languageserver-protocol'
9+ import { ClientRequestOptions } from './infoviewApi'
910import { LeanDiagnostic , RpcPtr } from './lspTypes'
1011import { RpcSessionAtPos } from './rpcSessions'
1112
@@ -85,15 +86,17 @@ export interface InteractiveGoals {
8586export function getInteractiveGoals (
8687 rs : RpcSessionAtPos ,
8788 pos : TextDocumentPositionParams ,
89+ options ?: ClientRequestOptions ,
8890) : Promise < InteractiveGoals | undefined > {
89- return rs . call ( 'Lean.Widget.getInteractiveGoals' , pos )
91+ return rs . call ( 'Lean.Widget.getInteractiveGoals' , pos , options )
9092}
9193
9294export function getInteractiveTermGoal (
9395 rs : RpcSessionAtPos ,
9496 pos : TextDocumentPositionParams ,
97+ options ?: ClientRequestOptions ,
9598) : Promise < InteractiveTermGoal | undefined > {
96- return rs . call ( 'Lean.Widget.getInteractiveTermGoal' , pos )
99+ return rs . call ( 'Lean.Widget.getInteractiveTermGoal' , pos , options )
97100}
98101
99102export type Name = string
@@ -125,43 +128,59 @@ export interface LineRange {
125128export function getInteractiveDiagnostics (
126129 rs : RpcSessionAtPos ,
127130 lineRange ?: LineRange ,
131+ options ?: ClientRequestOptions ,
128132) : Promise < InteractiveDiagnostic [ ] > {
129- return rs . call ( 'Lean.Widget.getInteractiveDiagnostics' , { lineRange } )
133+ return rs . call ( 'Lean.Widget.getInteractiveDiagnostics' , { lineRange } , options )
130134}
131135
132136export function InteractiveDiagnostics_msgToInteractive (
133137 rs : RpcSessionAtPos ,
134138 msg : MessageData ,
135139 indent : number ,
140+ options ?: ClientRequestOptions ,
136141) : Promise < TaggedText < MsgEmbed > > {
137142 interface MessageToInteractive {
138143 msg : MessageData
139144 indent : number
140145 }
141- return rs . call < MessageToInteractive , TaggedText < MsgEmbed > > ( 'Lean.Widget.InteractiveDiagnostics.msgToInteractive' , {
142- msg,
143- indent,
144- } )
146+ return rs . call < MessageToInteractive , TaggedText < MsgEmbed > > (
147+ 'Lean.Widget.InteractiveDiagnostics.msgToInteractive' ,
148+ {
149+ msg,
150+ indent,
151+ } ,
152+ options ,
153+ )
145154}
146155
147156export function lazyTraceChildrenToInteractive (
148157 rs : RpcSessionAtPos ,
149158 children : LazyTraceChildren ,
159+ options ?: ClientRequestOptions ,
150160) : Promise < TaggedText < MsgEmbed > [ ] > {
151- return rs . call ( 'Lean.Widget.lazyTraceChildrenToInteractive' , children )
161+ return rs . call ( 'Lean.Widget.lazyTraceChildrenToInteractive' , children , options )
152162}
153163
154- export function InteractiveDiagnostics_infoToInteractive ( rs : RpcSessionAtPos , info : InfoWithCtx ) : Promise < InfoPopup > {
155- return rs . call ( 'Lean.Widget.InteractiveDiagnostics.infoToInteractive' , info )
164+ export function InteractiveDiagnostics_infoToInteractive (
165+ rs : RpcSessionAtPos ,
166+ info : InfoWithCtx ,
167+ options ?: ClientRequestOptions ,
168+ ) : Promise < InfoPopup > {
169+ return rs . call ( 'Lean.Widget.InteractiveDiagnostics.infoToInteractive' , info , options )
156170}
157171
158172export type GoToKind = 'declaration' | 'definition' | 'type'
159- export function getGoToLocation ( rs : RpcSessionAtPos , kind : GoToKind , info : InfoWithCtx ) : Promise < LocationLink [ ] > {
173+ export function getGoToLocation (
174+ rs : RpcSessionAtPos ,
175+ kind : GoToKind ,
176+ info : InfoWithCtx ,
177+ options ?: ClientRequestOptions ,
178+ ) : Promise < LocationLink [ ] > {
160179 interface GetGoToLocationParams {
161180 kind : GoToKind
162181 info : InfoWithCtx
163182 }
164- return rs . call < GetGoToLocationParams , LocationLink [ ] > ( 'Lean.Widget.getGoToLocation' , { kind, info } )
183+ return rs . call < GetGoToLocationParams , LocationLink [ ] > ( 'Lean.Widget.getGoToLocation' , { kind, info } , options )
165184}
166185
167186export interface UserWidget {
@@ -192,8 +211,12 @@ export interface UserWidgets {
192211}
193212
194213/** Given a position, returns all of the user-widgets on the infotree at this position. */
195- export function Widget_getWidgets ( rs : RpcSessionAtPos , pos : Position ) : Promise < UserWidgets > {
196- return rs . call < Position , UserWidgets > ( 'Lean.Widget.getWidgets' , pos )
214+ export function Widget_getWidgets (
215+ rs : RpcSessionAtPos ,
216+ pos : Position ,
217+ options ?: ClientRequestOptions ,
218+ ) : Promise < UserWidgets > {
219+ return rs . call < Position , UserWidgets > ( 'Lean.Widget.getWidgets' , pos , options )
197220}
198221
199222/** Code that should be dynamically loaded by the UserWidget component. */
@@ -208,12 +231,17 @@ export interface WidgetSource {
208231 *
209232 * We make the assumption that either the code doesn't exist, or it exists and does not change for the lifetime of the widget.
210233 */
211- export function Widget_getWidgetSource ( rs : RpcSessionAtPos , pos : Position , hash : string ) : Promise < WidgetSource > {
234+ export function Widget_getWidgetSource (
235+ rs : RpcSessionAtPos ,
236+ pos : Position ,
237+ hash : string ,
238+ options ?: ClientRequestOptions ,
239+ ) : Promise < WidgetSource > {
212240 interface GetWidgetSourceParams {
213241 hash : string
214242 pos : Position
215243 }
216- return rs . call < GetWidgetSourceParams , WidgetSource > ( 'Lean.Widget.getWidgetSource' , { pos, hash } )
244+ return rs . call < GetWidgetSourceParams , WidgetSource > ( 'Lean.Widget.getWidgetSource' , { pos, hash } , options )
217245}
218246
219247export type HighlightedSubexprInfo = SubexprInfo | 'highlighted'
@@ -244,9 +272,14 @@ export function highlightMatches(
244272 rs : RpcSessionAtPos ,
245273 query : string ,
246274 msg : TaggedText < MsgEmbed > ,
275+ options ?: ClientRequestOptions ,
247276) : Promise < TaggedText < HighlightedMsgEmbed > > {
248- return rs . call < HighlightMatchesParams , TaggedText < HighlightedMsgEmbed > > ( 'Lean.Widget.highlightMatches' , {
249- query,
250- msg,
251- } )
277+ return rs . call < HighlightMatchesParams , TaggedText < HighlightedMsgEmbed > > (
278+ 'Lean.Widget.highlightMatches' ,
279+ {
280+ query,
281+ msg,
282+ } ,
283+ options ,
284+ )
252285}
0 commit comments