MCPcopy
hub / github.com/wavetermdev/waveterm / fetchSuggestions

Function fetchSuggestions

frontend/app/view/preview/preview.tsx:67–97  ·  view source on GitHub ↗
(
    env: PreviewEnv,
    model: PreviewModel,
    query: string,
    reqContext: SuggestionRequestContext
)

Source from the content-addressed store, hash-verified

65});
66
67const 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
99function PreviewView({
100 blockRef,

Callers 2

SuggestionControlInnerFunction · 0.85
fetchSuggestionsFnFunction · 0.85

Calls 5

makeConnRouteFunction · 0.90
isBlankFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected