handle RangeError during didChangeActiveTextEditor
This can happen when path.relative returns something like `../foo`.
This commit is contained in:
parent
bd66c85130
commit
1db3a87fde
1 changed files with 10 additions and 2 deletions
12
core/core.ts
12
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue