Parcourir la source

Adds view toggling buttons

main
Eric Amodio il y a 5 ans
Parent
révision
031018f47c
9 fichiers modifiés avec 163 ajouts et 47 suppressions
  1. +5
    -0
      CHANGELOG.md
  2. +5
    -0
      images/dark/icon-view-auto.svg
  3. +3
    -0
      images/dark/icon-view-list.svg
  4. +4
    -0
      images/dark/icon-view-tree.svg
  5. +5
    -0
      images/light/icon-view-auto.svg
  6. +3
    -0
      images/light/icon-view-list.svg
  7. +4
    -0
      images/light/icon-view-tree.svg
  8. +119
    -47
      package.json
  9. +15
    -0
      src/views/repositoriesView.ts

+ 5
- 0
CHANGELOG.md Voir le fichier

@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased]
### Added
- Adds a button to toggle the file layout (list vs. tree vs. auto) to the _Repositories_, _Compare_, and _Search Commits_ views
- Adds a button to toggle the branch layout (list vs. tree) to the _Branches_ node of the _Repositories_ view
### Changed
- Changes the experimental _Incoming Activity_ node in the _Repositories_ view to be available for everyone (not just if `"gitlens.insiders": true`)

+ 5
- 0
images/dark/icon-view-auto.svg Voir le fichier

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
<path fill="#C5C5C5" fill-rule="evenodd" d="M14 4H2V3h12v1zM6 7H2V6h5a5.03 5.03 0 0 0-1 1zm-.584 5c.156.357.352.692.584 1H2v-1h3.416zM5.1 9c-.066.323-.1.658-.1 1H2V9h3.1zM14 7a5.03 5.03 0 0 0-1-1h1v1z" clip-rule="evenodd"/>
<circle cx="10" cy="10" r="4.5" stroke="#C5C5C5"/>
<path fill="#C5C5C5" d="M10.996 10.8H9.169L8.805 12h-.696l1.554-4.823h.874L12.095 12h-.735l-.364-1.2zm-1.666-.557h1.505l-.749-2.506-.756 2.506z"/>
</svg>

+ 3
- 0
images/dark/icon-view-list.svg Voir le fichier

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
<path stroke="#C5C5C5" d="M2 3.5h12M2 6.5h12M2 9.5h12M2 12.5h12"/>
</svg>

+ 4
- 0
images/dark/icon-view-tree.svg Voir le fichier

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
<path fill="#C5C5C5" d="M14 2.75v3.938L13.73 7H13V3.5h-2.5l-.19-.09L9.85 3H8v3h5v1H7.27L7 6.687V2.313L7.27 2h2.692l.19.091.46.409h3.138l.25.25zM14 9.75v3.938l-.27.312H13v-3.5h-2.5l-.19-.09-.46-.41H8v3h5v1H7.27L7 13.687V9.314L7.27 9h2.692l.19.091.46.409h3.138l.25.25z"/>
<path fill="#C5C5C5" fill-rule="evenodd" d="M2 11.586l.414.414H7v-1H3V5h4V4H3V1H2v10.586z" clip-rule="evenodd"/>
</svg>

+ 5
- 0
images/light/icon-view-auto.svg Voir le fichier

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
<path fill="#424242" fill-rule="evenodd" d="M14 4H2V3h12v1zM6 7H2V6h5a5.03 5.03 0 0 0-1 1zm-.584 5c.156.357.352.692.584 1H2v-1h3.416zM5.1 9c-.066.323-.1.658-.1 1H2V9h3.1zM14 7a5.03 5.03 0 0 0-1-1h1v1z" clip-rule="evenodd"/>
<circle cx="10" cy="10" r="4.5" stroke="#424242"/>
<path fill="#424242" d="M10.996 10.8H9.169L8.805 12h-.696l1.554-4.823h.874L12.095 12h-.735l-.364-1.2zm-1.666-.557h1.505l-.749-2.506-.756 2.506z"/>
</svg>

+ 3
- 0
images/light/icon-view-list.svg Voir le fichier

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
<path stroke="#424242" d="M2 3.5h12M2 6.5h12M2 9.5h12M2 12.5h12"/>
</svg>

+ 4
- 0
images/light/icon-view-tree.svg Voir le fichier

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
<path fill="#424242" d="M14 2.75v3.938L13.73 7H13V3.5h-2.5l-.19-.09L9.85 3H8v3h5v1H7.27L7 6.687V2.313L7.27 2h2.692l.19.091.46.409h3.138l.25.25zM14 9.75v3.938l-.27.312H13v-3.5h-2.5l-.19-.09-.46-.41H8v3h5v1H7.27L7 13.687V9.314L7.27 9h2.692l.19.091.46.409h3.138l.25.25z"/>
<path fill="#424242" fill-rule="evenodd" d="M2 11.586l.414.414H7v-1H3V5h4V4H3V1H2v10.586z" clip-rule="evenodd"/>
</svg>

