Skip to content

Commit 5e576b3

Browse files
committed
Splits apart monolithic vscode utils
- `documents.ts` - document handling - `editors.ts` - editor operations - `tabs.ts` - tab management - `uris.ts` - URI utilities - `workspaces.ts` - workspace functionality
1 parent f309982 commit 5e576b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+463
-435
lines changed

src/annotations/annotationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Disposable, window } from 'vscode';
33
import type { FileAnnotationType } from '../config';
44
import type { AnnotationStatus } from '../constants';
55
import type { Container } from '../container';
6-
import { getTabUri } from '../system/-webview/vscode';
6+
import { getTabUri } from '../system/-webview/vscode/tabs';
77
import { Logger } from '../system/logger';
88
import type { Deferred } from '../system/promise';
99
import { defer } from '../system/promise';

src/annotations/fileAnnotationController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { configuration } from '../system/-webview/configuration';
3030
import { setContext } from '../system/-webview/context';
3131
import type { KeyboardScope } from '../system/-webview/keyboard';
3232
import { UriSet } from '../system/-webview/uriMap';
33-
import { isTrackableTextEditor } from '../system/-webview/vscode';
33+
import { isTrackableTextEditor } from '../system/-webview/vscode/editors';
3434
import { debug, log } from '../system/decorators/log';
3535
import { once } from '../system/event';
3636
import type { Deferrable } from '../system/function/debounce';

src/annotations/lineAnnotationController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { CommitFormatter } from '../git/formatters/commitFormatter';
66
import type { PullRequest } from '../git/models/pullRequest';
77
import { detailsMessage } from '../hovers/hovers';
88
import { configuration } from '../system/-webview/configuration';
9-
import { isTrackableTextEditor } from '../system/-webview/vscode';
9+
import { isTrackableTextEditor } from '../system/-webview/vscode/editors';
1010
import { debug, log } from '../system/decorators/log';
1111
import { once } from '../system/event';
1212
import { debounce } from '../system/function/debounce';

src/codelens/codeLensProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import type { GitCommit } from '../git/models/commit';
2727
import { RemoteResourceType } from '../git/models/remoteResource';
2828
import { createCommand, executeCoreCommand } from '../system/-webview/command';
2929
import { configuration } from '../system/-webview/configuration';
30-
import { isVirtualUri } from '../system/-webview/vscode';
30+
import { isVirtualUri } from '../system/-webview/vscode/uris';
3131
import { is, once } from '../system/function';
3232
import { filterMap, find, first, join, map } from '../system/iterable';
3333
import { getLoggableName, Logger } from '../system/logger';

src/commands/browseRepoAtRevision.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Container } from '../container';
33
import { GitUri } from '../git/gitUri';
44
import { showGenericErrorMessage } from '../messages';
55
import { command, executeCoreCommand } from '../system/-webview/command';
6-
import { openWorkspace } from '../system/-webview/vscode';
6+
import { openWorkspace } from '../system/-webview/vscode/workspaces';
77
import { Logger } from '../system/logger';
88
import { basename } from '../system/path';
99
import { ActiveEditorCommand } from './commandBase';

src/commands/diffWith.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { deletedOrMissing } from '../git/models/revision';
88
import { isShaLike, isUncommitted, shortenRevision } from '../git/utils/revision.utils';
99
import { showGenericErrorMessage } from '../messages';
1010
import { command } from '../system/-webview/command';
11-
import { openDiffEditor } from '../system/-webview/vscode';
11+
import { openDiffEditor } from '../system/-webview/vscode/editors';
1212
import { createMarkdownCommandLink } from '../system/commands';
1313
import { Logger } from '../system/logger';
1414
import { basename } from '../system/path';

src/commands/diffWithPrevious.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import type { GitCommit } from '../git/models/commit';
55
import { deletedOrMissing } from '../git/models/revision';
66
import { showCommitHasNoPreviousCommitWarningMessage, showGenericErrorMessage } from '../messages';
77
import { command, executeCommand } from '../system/-webview/command';
8-
import { findOrOpenEditor } from '../system/-webview/vscode';
8+
import { getOrOpenTextEditor } from '../system/-webview/vscode/editors';
9+
import { getVisibleTabs } from '../system/-webview/vscode/tabs';
910
import { Logger } from '../system/logger';
1011
import { ActiveEditorCommand } from './commandBase';
1112
import { getCommandUri } from './commandBase.utils';
@@ -100,7 +101,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
100101

101102
// If we have no previous and the current is the working file, just open the working file
102103
if (diffUris.current.sha == null) {
103-
void (await findOrOpenEditor(diffUris.current, args.showOptions));
104+
void (await getOrOpenTextEditor(diffUris.current, args.showOptions));
104105

105106
return;
106107
}

src/commands/diffWithWorking.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createReference } from '../git/utils/reference.utils';
77
import { showGenericErrorMessage } from '../messages';
88
import { showRevisionFilesPicker } from '../quickpicks/revisionFilesPicker';
99
import { command, executeCommand } from '../system/-webview/command';
10-
import { findOrOpenEditor } from '../system/-webview/vscode';
10+
import { getOrOpenTextEditor } from '../system/-webview/vscode/editors';
1111
import { Logger } from '../system/logger';
1212
import { ActiveEditorCommand } from './commandBase';
1313
import { getCommandUri } from './commandBase.utils';
@@ -106,7 +106,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
106106
keyboard: {
107107
keys: ['right', 'alt+right', 'ctrl+right'],
108108
onDidPressKey: async (_key, uri) => {
109-
await findOrOpenEditor(uri, { ...args.showOptions, preserveFocus: true, preview: true });
109+
await getOrOpenTextEditor(uri, { ...args.showOptions, preserveFocus: true, preview: true });
110110
},
111111
},
112112
});

src/commands/git/worktree.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import type { FlagsQuickPickItem } from '../../quickpicks/items/flags';
3535
import { createFlagsQuickPickItem } from '../../quickpicks/items/flags';
3636
import { configuration } from '../../system/-webview/configuration';
3737
import { isDescendant } from '../../system/-webview/path';
38-
import { getWorkspaceFriendlyPath, openWorkspace, revealInFileExplorer } from '../../system/-webview/vscode';
38+
import { revealInFileExplorer } from '../../system/-webview/vscode';
39+
import { getWorkspaceFriendlyPath, openWorkspace } from '../../system/-webview/vscode/workspaces';
3940
import { basename } from '../../system/path';
4041
import type { Deferred } from '../../system/promise';
4142
import { pluralize, truncateLeft } from '../../system/string';

src/commands/openChangedFiles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Container } from '../container';
44
import { showGenericErrorMessage } from '../messages';
55
import { getRepositoryOrShowPicker } from '../quickpicks/repositoryPicker';
66
import { command } from '../system/-webview/command';
7-
import { findOrOpenEditors } from '../system/-webview/vscode';
7+
import { openTextEditors } from '../system/-webview/vscode/editors';
88
import { filterMap } from '../system/array';
99
import { Logger } from '../system/logger';
1010
import { GlCommandBase } from './commandBase';
@@ -37,7 +37,7 @@ export class OpenChangedFilesCommand extends GlCommandBase {
3737
args.uris = filterMap(status.files, f => (f.status !== 'D' ? f.uri : undefined));
3838
}
3939

40-
findOrOpenEditors(args.uris);
40+
openTextEditors(args.uris);
4141
} catch (ex) {
4242
Logger.error(ex, 'OpenChangedFilesCommand');
4343
void showGenericErrorMessage('Unable to open all changed files');

0 commit comments

Comments
 (0)