From 1db3a87fde12896105db98927d55c3af45dfe17a Mon Sep 17 00:00:00 2001 From: Big Boss Date: Sun, 24 Nov 2024 15:54:58 -0600 Subject: [PATCH] handle RangeError during didChangeActiveTextEditor This can happen when path.relative returns something like `../foo`. --- core/core.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/core.ts b/core/core.ts index 2108d3706..1eaef976d 100644 --- a/core/core.ts +++ b/core/core.ts @@ -775,8 +775,16 @@ export class Core { const ignoreInstance = ignore().add(defaultIgnoreFile); let rootDirectory = await this.ide.getWorkspaceDirs(); const relativeFilePath = path.relative(rootDirectory[0], filepath); - if (!ignoreInstance.ignores(relativeFilePath)) { - recentlyEditedFilesCache.set(filepath, filepath); + try { + if (!ignoreInstance.ignores(relativeFilePath)) { + recentlyEditedFilesCache.set(filepath, filepath); + } + } catch (e) { + if (e instanceof RangeError) { + // do nothing, this can happen when editing a file outside the workspace such as `../extensions/.continue-debug/config.json` + } else { + console.debug("unhandled ignores error", relativeFilePath, e); + } } });