| 107 | |
| 108 | // Funciton to clear only the cached files regarding an individual package etc. |
| 109 | public async clearCachedFiles(re?: string|RegExp): Promise<void> { |
| 110 | let cache: CachedIndexFiles | undefined; |
| 111 | if(re){ |
| 112 | const oldCache = this.state.get<CachedIndexFiles>('r.helpPanel.cachedIndexFiles', []); |
| 113 | cache = oldCache.filter(v => !( |
| 114 | (typeof re === 'string' && v.path === re) |
| 115 | || (typeof re !== 'string' && re.exec(v.path)) |
| 116 | )); |
| 117 | } else{ |
| 118 | cache = undefined; |
| 119 | } |
| 120 | await this.state.update('r.helpPanel.cachedIndexFiles', cache); |
| 121 | } |
| 122 | |
| 123 | // Function to add/remove packages from favorites |
| 124 | public addFavorite(pkgName: string): string[] { |