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

Method showViewer

src/plotViewer/index.ts:72–99  ·  view source on GitHub ↗
(urlString: string)

Source from the content-addressed store, hash-verified

70 }
71
72 public async showViewer(urlString: string): Promise<void> {
73 const url = new URL(urlString);
74 const host = url.host;
75 const token = url.searchParams.get('token') || undefined;
76 const ind = this.viewers.findIndex(
77 (viewer) => viewer.host === host
78 );
79 if (ind >= 0) {
80 const viewer = this.viewers.splice(ind, 1)[0];
81 this.viewers.unshift(viewer);
82 viewer.show();
83 } else {
84 const conf = config();
85 const colorTheme = conf.get('plot.defaults.colorTheme', 'vscode');
86 this.viewerOptions.stripStyles = (colorTheme === 'vscode');
87 this.viewerOptions.previewPlotLayout = conf.get<PreviewPlotLayout>('plot.defaults.plotPreviewLayout', 'multirow');
88 this.viewerOptions.refreshTimeoutLength = conf.get('plot.timing.refreshInterval', 10);
89 this.viewerOptions.resizeTimeoutLength = conf.get('plot.timing.resizeInterval', 100);
90 this.viewerOptions.fullWindow = conf.get('plot.defaults.fullWindowMode', false);
91 this.viewerOptions.token = token;
92 const viewer = new HttpgdViewer(host, this.viewerOptions);
93 if (isHost() && autoShareBrowser) {
94 const disposable = await shareServer(url, 'httpgd');
95 viewer.webviewPanel?.onDidDispose(() => void disposable.dispose());
96 }
97 this.viewers.unshift(viewer);
98 }
99 }
100
101 public registerActiveViewer(viewer: HttpgdViewer): void {
102 const ind = this.recentlyActiveViewers.indexOf(viewer);

Callers 4

openUrlMethod · 0.95
updateRequestFunction · 0.80
updateGuestRequestFunction · 0.80
shareCommands.tsFile · 0.80

Calls 6

showMethod · 0.95
configFunction · 0.90
isHostFunction · 0.90
shareServerFunction · 0.90
disposeMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected