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

Class RHelp

src/helpViewer/index.ts:212–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210// The name api.HelpPanel is a bit misleading
211// This class manages all R-help and R-packages related functions
212export class RHelp implements api.HelpPanel, vscode.WebviewPanelSerializer<string>
213{
214 // Path of a vanilla R installation
215 readonly rPath: string
216
217 // If applicable, the currently opened wd.
218 // Used to read the correct .Rprofile when launching R
219 readonly cwd?: string
220
221 // Provides the content of help pages:
222 readonly helpProvider: HelpProvider
223
224 // Provides a list of aliases:
225 readonly aliasProvider: AliasProvider
226
227 // Provides previews of local help pages:
228 readonly previewProviders: RLocalHelpPreviewer[]
229
230 // Show/Install/Remove packages:
231 readonly packageManager: PackageManager
232
233 // The tree view that shows available packages and help topics
234 readonly treeViewWrapper: HelpTreeWrapper
235
236 // the webview panel(s) where the help is shown
237 public readonly helpPanels: HelpPanel[] = []
238
239 // locations on disk, only changed on construction
240 readonly webviewScriptFile: vscode.Uri // the javascript added to help pages
241 readonly webviewStyleFile: vscode.Uri // the css file applied to help pages
242
243 // cache for modified help files (syntax highlighting etc.)
244 private cachedHelpFiles: Map<string, HelpFile | undefined> = new Map<
245 string,
246 HelpFile | undefined
247 >()
248
249 // The options used when creating this instance
250 private helpPanelOptions: HelpOptions
251 private helpPreviewerOptions: RHelpPreviewerOptions
252
253 constructor(options: HelpOptions) {
254 this.rPath = options.rPath;
255 this.webviewScriptFile = vscode.Uri.file(options.webviewScriptPath);
256 this.webviewStyleFile = vscode.Uri.file(options.webviewStylePath);
257 const pkgListener = () => {
258 console.log('Restarting Help Server...');
259 void this.refresh(true);
260 };
261 this.helpProvider = new HelpProvider({
262 ...options,
263 pkgListener: pkgListener,
264 });
265 this.aliasProvider = new AliasProvider(options);
266 const previewListener = (previewer: RLocalHelpPreviewer) => {
267 console.log(`Refreshing R Help preview: ${previewer.packageDir}`);
268 void this.refreshPreviewer(previewer);
269 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected