瀏覽代碼

Removes unused versionPath

main
Eric Amodio 2 年之前
父節點
當前提交
3a93cc4339
共有 2 個文件被更改,包括 12 次插入12 次删除
  1. +9
    -9
      src/git/gitUri.ts
  2. +3
    -3
      src/trackers/documentTracker.ts

+ 9
- 9
src/git/gitUri.ts 查看文件

@ -13,7 +13,6 @@ export interface GitCommitish {
fileName?: string;
repoPath: string;
sha?: string;
versionedPath?: string;
}
interface UriComponents {
@ -43,7 +42,6 @@ export class GitUri extends (Uri as any as UriEx) {
readonly repoPath?: string;
readonly sha?: string;
readonly versionedPath?: string;
constructor(uri?: Uri);
constructor(uri: Uri, commit: GitCommitish);
@ -140,7 +138,6 @@ export class GitUri extends (Uri as any as UriEx) {
fragment: uri.fragment,
});
this.repoPath = commitOrRepoPath.repoPath;
this.versionedPath = commitOrRepoPath.versionedPath;
if (GitRevision.isUncommittedStaged(commitOrRepoPath.sha) || !GitRevision.isUncommitted(commitOrRepoPath.sha)) {
this.sha = commitOrRepoPath.sha;
}
@ -181,12 +178,15 @@ export class GitUri extends (Uri as any as UriEx) {
return GitRevision.shorten(this.sha);
}
@memoize<GitUri['documentUri']>(useVersionedPath => `${useVersionedPath ? 'versioned' : ''}`)
documentUri(useVersionedPath: boolean = false) {
if (useVersionedPath && this.versionedPath != null) return GitUri.file(this.versionedPath);
if (this.scheme !== 'file') return this;
return GitUri.file(this.fsPath);
@memoize()
documentUri() {
return Uri.from({
scheme: this.scheme,
authority: this.authority,
path: this.path,
query: this.query,
fragment: this.fragment,
});
}
equals(uri: Uri | undefined) {

+ 3
- 3
src/trackers/documentTracker.ts 查看文件

@ -286,7 +286,7 @@ export class DocumentTracker implements Disposable {
let document;
if (GitUri.is(documentOrId)) {
try {
document = await workspace.openTextDocument(documentOrId.documentUri(true));
document = await workspace.openTextDocument(documentOrId.documentUri());
} catch (ex) {
const msg: string = ex?.toString() ?? '';
if (msg.includes('File seems to be binary and cannot be opened as text')) {
@ -319,7 +319,7 @@ export class DocumentTracker implements Disposable {
private _get(documentOrId: string | TextDocument | Uri) {
if (GitUri.is(documentOrId)) {
documentOrId = GitUri.toKey(documentOrId.documentUri(true));
documentOrId = GitUri.toKey(documentOrId.documentUri());
} else if (typeof documentOrId === 'string' || documentOrId instanceof Uri) {
documentOrId = GitUri.toKey(documentOrId);
}
@ -426,7 +426,7 @@ class EmptyTextDocument implements TextDocument {
readonly version: number;
constructor(public readonly gitUri: GitUri) {
this.uri = gitUri.documentUri(true);
this.uri = gitUri.documentUri();
this.eol = EndOfLine.LF;
this.fileName = this.uri.fsPath;

Loading…
取消
儲存