Переглянути джерело

Splits views.avatars into separate settings per view

main
Eric Amodio 6 роки тому
джерело
коміт
fa2e6be104
13 змінених файлів з 68 додано та 51 видалено
  1. +3
    -1
      README.md
  2. +18
    -6
      package.json
  3. +12
    -11
      src/extension.ts
  4. +8
    -7
      src/ui/config.ts
  5. +6
    -6
      src/ui/settings/index.html
  6. +3
    -3
      src/views/nodes/branchTrackingStatusNode.ts
  7. +3
    -3
      src/views/nodes/commitNode.ts
  8. +3
    -3
      src/views/nodes/compareResultsNode.ts
  9. +3
    -3
      src/views/nodes/folderNode.ts
  10. +3
    -3
      src/views/nodes/resultsCommitsNode.ts
  11. +3
    -3
      src/views/nodes/resultsFilesNode.ts
  12. +2
    -2
      src/views/nodes/searchResultsCommitsNode.ts
  13. +1
    -0
      src/views/viewBase.ts

+ 3
- 1
README.md Переглянути файл

@ -752,6 +752,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| Name | Description |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.repositories.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Repositories_ view |
| `gitlens.views.repositories.autoRefresh` | Specifies whether to automatically refresh the _Repositories_ view when the repository or the file system changes |
| `gitlens.views.repositories.autoReveal` | Specifies whether to automatically reveal repositories in the _Repositories_ view when opening files |
| `gitlens.views.repositories.branches.layout` | Specifies how the _Repositories_ view will display branches<br /><br />`list` - displays branches as a list<br />`tree` - displays branches as a tree when branch names contain slashes `/` |
@ -790,6 +791,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| Name | Description |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.search.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Search Commits_ view |
| `gitlens.views.search.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Search Commits_ view<br />Only applies when `gitlens.views.compare.files.layout` is set to `tree` or `auto` |
| `gitlens.views.search.enabled` | Specifies whether to show the _Search Commits_ view |
| `gitlens.views.search.files.layout` | Specifies how the _Search Commits_ view will display files<br />`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.compare.files.threshold` value and the number of files at each nesting level<br />`list` - displays files as a list<br />`tree` - displays files as a tree |
@ -802,6 +804,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| Name | Description |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `gitlens.views.compare.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Compare_ view |
| `gitlens.views.compare.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Compare_ view. Only applies when `gitlens.views.compare.files.layout` is set to `tree` or `auto` |
| `gitlens.views.compare.enabled` | Specifies whether to show the _Compare_ view |
| `gitlens.views.compare.files.layout` | Specifies how the _Compare_ view will display files<br /><br />`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.compare.files.threshold` value and the number of files at each nesting level<br />`list` - displays files as a list<br />`tree` - displays files as a tree |
@ -812,7 +815,6 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| Name | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the views |
| `gitlens.views.commitFileFormat` | Specifies the format of a committed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.commitFileDescriptionFormat` | Specifies the description format of a committed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.commitFormat` | Specifies the format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}`&mdash; commit id<br />`${author}` &mdash; commit author<br />`${message}`&mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}`&mdash; formatted commit date (format specified by`gitlens.statusBar.dateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}`&mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |

+ 18
- 6
package.json Переглянути файл

@ -1199,12 +1199,6 @@
"markdownDescription": "Specifies the string to be shown in place of the _authors_ code lens when there are unsaved changes",
"scope": "window"
},
"gitlens.views.avatars": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show avatar images instead of commit (or status) icons in the views",
"scope": "window"
},
"gitlens.views.commitFileFormat": {
"type": "string",
"default": "${file}",
@ -1229,6 +1223,12 @@
"markdownDescription": "Specifies the description format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting\n- Available tokens\n - `${id}` &mdash; commit id\n - `${author}` &mdash; commit author\n - `${message}` &mdash; commit message\n - `${ago}` &mdash; relative commit date (e.g. 1 day ago)\n - `${date}` &mdash; formatted commit date (format specified by `#gitlens.defaultDateFormat#`)\n - `${agoOrDate}` &mdash; commit date specified by `#gitlens.defaultDateStyle#`\n - `${authorAgo}` &mdash; commit author, relative commit date\n - `${authorAgoOrDate}` &mdash; commit author, commit date specified by `#gitlens.defaultDateStyle#`",
"scope": "window"
},
"gitlens.views.compare.avatars": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show avatar images instead of commit (or status) icons in the _Compare_ view",
"scope": "window"
},
"gitlens.views.compare.enabled": {
"type": "boolean",
"default": true,
@ -1353,6 +1353,12 @@
"markdownDescription": "Specifies whether to automatically reveal repositories in the _Repositories_ view when opening files",
"scope": "window"
},
"gitlens.views.repositories.avatars": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show avatar images instead of commit (or status) icons in the _Repositories_ view",
"scope": "window"
},
"gitlens.views.repositories.branches.layout": {
"type": "string",
"default": "tree",
@ -1435,6 +1441,12 @@
"markdownDescription": "Specifies whether to show the tracking branch when displaying local branches in the _Repositories_ view",
"scope": "window"
},
"gitlens.views.search.avatars": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show avatar images instead of commit (or status) icons in the _Search Commits_ view",
"scope": "window"
},
"gitlens.views.search.enabled": {
"type": "boolean",
"default": true,

+ 12
- 11
src/extension.ts Переглянути файл

@ -99,7 +99,12 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
const previous = Versions.fromString(previousVersion);
try {
if (Versions.compare(previous, Versions.from(9, 0, 0)) !== 1) {
if (Versions.compare(previous, Versions.from(9, 2, 2)) !== 1) {
await configuration.migrate('views.avatars', configuration.name('views')('compare')('avatars').value);
await configuration.migrate('views.avatars', configuration.name('views')('repositories')('avatars').value);
await configuration.migrate('views.avatars', configuration.name('views')('search')('avatars').value);
}
else if (Versions.compare(previous, Versions.from(9, 0, 0)) !== 1) {
await configuration.migrate(
'gitExplorer.autoRefresh',
configuration.name('views')('repositories')('autoRefresh').value
@ -197,7 +202,12 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
configuration.name('views')('search')('location').value
);
await configuration.migrate('explorers.avatars', configuration.name('views')('avatars').value);
await configuration.migrate('explorers.avatars', configuration.name('views')('compare')('avatars').value);
await configuration.migrate(
'explorers.avatars',
configuration.name('views')('repositories')('avatars').value
);
await configuration.migrate('explorers.avatars', configuration.name('views')('search')('avatars').value);
await configuration.migrate(
'explorers.commitFileFormat',
configuration.name('views')('commitFileFormat').value
@ -208,15 +218,6 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
configuration.name('views')('defaultItemLimit').value
);
await configuration.migrate(
'explorers.files.compact',
configuration.name('views')('files')('compact').value
);
await configuration.migrate('explorers.files.layout', configuration.name('views')('files')('layout').value);
await configuration.migrate(
'explorers.files.threshold',
configuration.name('views')('files')('threshold').value
);
await configuration.migrate(
'explorers.stashFileFormat',
configuration.name('views')('stashFileFormat').value
);

+ 8
- 7
src/ui/config.ts Переглянути файл

@ -237,6 +237,7 @@ export interface CodeLensLanguageScope {
}
export interface CompareViewConfig {
avatars: boolean;
enabled: boolean;
files: ViewsFilesConfig;
location: 'explorer' | 'gitlens' | 'scm';
@ -248,7 +249,11 @@ export interface FileHistoryViewConfig {
location: 'explorer' | 'gitlens' | 'scm';
}
export interface LineHistoryViewConfig extends FileHistoryViewConfig {}
export interface LineHistoryViewConfig {
avatars: boolean;
enabled: boolean;
location: 'explorer' | 'gitlens' | 'scm';
}
export interface MenuConfig {
editor:
@ -336,6 +341,7 @@ export interface RemotesUrlsConfig {
export interface RepositoriesViewConfig {
autoRefresh: boolean;
autoReveal: boolean;
avatars: boolean;
branches: {
layout: ViewBranchesLayout;
};
@ -348,19 +354,14 @@ export interface RepositoriesViewConfig {
}
export interface SearchViewConfig {
avatars: boolean;
enabled: boolean;
files: ViewsFilesConfig;
location: 'explorer' | 'gitlens' | 'scm';
}
export interface ViewsConfig {
avatars: boolean;
fileHistory: FileHistoryViewConfig;
files: {
layout: ViewFilesLayout;
compact: boolean;
threshold: number;
};
commitFileDescriptionFormat: string;
commitFileFormat: string;
commitDescriptionFormat: string;

+ 6
- 6
src/ui/settings/index.html Переглянути файл

@ -2356,7 +2356,7 @@
<input
class="setting"
id="views.repositories.avatars"
name="views.avatars"
name="views.repositories.avatars"
type="checkbox"
disabled
/>
@ -2420,7 +2420,7 @@
<img
class="image__preview--overlay hidden"
src="{{root}}/images/settings/view-repositories-avatars.png"
data-visibility="views.repositories.enabled &amp; views.avatars"
data-visibility="views.repositories.enabled &amp; views.repositories.avatars"
/>
</div>
<p class="settings-group__hint">
@ -2680,7 +2680,7 @@
<input
class="setting"
id="views.search.avatars"
name="views.avatars"
name="views.search.avatars"
type="checkbox"
disabled
/>
@ -2711,7 +2711,7 @@
<img
class="image__preview--overlay hidden"
src="{{root}}/images/settings/view-search-avatars.png"
data-visibility="views.search.enabled &amp; views.avatars"
data-visibility="views.search.enabled &amp; views.search.avatars"
/>
</div>
<p class="settings-group__hint">
@ -2814,7 +2814,7 @@
<input
class="setting"
id="views.compare.avatars"
name="views.avatars"
name="views.compare.avatars"
type="checkbox"
disabled
/>
@ -2845,7 +2845,7 @@
<img
class="image__preview--overlay hidden"
src="{{root}}/images/settings/view-compare-avatars.png"
data-visibility="views.compare.enabled &amp; views.avatars"
data-visibility="views.compare.enabled &amp; views.compare.avatars"
/>
</div>
<p class="settings-group__hint">

+ 3
- 3
src/views/nodes/branchTrackingStatusNode.ts Переглянути файл

@ -3,7 +3,7 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { GitTrackingState, GitUri } from '../../git/gitService';
import { Iterables, Strings } from '../../system';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { CommitNode } from './commitNode';
import { ShowMoreNode } from './common';
import { insertDateMarkers } from './helpers';
@ -16,12 +16,12 @@ export interface BranchTrackingStatus {
upstream?: string;
}
export class BranchTrackingStatusNode extends ViewNode implements PageableViewNode {
export class BranchTrackingStatusNode extends ViewNode<ViewWithFiles> implements PageableViewNode {
readonly supportsPaging: boolean = true;
maxCount: number | undefined;
constructor(
view: View,
view: ViewWithFiles,
parent: ViewNode,
public readonly status: BranchTrackingStatus,
public readonly direction: 'ahead' | 'behind',

+ 3
- 3
src/views/nodes/commitNode.ts Переглянути файл

@ -7,14 +7,14 @@ import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { CommitFormatter, GitBranch, GitLogCommit, ICommitFormatOptions } from '../../git/gitService';
import { Arrays, Iterables, Strings } from '../../system';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { FileNode, FolderNode } from './folderNode';
import { ResourceType, ViewNode, ViewRefNode } from './viewNode';
export class CommitNode extends ViewRefNode {
export class CommitNode extends ViewRefNode<ViewWithFiles> {
constructor(
view: View,
view: ViewWithFiles,
parent: ViewNode,
public readonly commit: GitLogCommit,
public readonly branch?: GitBranch,

+ 3
- 3
src/views/nodes/compareResultsNode.ts Переглянути файл

@ -3,14 +3,14 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { GitService, GitUri } from '../../git/gitService';
import { Strings } from '../../system';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode';
import { ResultsFilesNode } from './resultsFilesNode';
import { NamedRef, ResourceType, ViewNode } from './viewNode';
export class CompareResultsNode extends ViewNode {
export class CompareResultsNode extends ViewNode<ViewWithFiles> {
constructor(
view: View,
view: ViewWithFiles,
public readonly repoPath: string,
ref1: NamedRef,
ref2: NamedRef

+ 3
- 3
src/views/nodes/folderNode.ts Переглянути файл

@ -3,7 +3,7 @@ import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ViewFilesLayout, ViewsFilesConfig } from '../../configuration';
import { GitUri } from '../../git/gitService';
import { Arrays, Objects } from '../../system';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { ResourceType, ViewNode } from './viewNode';
export interface FileNode extends ViewNode {
@ -14,11 +14,11 @@ export interface FileNode extends ViewNode {
root?: Arrays.IHierarchicalItem<FileNode>;
}
export class FolderNode extends ViewNode {
export class FolderNode extends ViewNode<ViewWithFiles> {
readonly priority: number = 1;
constructor(
view: View,
view: ViewWithFiles,
parent: ViewNode,
public readonly repoPath: string,
public readonly folderName: string,

+ 3
- 3
src/views/nodes/resultsCommitsNode.ts Переглянути файл

@ -3,7 +3,7 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { GitLog, GitUri } from '../../git/gitService';
import { Iterables } from '../../system';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { CommitNode } from './commitNode';
import { ShowMoreNode } from './common';
import { getBranchesAndTagTipsFn, insertDateMarkers } from './helpers';
@ -14,12 +14,12 @@ export interface CommitsQueryResults {
log: GitLog | undefined;
}
export class ResultsCommitsNode extends ViewNode implements PageableViewNode {
export class ResultsCommitsNode extends ViewNode<ViewWithFiles> implements PageableViewNode {
readonly supportsPaging: boolean = true;
maxCount: number | undefined;
constructor(
view: View,
view: ViewWithFiles,
parent: ViewNode,
public readonly repoPath: string,
private readonly _commitsQuery: (maxCount: number | undefined) => Promise<CommitsQueryResults>

+ 3
- 3
src/views/nodes/resultsFilesNode.ts Переглянути файл

@ -5,7 +5,7 @@ import { ViewFilesLayout } from '../../configuration';
import { Container } from '../../container';
import { GitFile, GitUri } from '../../git/gitService';
import { Arrays, Iterables, Strings } from '../../system';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { FileNode, FolderNode } from './folderNode';
import { ResultsFileNode } from './resultsFileNode';
import { ResourceType, ViewNode } from './viewNode';
@ -15,9 +15,9 @@ export interface FilesQueryResults {
diff: GitFile[] | undefined;
}
export class ResultsFilesNode extends ViewNode {
export class ResultsFilesNode extends ViewNode<ViewWithFiles> {
constructor(
view: View,
view: ViewWithFiles,
parent: ViewNode,
public readonly repoPath: string,
private readonly _ref1: string,

+ 2
- 2
src/views/nodes/searchResultsCommitsNode.ts Переглянути файл

@ -3,13 +3,13 @@ import { TreeItem } from 'vscode';
import { SearchCommitsCommandArgs } from '../../commands';
import { Commands } from '../../commands/common';
import { GitRepoSearchBy } from '../../git/gitService';
import { View } from '../viewBase';
import { ViewWithFiles } from '../viewBase';
import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode';
import { ResourceType, ViewNode } from './viewNode';
export class SearchResultsCommitsNode extends ResultsCommitsNode {
constructor(
view: View,
view: ViewWithFiles,
parent: ViewNode,
repoPath: string,
public readonly search: string,

+ 1
- 0
src/views/viewBase.ts Переглянути файл

@ -27,6 +27,7 @@ import { SearchView } from './searchView';
import { RefreshNodeCommandArgs } from './viewCommands';
export type View = RepositoriesView | FileHistoryView | LineHistoryView | CompareView | SearchView;
export type ViewWithFiles = RepositoriesView | CompareView | SearchView;
export interface TreeViewNodeStateChangeEvent<T> extends TreeViewExpansionEvent<T> {
state: TreeItemCollapsibleState;

Завантаження…
Відмінити
Зберегти