MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / pickAndInstallPackages

Method pickAndInstallPackages

src/helpViewer/packages.ts:177–191  ·  view source on GitHub ↗
(pickMany: boolean = false)

Source from the content-addressed store, hash-verified

175
176 // let the user pick and install a package from CRAN
177 public async pickAndInstallPackages(pickMany: boolean = false): Promise<boolean> {
178 const packages = await doWithProgress(() => this.getPackages(true), this.rHelp.treeViewWrapper.viewId);
179 if(!packages?.length){
180 return false;
181 }
182 const pkgs = await pickPackages(packages, 'Please select a package.', pickMany);
183 if(pkgs?.length){
184 const pkgsConfirmed = await confirmPackages('Are you sure you want to install these packages?', pkgs);
185 if(pkgsConfirmed?.length){
186 const names = pkgsConfirmed.map(v => v.name);
187 return await this.installPackages(names, true);
188 }
189 }
190 return false;
191 }
192
193 // remove a specified package. The packagename is selected e.g. in the help tree-view
194 public async removePackage(pkgName: string): Promise<boolean> {

Callers 2

_handleCommandMethod · 0.80
callBackMethod · 0.80

Calls 5

getPackagesMethod · 0.95
installPackagesMethod · 0.95
doWithProgressFunction · 0.90
pickPackagesFunction · 0.85
confirmPackagesFunction · 0.85

Tested by

no test coverage detected