(
env: PreviewEnv,
model: PreviewModel,
query: string,
reqContext: SuggestionRequestContext
)
| 65 | }); |
| 66 | |
| 67 | const fetchSuggestions = async ( |
| 68 | env: PreviewEnv, |
| 69 | model: PreviewModel, |
| 70 | query: string, |
| 71 | reqContext: SuggestionRequestContext |
| 72 | ): Promise<FetchSuggestionsResponse> => { |
| 73 | const conn = await globalStore.get(model.connection); |
| 74 | let route = makeConnRoute(conn); |
| 75 | if (isBlank(conn)) { |
| 76 | route = null; |
| 77 | } |
| 78 | if (reqContext?.dispose) { |
| 79 | env.rpc.DisposeSuggestionsCommand(TabRpcClient, reqContext.widgetid, { noresponse: true, route: route }); |
| 80 | return null; |
| 81 | } |
| 82 | const fileInfo = await globalStore.get(model.statFile); |
| 83 | if (fileInfo == null) { |
| 84 | return null; |
| 85 | } |
| 86 | const sdata = { |
| 87 | suggestiontype: "file", |
| 88 | "file:cwd": fileInfo.path, |
| 89 | query: query, |
| 90 | widgetid: reqContext.widgetid, |
| 91 | reqnum: reqContext.reqnum, |
| 92 | "file:connection": conn, |
| 93 | }; |
| 94 | return await env.rpc.FetchSuggestionsCommand(TabRpcClient, sdata, { |
| 95 | route: route, |
| 96 | }); |
| 97 | }; |
| 98 | |
| 99 | function PreviewView({ |
| 100 | blockRef, |
no test coverage detected