Skip to content

Commit

Permalink
Renames Results view files to Compare view
Browse files Browse the repository at this point in the history
Updates README (wip)
Updates welcome & settings pages (wip)
  • Loading branch information
eamodio committed Nov 10, 2018
1 parent 55bc8c2 commit 63a17de
Show file tree
Hide file tree
Showing 24 changed files with 453 additions and 304 deletions.
137 changes: 81 additions & 56 deletions README.md

Large diffs are not rendered by default.

242 changes: 123 additions & 119 deletions package.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/commands/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export enum Commands {
ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings',
ShowCommitInView = 'gitlens.showCommitInView',
ShowCommitSearch = 'gitlens.showCommitSearch',
ShowCompareView = 'gitlens.showCompareView',
ShowFileHistoryView = 'gitlens.showFileHistoryView',
ShowFileHistoryInView = 'gitlens.showFileHistoryInView',
ShowLineHistoryView = 'gitlens.showLineHistoryView',
Expand All @@ -71,7 +72,6 @@ export enum Commands {
ShowQuickRevisionDetails = 'gitlens.showQuickRevisionDetails',
ShowQuickStashList = 'gitlens.showQuickStashList',
ShowRepositoriesView = 'gitlens.showRepositoriesView',
ShowResultsView = 'gitlens.showResultsView',
ShowSearchView = 'gitlens.showSearchView',
ShowSettingsPage = 'gitlens.showSettingsPage',
ShowWelcomePage = 'gitlens.showWelcomePage',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/diffBranchWithBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
if (args.ref1 === undefined) return undefined;
}

await Container.resultsView.compare(repoPath, args.ref1, args.ref2);
await Container.compareView.compare(repoPath, args.ref1, args.ref2);

return undefined;
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/diffDirectory.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';
import { CancellationTokenSource, commands, TextEditor, Uri, window } from 'vscode';
import { commands, TextEditor, Uri, window } from 'vscode';
import { BuiltInCommands, GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../quickpicks';
import { ResultsComparisonNode } from '../views/nodes';
import { CompareResultsNode } from '../views/nodes';
import {
ActiveEditorCommand,
command,
Expand All @@ -30,7 +30,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
protected async preExecute(context: CommandContext, args: DiffDirectoryCommandArgs = {}): Promise<any> {
switch (context.command) {
case Commands.ViewsOpenDirectoryDiff:
if (context.type === 'viewItem' && context.node instanceof ResultsComparisonNode) {
if (context.type === 'viewItem' && context.node instanceof CompareResultsNode) {
args.ref1 = context.node.ref1.ref;
args.ref2 = context.node.ref2.ref;
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/showCommitSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
[uri, { ...args, maxCount: 0, goBackCommand: goBackCommand }]
)
: undefined,
showInResultsCommand:
showInViewCommand:
log !== undefined
? new ShowCommitSearchResultsInViewQuickPickItem(log, { label: searchLabel! })
: undefined
Expand Down
12 changes: 6 additions & 6 deletions src/commands/showView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { command, Command, CommandContext, Commands } from './common';
export class ShowViewCommand extends Command {
constructor() {
super([
Commands.ShowRepositoriesView,
Commands.ShowCompareView,
Commands.ShowFileHistoryView,
Commands.ShowLineHistoryView,
Commands.ShowResultsView,
Commands.ShowRepositoriesView,
Commands.ShowSearchView
]);
}
Expand All @@ -20,14 +20,14 @@ export class ShowViewCommand extends Command {

execute(command: Commands) {
switch (command) {
case Commands.ShowRepositoriesView:
return Container.repositoriesView.show();
case Commands.ShowCompareView:
return Container.compareView.show();
case Commands.ShowFileHistoryView:
return Container.fileHistoryView.show();
case Commands.ShowLineHistoryView:
return Container.lineHistoryView.show();
case Commands.ShowResultsView:
return Container.resultsView.show();
case Commands.ShowRepositoriesView:
return Container.repositoriesView.show();
case Commands.ShowSearchView:
return Container.searchView.show();
}
Expand Down
3 changes: 2 additions & 1 deletion src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ export class Configuration {
`gitlens.${this.name('currentLine').value}`,
`gitlens.${this.name('hovers').value}`,
`gitlens.${this.name('statusBar').value}`,
`gitlens.${this.name('views')('compare').value}`,
`gitlens.${this.name('views')('fileHistory').value}`,
`gitlens.${this.name('views')('lineHistory').value}`,
`gitlens.${this.name('views')('repositories').value}`,
`gitlens.${this.name('views')('results').value}`
`gitlens.${this.name('views')('search').value}`
];
}

Expand Down
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export enum CommandContext {
Key = 'gitlens:key',
ViewsCanCompare = 'gitlens:views:canCompare',
ViewsCanCompareFile = 'gitlens:views:canCompare:file',
ViewsCompareKeepResults = 'gitlens:views:compare:keepResults',
ViewsFileHistoryEditorFollowing = 'gitlens:views:fileHistory:editorFollowing',
ViewsLineHistoryEditorFollowing = 'gitlens:views:lineHistory:editorFollowing',
ViewsRepositoriesAutoRefresh = 'gitlens:views:repositories:autoRefresh',
ViewsResultsKeepResults = 'gitlens:views:results:keepResults',
ViewsSearchKeepResults = 'gitlens:views:search:keepResults'
}

Expand Down Expand Up @@ -126,7 +126,7 @@ export const ImageMimetypes: { [key: string]: string } = {
};

export enum WorkspaceState {
ViewsCompareKeepResults = 'gitlens:views:compare:keepResults',
ViewsRepositoriesAutoRefresh = 'gitlens:views:repositories:autoRefresh',
ViewsResultsKeepResults = 'gitlens:views:results:keepResults',
ViewsSearchKeepResults = 'gitlens:views:search:keepResults'
}
55 changes: 31 additions & 24 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { Keyboard } from './keyboard';
import { StatusBarController } from './statusbar/statusBarController';
import { GitDocumentTracker } from './trackers/gitDocumentTracker';
import { GitLineTracker } from './trackers/gitLineTracker';
import { CompareView } from './views/compareView';
import { FileHistoryView } from './views/fileHistoryView';
import { LineHistoryView } from './views/lineHistoryView';
import { RepositoriesView } from './views/repositoriesView';
import { ResultsView } from './views/resultsView';
import { SearchView } from './views/searchView';
import { ViewCommands } from './views/viewCommands';
import { SettingsEditor } from './webviews/settingsEditor';
Expand All @@ -41,15 +41,15 @@ export class Container {
context.subscriptions.push((this._settingsEditor = new SettingsEditor()));
context.subscriptions.push((this._welcomeEditor = new WelcomeEditor()));

if (config.views.repositories.enabled) {
context.subscriptions.push((this._repositoriesView = new RepositoriesView()));
if (config.views.compare.enabled) {
context.subscriptions.push((this._compareView = new CompareView()));
}
else {
let disposable: Disposable;
disposable = configuration.onDidChange(e => {
if (configuration.changed(e, configuration.name('views')('repositories')('enabled').value)) {
if (configuration.changed(e, configuration.name('views')('compare')('enabled').value)) {
disposable.dispose();
context.subscriptions.push((this._repositoriesView = new RepositoriesView()));
context.subscriptions.push((this._compareView = new CompareView()));
}
});
}
Expand Down Expand Up @@ -80,15 +80,15 @@ export class Container {
});
}

if (config.views.results.enabled) {
context.subscriptions.push((this._resultsView = new ResultsView()));
if (config.views.repositories.enabled) {
context.subscriptions.push((this._repositoriesView = new RepositoriesView()));
}
else {
let disposable: Disposable;
disposable = configuration.onDidChange(e => {
if (configuration.changed(e, configuration.name('views')('results')('enabled').value)) {
if (configuration.changed(e, configuration.name('views')('repositories')('enabled').value)) {
disposable.dispose();
context.subscriptions.push((this._resultsView = new ResultsView()));
context.subscriptions.push((this._repositoriesView = new RepositoriesView()));
}
});
}
Expand All @@ -114,6 +114,15 @@ export class Container {
return this._codeLensController;
}

private static _compareView: CompareView | undefined;
static get compareView() {
if (this._compareView === undefined) {
this._context.subscriptions.push((this._compareView = new CompareView()));
}

return this._compareView;
}

private static _config: Config | undefined;
static get config() {
if (this._config === undefined) {
Expand Down Expand Up @@ -146,11 +155,6 @@ export class Container {
return this._git;
}

private static _repositoriesView: RepositoriesView | undefined;
static get repositoriesView(): RepositoriesView {
return this._repositoriesView!;
}

private static _keyboard: Keyboard;
static get keyboard() {
return this._keyboard;
Expand Down Expand Up @@ -180,13 +184,9 @@ export class Container {
return this._lineTracker;
}

private static _resultsView: ResultsView | undefined;
static get resultsView() {
if (this._resultsView === undefined) {
this._context.subscriptions.push((this._resultsView = new ResultsView()));
}

return this._resultsView;
private static _repositoriesView: RepositoriesView | undefined;
static get repositoriesView(): RepositoriesView {
return this._repositoriesView!;
}

private static _searchView: SearchView | undefined;
Expand Down Expand Up @@ -239,15 +239,22 @@ export class Container {
if (mode.codeLens != null) {
config.codeLens.enabled = mode.codeLens;
}

if (mode.currentLine != null) {
config.currentLine.enabled = mode.currentLine;
}

if (mode.hovers != null) {
config.hovers.enabled = mode.hovers;
}

if (mode.statusBar != null) {
config.statusBar.enabled = mode.statusBar;
}

if (mode.views != null) {
config.views.compare.enabled = mode.views;
}
if (mode.views != null) {
config.views.fileHistory.enabled = mode.views;
}
Expand All @@ -257,9 +264,9 @@ export class Container {
if (mode.views != null) {
config.views.repositories.enabled = mode.views;
}
// if (mode.views != null) {
// config.views.results.enabled = mode.views;
// }
if (mode.views != null) {
config.views.search.enabled = mode.views;
}

return config;
}
Expand Down
34 changes: 34 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,40 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
configuration.name('views')('lineHistory')('location').value
);

await configuration.migrate(
'resultsExplorer.files.compact',
configuration.name('views')('compare')('files')('compact').value
);
await configuration.migrate(
'resultsExplorer.files.layout',
configuration.name('views')('compare')('files')('layout').value
);
await configuration.migrate(
'resultsExplorer.files.threshold',
configuration.name('views')('compare')('files')('threshold').value
);
await configuration.migrate(
'resultsExplorer.location',
configuration.name('views')('compare')('location').value
);

await configuration.migrate(
'resultsExplorer.files.compact',
configuration.name('views')('search')('files')('compact').value
);
await configuration.migrate(
'resultsExplorer.files.layout',
configuration.name('views')('search')('files')('layout').value
);
await configuration.migrate(
'resultsExplorer.files.threshold',
configuration.name('views')('search')('files')('threshold').value
);
await configuration.migrate(
'resultsExplorer.location',
configuration.name('views')('search')('location').value
);

await configuration.migrate('explorers.avatars', configuration.name('views')('avatars').value);
await configuration.migrate(
'explorers.commitFileFormat',
Expand Down
6 changes: 3 additions & 3 deletions src/quickpicks/commitsQuickPick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export class CommitsQuickPick {
options: {
goBackCommand?: CommandQuickPickItem;
showAllCommand?: CommandQuickPickItem;
showInResultsCommand?: CommandQuickPickItem;
showInViewCommand?: CommandQuickPickItem;
}
): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
const items = ((log && [...Iterables.map(log.commits.values(), c => new CommitQuickPickItem(c))]) || [
new MessageQuickPickItem('No results found')
]) as (CommitQuickPickItem | CommandQuickPickItem)[];

if (options.showInResultsCommand !== undefined) {
items.splice(0, 0, options.showInResultsCommand);
if (options.showInViewCommand !== undefined) {
items.splice(0, 0, options.showInViewCommand);
}

if (options.showAllCommand !== undefined) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ export interface ViewsConfig {
};
commitFileFormat: string;
commitFormat: string;
compare: CompareViewConfig;
// dateFormat: string | null;
defaultItemLimit: number;
lineHistory: LineHistoryViewConfig;
repositories: RepositoriesViewConfig;
results: ResultsViewConfig;
search: SearchViewConfig;
stashFileFormat: string;
stashFormat: string;
Expand Down Expand Up @@ -233,7 +233,7 @@ export interface RepositoriesViewConfig {
showTrackingBranch: boolean;
}

export interface ResultsViewConfig {
export interface CompareViewConfig {
enabled: boolean;
files: ViewsFilesConfig;
location: 'explorer' | 'gitlens' | 'scm';
Expand Down

0 comments on commit 63a17de

Please sign in to comment.