| 1 | import QuickLRU from "quick-lru"; |
| 2 | |
| 3 | // The cache key and value are both a filepath string |
| 4 | export type cacheElementType = string; |
| 5 | |
| 6 | // maximum number of open files that can be cached |
| 7 | const MAX_NUM_OPEN_CONTEXT_FILES = 20; |
| 8 | |
| 9 | // stores which files are currently open in the IDE, in viewing order |
| 10 | export const openedFilesLruCache = new QuickLRU< |
| 11 | cacheElementType, |
| 12 | cacheElementType |
| 13 | >({ |
| 14 | maxSize: MAX_NUM_OPEN_CONTEXT_FILES, |
| 15 | }); |
| 16 | |
| 17 | // used in core/core.ts to handle removals from the cache |
| 18 | export const prevFilepaths = { |
| 19 | filepaths: [] as string[], |
| 20 | }; |