mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-05 15:36:22 +01:00
smaller footprint
This commit is contained in:
1 parent
5d60b7fdc4
commit
15bfc40222
5 files changed
+18
-30
No files matched your search
@@ -14,7 +14,7 @@ import { CommitOptions, ForcePushMode, Git, Stash } from './git';
|
||||
import { Model } from './model';
|
||||
import { Repository, Resource, ResourceGroupType } from './repository';
|
||||
import { applyLineChanges, getModifiedRange, intersectDiffWithRange, invertLineChange, toLineRanges } from './staging';
|
||||
import { fromGitUri, toGitFSUri } from './uri';
|
||||
import { fromGitUri, toGitUri } from './uri';
|
||||
import { grep, isDescendant, pathEquals } from './util';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
@@ -291,7 +291,7 @@ export class CommandCenter {
|
||||
const repository = this.model.getRepositoryForSubmodule(resource.resourceUri);
|
||||
|
||||
if (repository) {
|
||||
right = toGitFSUri(resource.resourceUri, resource.resourceGroupType === ResourceGroupType.Index ? 'index' : 'wt', { submoduleOf: repository.root });
|
||||
right = toGitUri(resource.resourceUri, resource.resourceGroupType === ResourceGroupType.Index ? 'index' : 'wt', { submoduleOf: repository.root });
|
||||
}
|
||||
} else {
|
||||
if (resource.type !== Status.DELETED_BY_THEM) {
|
||||
@@ -334,7 +334,7 @@ export class CommandCenter {
|
||||
const repository = this.model.getRepository(uri);
|
||||
|
||||
if (!repository) {
|
||||
return toGitFSUri(uri, ref);
|
||||
return toGitUri(uri, ref);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -350,7 +350,7 @@ export class CommandCenter {
|
||||
const { mimetype } = await repository.detectObjectType(object);
|
||||
|
||||
if (mimetype === 'text/plain') {
|
||||
return toGitFSUri(uri, ref);
|
||||
return toGitUri(uri, ref);
|
||||
}
|
||||
|
||||
if (size > 1000000) { // 1 MB
|
||||
@@ -365,7 +365,7 @@ export class CommandCenter {
|
||||
return Uri.parse(`data:;label:${path.basename(uri.fsPath)};description:${gitRef},`);
|
||||
|
||||
} catch (err) {
|
||||
return toGitFSUri(uri, ref);
|
||||
return toGitUri(uri, ref);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1012,7 +1012,7 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalUri = toGitFSUri(modifiedUri, '~');
|
||||
const originalUri = toGitUri(modifiedUri, '~');
|
||||
const originalDocument = await workspace.openTextDocument(originalUri);
|
||||
const result = applyLineChanges(originalDocument, modifiedDocument, changes);
|
||||
|
||||
@@ -1060,7 +1060,7 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalUri = toGitFSUri(modifiedUri, '~');
|
||||
const originalUri = toGitUri(modifiedUri, '~');
|
||||
const originalDocument = await workspace.openTextDocument(originalUri);
|
||||
const selectionsBeforeRevert = textEditor.selections;
|
||||
const visibleRangesBeforeRevert = textEditor.visibleRanges;
|
||||
@@ -1127,7 +1127,7 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalUri = toGitFSUri(modifiedUri, 'HEAD');
|
||||
const originalUri = toGitUri(modifiedUri, 'HEAD');
|
||||
const originalDocument = await workspace.openTextDocument(originalUri);
|
||||
const selectedLines = toLineRanges(textEditor.selections, modifiedDocument);
|
||||
const selectedDiffs = diffs
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { workspace, Uri, Disposable, Event, EventEmitter, window } from 'vscode';
|
||||
import { debounce, throttle } from './decorators';
|
||||
import { fromGitUri, toGitFSUri } from './uri';
|
||||
import { fromGitUri, toGitUri } from './uri';
|
||||
import { Model, ModelChangeEvent, OriginalResourceChangeEvent } from './model';
|
||||
import { filterEvent, eventToPromise, isDescendant, pathEquals } from './util';
|
||||
|
||||
@@ -50,7 +50,7 @@ export class GitContentProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
this._onDidChange.fire(toGitFSUri(uri, '', { replaceFileExtension: true }));
|
||||
this._onDidChange.fire(toGitUri(uri, '', { replaceFileExtension: true }));
|
||||
}
|
||||
|
||||
@debounce(1100)
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
import { workspace, Uri, Disposable, Event, EventEmitter, window, FileSystemProvider, FileChangeEvent, FileStat, FileType, FileChangeType, FileSystemError } from 'vscode';
|
||||
import { debounce, throttle } from './decorators';
|
||||
import { fromGitUri, toGitFSUri } from './uri';
|
||||
import { fromGitUri, toGitUri } from './uri';
|
||||
import { Model, ModelChangeEvent, OriginalResourceChangeEvent } from './model';
|
||||
import { filterEvent, eventToPromise, isDescendant, pathEquals } from './util';
|
||||
import { filterEvent, eventToPromise, isDescendant, pathEquals, EmptyDisposable } from './util';
|
||||
|
||||
interface CacheRow {
|
||||
uri: Uri;
|
||||
@@ -46,7 +46,7 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
const gitUri = toGitFSUri(uri, '', { replaceFileExtension: true });
|
||||
const gitUri = toGitUri(uri, '', { replaceFileExtension: true });
|
||||
this._onDidChangeFile.fire([{ type: FileChangeType.Changed, uri: gitUri }]);
|
||||
}
|
||||
|
||||
@@ -102,10 +102,8 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
//#region File System Provider
|
||||
|
||||
watch(): Disposable {
|
||||
throw new Error('Method not implemented.');
|
||||
return EmptyDisposable;
|
||||
}
|
||||
|
||||
stat(uri: Uri): FileStat {
|
||||
@@ -185,8 +183,6 @@ export class GitFileSystemProvider implements FileSystemProvider {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
//#endregion File System Provider
|
||||
|
||||
dispose(): void {
|
||||
this.disposables.forEach(d => d.dispose());
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import { AutoFetcher } from './autofetch';
|
||||
import { debounce, memoize, throttle } from './decorators';
|
||||
import { Commit, CommitOptions, ForcePushMode, GitError, Repository as BaseRepository, Stash, Submodule } from './git';
|
||||
import { StatusBarCommands } from './statusbar';
|
||||
import { toGitFSUri } from './uri';
|
||||
import { toGitUri } from './uri';
|
||||
import { anyEvent, combinedDisposable, debounceEvent, dispose, EmptyDisposable, eventToPromise, filterEvent, find, IDisposable, isDescendant, onceEvent } from './util';
|
||||
import { IFileWatcher, watch } from './watch';
|
||||
|
||||
@@ -834,7 +834,7 @@ export class Repository implements Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
return toGitFSUri(uri, '', { replaceFileExtension: true });
|
||||
return toGitUri(uri, '', { replaceFileExtension: true });
|
||||
}
|
||||
|
||||
async getInputTemplate(): Promise<string> {
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface GitUriOptions {
|
||||
// As a mitigation for extensions like ESLint showing warnings and errors
|
||||
// for git URIs, let's change the file extension of these uris to .git,
|
||||
// when `replaceFileExtension` is true.
|
||||
function _toGitUri(scheme: string, uri: Uri, ref: string, options: GitUriOptions = {}): Uri {
|
||||
export function toGitUri(uri: Uri, ref: string, options: GitUriOptions = {}): Uri {
|
||||
const params: GitUriParams = {
|
||||
path: uri.fsPath,
|
||||
ref
|
||||
@@ -42,16 +42,8 @@ function _toGitUri(scheme: string, uri: Uri, ref: string, options: GitUriOptions
|
||||
}
|
||||
|
||||
return uri.with({
|
||||
scheme,
|
||||
scheme: 'gitfs',
|
||||
path,
|
||||
query: JSON.stringify(params)
|
||||
});
|
||||
}
|
||||
|
||||
export function toGitUri(uri: Uri, ref: string, options: GitUriOptions = {}): Uri {
|
||||
return _toGitUri('git', uri, ref, options);
|
||||
}
|
||||
|
||||
export function toGitFSUri(uri: Uri, ref: string, options: GitUriOptions = {}): Uri {
|
||||
return _toGitUri('gitfs', uri, ref, options);
|
||||
}
|
||||
Reference in new issue
Block a user