+ 119
- 47
package.json Voir le fichier

@ -2959,19 +2959,49 @@
}
},
{
"command": "gitlens.views.repositories.setBranchesLayoutToList",
"title": "Toggle Branch Layout (Tree)",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-tree.svg",
"light": "images/light/icon-view-tree.svg"
}
},
{
"command": "gitlens.views.repositories.setBranchesLayoutToTree",
"title": "Toggle Branch Layout (List)",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-list.svg",
"light": "images/light/icon-view-list.svg"
}
},
{
"command": "gitlens.views.repositories.setFilesLayoutToAuto",
"title": "Automatic Layout",
"category": "GitLens"
"title": "Toggle File Layout (Tree)",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-tree.svg",
"light": "images/light/icon-view-tree.svg"
}
},
{
"command": "gitlens.views.repositories.setFilesLayoutToList",
"title": "List Layout",
"category": "GitLens"
"title": "Toggle File Layout (Auto)",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-auto.svg",
"light": "images/light/icon-view-auto.svg"
}
},
{
"command": "gitlens.views.repositories.setFilesLayoutToTree",
"title": "Tree Layout",
"category": "GitLens"
"title": "Toggle File Layout (List)",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-list.svg",
"light": "images/light/icon-view-list.svg"
}
},
{
"command": "gitlens.views.repositories.setAutoRefreshToOn",
@ -3105,17 +3135,29 @@
{
"command": "gitlens.views.compare.setFilesLayoutToAuto",
"title": "Automatic Layout",
"category": "GitLens"
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-tree.svg",
"light": "images/light/icon-view-tree.svg"
}
},
{
"command": "gitlens.views.compare.setFilesLayoutToList",
"title": "List Layout",
"category": "GitLens"
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-auto.svg",
"light": "images/light/icon-view-auto.svg"
}
},
{
"command": "gitlens.views.compare.setFilesLayoutToTree",
"title": "Tree Layout",
"category": "GitLens"
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-list.svg",
"light": "images/light/icon-view-list.svg"
}
},
{
"command": "gitlens.views.compare.setKeepResultsToOn",
@ -3192,17 +3234,29 @@
{
"command": "gitlens.views.search.setFilesLayoutToAuto",
"title": "Automatic Layout",
"category": "GitLens"
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-tree.svg",
"light": "images/light/icon-view-tree.svg"
}
},
{
"command": "gitlens.views.search.setFilesLayoutToList",
"title": "List Layout",
"category": "GitLens"
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-auto.svg",
"light": "images/light/icon-view-auto.svg"
}
},
{
"command": "gitlens.views.search.setFilesLayoutToTree",
"title": "Tree Layout",
"category": "GitLens"
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-view-list.svg",
"light": "images/light/icon-view-list.svg"
}
},
{
"command": "gitlens.views.search.setKeepResultsToOn",
@ -3839,6 +3893,14 @@
"when": "false"
},
{
"command": "gitlens.views.repositories.setBranchesLayoutToList",
"when": "false"
},
{
"command": "gitlens.views.repositories.setBranchesLayoutToTree",
"when": "false"
},
{
"command": "gitlens.views.repositories.setFilesLayoutToAuto",
"when": "false"
},
@ -4312,24 +4374,24 @@
"group": "navigation@12"
},
{
"command": "gitlens.views.repositories.refresh",
"when": "view =~ /^gitlens\\.views\\.repositories:/",
"group": "navigation@99"
"command": "gitlens.views.repositories.setFilesLayoutToList",
"when": "view =~ /^gitlens\\.views\\.repositories:/ && config.gitlens.views.repositories.files.layout == auto",
"group": "navigation@13"
},
{
"command": "gitlens.views.repositories.setFilesLayoutToAuto",
"when": "view =~ /^gitlens\\.views\\.repositories:/",
"group": "1_gitlens"
"command": "gitlens.views.repositories.setFilesLayoutToTree",
"when": "view =~ /^gitlens\\.views\\.repositories:/ && config.gitlens.views.repositories.files.layout == list",
"group": "navigation@13"
},
{
"command": "gitlens.views.repositories.setFilesLayoutToList",
"when": "view =~ /^gitlens\\.views\\.repositories:/",
"group": "1_gitlens"
"command": "gitlens.views.repositories.setFilesLayoutToAuto",
"when": "view =~ /^gitlens\\.views\\.repositories:/ && config.gitlens.views.repositories.files.layout == tree",
"group": "navigation@13"
},
{
"command": "gitlens.views.repositories.setFilesLayoutToTree",
"command": "gitlens.views.repositories.refresh",
"when": "view =~ /^gitlens\\.views\\.repositories:/",
"group": "1_gitlens"
"group": "navigation@99"
},
{
"command": "gitlens.views.repositories.setAutoRefreshToOn",
@ -4417,29 +4479,29 @@
"group": "navigation@11"
},
{
"command": "gitlens.views.compare.clear",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "navigation@98"
"command": "gitlens.views.compare.setFilesLayoutToList",
"when": "view =~ /^gitlens\\.views\\.compare:/ && config.gitlens.views.compare.files.layout == auto",
"group": "navigation@12"
},
{
"command": "gitlens.views.compare.refresh",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "navigation@99"
"command": "gitlens.views.compare.setFilesLayoutToTree",
"when": "view =~ /^gitlens\\.views\\.compare:/ && config.gitlens.views.compare.files.layout == list",
"group": "navigation@12"
},
{
"command": "gitlens.views.compare.setFilesLayoutToAuto",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "1_gitlens"
"when": "view =~ /^gitlens\\.views\\.compare:/ && config.gitlens.views.compare.files.layout == tree",
"group": "navigation@12"
},
{
"command": "gitlens.views.compare.setFilesLayoutToList",
"command": "gitlens.views.compare.clear",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "1_gitlens"
"group": "navigation@98"
},
{
"command": "gitlens.views.compare.setFilesLayoutToTree",
"command": "gitlens.views.compare.refresh",
"when": "view =~ /^gitlens\\.views\\.compare:/",
"group": "1_gitlens"
"group": "navigation@99"
},
{
"command": "gitlens.views.search.searchCommits",
@ -4457,29 +4519,29 @@
"group": "navigation@11"
},
{
"command": "gitlens.views.search.clear",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "navigation@98"
"command": "gitlens.views.search.setFilesLayoutToList",
"when": "view =~ /^gitlens\\.views\\.search:/ && config.gitlens.views.search.files.layout == auto",
"group": "navigation@12"
},
{
"command": "gitlens.views.search.refresh",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "navigation@99"
"command": "gitlens.views.search.setFilesLayoutToTree",
"when": "view =~ /^gitlens\\.views\\.search:/ && config.gitlens.views.search.files.layout == list",
"group": "navigation@12"
},
{
"command": "gitlens.views.search.setFilesLayoutToAuto",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "1_gitlens"
"when": "view =~ /^gitlens\\.views\\.search:/ && config.gitlens.views.search.files.layout == tree",
"group": "navigation@12"
},
{
"command": "gitlens.views.search.setFilesLayoutToList",
"command": "gitlens.views.search.clear",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "1_gitlens"
"group": "navigation@98"
},
{
"command": "gitlens.views.search.setFilesLayoutToTree",
"command": "gitlens.views.search.refresh",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "1_gitlens"
"group": "navigation@99"
},
{
"command": "gitlens.supportGitLens",
@ -4514,6 +4576,16 @@
],
"view/item/context": [
{
"command": "gitlens.views.repositories.setBranchesLayoutToList",
"when": "viewItem =~ /gitlens:branches\\b/ && config.gitlens.views.repositories.branches.layout == tree",
"group": "inline@1"
},
{
"command": "gitlens.views.repositories.setBranchesLayoutToTree",
"when": "viewItem =~ /gitlens:branches\\b/ && config.gitlens.views.repositories.branches.layout == list",
"group": "inline@1"
},
{
"command": "gitlens.openBranchesInRemote",
"when": "viewItem =~ /gitlens:branches\\b(?=.*?\\b\\+remotes\\b)/",
"group": "inline@98"

+ 15
- 0
src/views/repositoriesView.ts Voir le fichier

@ -11,6 +11,7 @@ import {
import {
configuration,
RepositoriesViewConfig,
ViewBranchesLayout,
ViewFilesLayout,
ViewsConfig,
ViewShowBranchComparison
@ -60,6 +61,16 @@ export class RepositoriesView extends ViewBase {
);
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(true), this);
commands.registerCommand(
this.getQualifiedCommand('setBranchesLayoutToList'),
() => this.setBranchesLayout(ViewBranchesLayout.List),
this
);
commands.registerCommand(
this.getQualifiedCommand('setBranchesLayoutToTree'),
() => this.setBranchesLayout(ViewBranchesLayout.Tree),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToAuto'),
() => this.setFilesLayout(ViewFilesLayout.Auto),
this
@ -304,6 +315,10 @@ export class RepositoriesView extends ViewBase {
return node.setComparisonType(comparisonType);
}
private setBranchesLayout(layout: ViewBranchesLayout) {
return configuration.updateEffective('views', 'repositories', 'branches', 'layout', layout);
}
private setFilesLayout(layout: ViewFilesLayout) {
return configuration.updateEffective('views', 'repositories', 'files', 'layout', layout);
}

Chargement…
Annuler
Enregistrer