Skip to content

Commit

Permalink
Silence RangeError
Browse files Browse the repository at this point in the history
  • Loading branch information
KAHLYM committed Oct 8, 2024
1 parent 98f1fb7 commit 3127b1a
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/tree-view/tree-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FileSystemTrie, FileSystemTrieNode } from '../data-structures/trie';
import { diff, Status, } from '../git/extract';
import { UriEx } from '../internal/uri';
import { Command, Event, EventEmitter, FileType, TreeDataProvider, TreeItemCollapsibleState, TreeItem, Uri, workspace } from 'vscode';
import { exists, readDirectory }from '../utilities/file-system';
import { exists, readDirectory } from '../utilities/file-system';
import { toUnix, trimLeadingPathSeperators } from '../utilities/path';
import { removePrefixes } from '../utilities/string';

Expand Down Expand Up @@ -32,7 +32,17 @@ export class FileSystemProvider implements TreeDataProvider<FileTreeItem> {
}

public refresh(): void {
this.cache_ = this._isValid() ? diff(this.left_.fsPath, this.right_.fsPath) : new FileSystemTrie();
try {
this.cache_ = this._isValid() ? diff(this.left_.fsPath, this.right_.fsPath) : new FileSystemTrie();

} catch (error) {
if (error instanceof RangeError) {
// Error reported in #80 is very noisy so silence for now.
} else {
throw error;
}
}

this._onDidChangeTreeData.fire();
}

Expand Down Expand Up @@ -60,7 +70,7 @@ export class FileSystemProvider implements TreeDataProvider<FileTreeItem> {

/* istanbul ignore next: difficult to unit test */
public isDirectoryAndHasNoPreRename(path: string, type: FileType): Boolean {
return type === FileType.Directory &&
return type === FileType.Directory &&
this.cache_.exists(path) &&
(this.cache_.getContent(path) ? this.cache_.getContent(path).hasNoPreRename : true);
}
Expand Down Expand Up @@ -242,10 +252,10 @@ export class FileSystemProvider implements TreeDataProvider<FileTreeItem> {
]
};
case Status.intermediate: // unused
return {
command: 'vscode.open',
title: 'Open'
};
return {
command: 'vscode.open',
title: 'Open'
};
case Status.null:
return {
command: 'vscode.open',
Expand Down

0 comments on commit 3127b1a

Please sign in to comment.