MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / showDataView

Function showDataView

src/session.ts:337–389  ·  view source on GitHub ↗
(source: string, type: string, title: string, file: string, viewer: string)

Source from the content-addressed store, hash-verified

335}
336
337export async function showDataView(source: string, type: string, title: string, file: string, viewer: string): Promise<void> {
338 console.info(`[showDataView] source: ${source}, type: ${type}, title: ${title}, file: ${file}, viewer: ${viewer}`);
339
340 if (isGuestSession) {
341 resDir = guestResDir;
342 }
343
344 if (source === 'table') {
345 const panel = window.createWebviewPanel('dataview', title,
346 {
347 preserveFocus: true,
348 viewColumn: ViewColumn[viewer as keyof typeof ViewColumn],
349 },
350 {
351 enableScripts: true,
352 enableFindWidget: true,
353 retainContextWhenHidden: true,
354 localResourceRoots: [Uri.file(resDir)],
355 });
356 const content = await getTableHtml(panel.webview, file);
357 panel.iconPath = new UriIcon('open-preview');
358 panel.webview.html = content;
359 } else if (source === 'list') {
360 const panel = window.createWebviewPanel('dataview', title,
361 {
362 preserveFocus: true,
363 viewColumn: ViewColumn[viewer as keyof typeof ViewColumn],
364 },
365 {
366 enableScripts: true,
367 enableFindWidget: true,
368 retainContextWhenHidden: true,
369 localResourceRoots: [Uri.file(resDir)],
370 });
371 const content = await getListHtml(panel.webview, file);
372 panel.iconPath = new UriIcon('open-preview');
373 panel.webview.html = content;
374 } else {
375 if (isGuestSession) {
376 const fileContent = await rGuestService?.requestFileContent(file, 'utf8');
377 if (fileContent) {
378 await openVirtualDoc(file, fileContent, true, true, ViewColumn[viewer as keyof typeof ViewColumn]);
379 }
380 } else {
381 await commands.executeCommand('vscode.open', Uri.file(file), {
382 preserveFocus: true,
383 preview: true,
384 viewColumn: ViewColumn[viewer as keyof typeof ViewColumn],
385 });
386 }
387 }
388 console.info('[showDataView] Done');
389}
390
391export async function getTableHtml(webview: Webview, file: string): Promise<string> {
392 resDir = isGuestSession ? guestResDir : resDir;

Callers 2

updateGuestRequestFunction · 0.90
updateRequestFunction · 0.85

Calls 4

openVirtualDocFunction · 0.90
getTableHtmlFunction · 0.85
getListHtmlFunction · 0.85
requestFileContentMethod · 0.80

Tested by

no test coverage detected