mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-10 02:02:37 -05:00
Adds support for git commands on scheme=git
Rewrites blame annotation controller and provider - fixes whitespace issues, reduces overhead, and provides better performance Rewrites status bar blame support - reduces overhead and provides better performance Adds showFileHistory command to status bar Renames showHistory to showFileHistory Fixes log to use iso 8601 for dates
This commit is contained in:
42
src/comparers.ts
Normal file
42
src/comparers.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
import { TextDocument, TextEditor, Uri } from 'vscode';
|
||||
|
||||
abstract class Comparer<T> {
|
||||
abstract equals(lhs: T, rhs: T): boolean;
|
||||
}
|
||||
|
||||
class UriComparer extends Comparer<Uri> {
|
||||
equals(lhs: Uri, rhs: Uri) {
|
||||
if (!lhs && !rhs) return true;
|
||||
if ((lhs && !rhs) || (!lhs && rhs)) return false;
|
||||
|
||||
return lhs.scheme === rhs.scheme && lhs.fsPath === rhs.fsPath;
|
||||
}
|
||||
}
|
||||
|
||||
class TextDocumentComparer extends Comparer<TextDocument> {
|
||||
equals(lhs: TextDocument, rhs: TextDocument) {
|
||||
if (!lhs && !rhs) return true;
|
||||
if ((lhs && !rhs) || (!lhs && rhs)) return false;
|
||||
|
||||
return uriComparer.equals(lhs.uri, rhs.uri);
|
||||
}
|
||||
}
|
||||
|
||||
class TextEditorComparer extends Comparer<TextEditor> {
|
||||
equals(lhs: TextEditor, rhs: TextEditor) {
|
||||
if (!lhs && !rhs) return true;
|
||||
if ((lhs && !rhs) || (!lhs && rhs)) return false;
|
||||
|
||||
return textDocumentComparer.equals(lhs.document, rhs.document);
|
||||
}
|
||||
}
|
||||
|
||||
const textDocumentComparer = new TextDocumentComparer();
|
||||
const textEditorComparer = new TextEditorComparer();
|
||||
const uriComparer = new UriComparer();
|
||||
export {
|
||||
textDocumentComparer as TextDocumentComparer,
|
||||
textEditorComparer as TextEditorComparer,
|
||||
uriComparer as UriComparer
|
||||
};
|
||||
Reference in New Issue
Block a user