Selaa lähdekoodia

Renames explorer to view

main
Eric Amodio 6 vuotta sitten
vanhempi
commit
7606783132
67 muutettua tiedostoa jossa 2794 lisäystä ja 2757 poistoa
  1. +15
    -15
      CHANGELOG.md
  2. +90
    -90
      README.md
  3. +536
    -537
      package.json
  4. +3
    -3
      src/commands.ts
  5. +27
    -27
      src/commands/common.ts
  6. +1
    -1
      src/commands/diffBranchWithBranch.ts
  7. +3
    -7
      src/commands/diffDirectory.ts
  8. +2
    -2
      src/commands/showCommitSearch.ts
  9. +0
    -33
      src/commands/showExplorer.ts
  10. +1
    -1
      src/commands/showQuickCommitDetails.ts
  11. +2
    -2
      src/commands/showQuickFileHistory.ts
  12. +33
    -0
      src/commands/showView.ts
  13. +5
    -4
      src/configuration.ts
  14. +11
    -11
      src/constants.ts
  15. +55
    -49
      src/container.ts
  16. +83
    -22
      src/extension.ts
  17. +3
    -3
      src/quickpicks/commitsQuickPick.ts
  18. +5
    -5
      src/quickpicks/commonQuickPicks.ts
  19. +3
    -3
      src/quickpicks/fileHistoryQuickPick.ts
  20. +19
    -19
      src/ui/config.ts
  21. +87
    -87
      src/ui/settings/index.html
  22. +8
    -8
      src/ui/welcome/index.html
  23. +18
    -18
      src/views/fileHistoryView.ts
  24. +18
    -18
      src/views/lineHistoryView.ts
  25. +1
    -1
      src/views/nodes.ts
  26. +13
    -13
      src/views/nodes/branchNode.ts
  27. +7
    -7
      src/views/nodes/branchOrTagFolderNode.ts
  28. +12
    -20
      src/views/nodes/branchesNode.ts
  29. +8
    -8
      src/views/nodes/commitFileNode.ts
  30. +16
    -16
      src/views/nodes/commitNode.ts
  31. +19
    -24
      src/views/nodes/common.ts
  32. +12
    -12
      src/views/nodes/fileHistoryNode.ts
  33. +8
    -8
      src/views/nodes/fileHistoryTrackerNode.ts
  34. +21
    -21
      src/views/nodes/folderNode.ts
  35. +4
    -4
      src/views/nodes/helpers.ts
  36. +13
    -13
      src/views/nodes/lineHistoryNode.ts
  37. +8
    -8
      src/views/nodes/lineHistoryTrackerNode.ts
  38. +11
    -11
      src/views/nodes/remoteNode.ts
  39. +7
    -7
      src/views/nodes/remotesNode.ts
  40. +13
    -13
      src/views/nodes/repositoriesNode.ts
  41. +26
    -26
      src/views/nodes/repositoryNode.ts
  42. +6
    -6
      src/views/nodes/resultsCommitNode.ts
  43. +8
    -8
      src/views/nodes/resultsCommitsNode.ts
  44. +8
    -8
      src/views/nodes/resultsComparisonNode.ts
  45. +6
    -6
      src/views/nodes/resultsFileNode.ts
  46. +14
    -17
      src/views/nodes/resultsFilesNode.ts
  47. +11
    -11
      src/views/nodes/resultsNode.ts
  48. +6
    -6
      src/views/nodes/stashFileNode.ts
  49. +8
    -8
      src/views/nodes/stashNode.ts
  50. +7
    -7
      src/views/nodes/stashesNode.ts
  51. +9
    -9
      src/views/nodes/statusFileNode.ts
  52. +15
    -15
      src/views/nodes/statusFilesNode.ts
  53. +10
    -10
      src/views/nodes/statusUpstreamNode.ts
  54. +11
    -13
      src/views/nodes/tagNode.ts
  55. +11
    -11
      src/views/nodes/tagsNode.ts
  56. +22
    -26
      src/views/nodes/viewNode.ts
  57. +29
    -29
      src/views/repositoriesView.ts
  58. +31
    -31
      src/views/resultsView.ts
  59. +22
    -22
      src/views/viewBase.ts
  60. +82
    -86
      src/views/viewCommands.ts

+ 15
- 15
CHANGELOG.md Näytä tiedosto

@ -222,7 +222,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds the ability to control where the _GitLens_, _GitLens File History_, and _GitLens Results_ explorers are shown 🎉 — closes [#213](https://github.com/eamodio/vscode-gitlens/issues/213), [#377](https://github.com/eamodio/vscode-gitlens/issues/377)
- Adds `gitlens.gitExplorer.location` setting to the interactive settings editor to specify where the _GitLens_ explorer is shown — either in the _Explorer_ or _Source Control_ view
- Adds `gitlens.historyExplorer.location` setting to the interactive settings editor to specify where the _GitLens File History_ explorer is shown — either in the _Explorer_ or _Source Control_ view
- Adds `gitlens.resultsExplorer.location` setting to the interactive settings editor to specify where the _GitLens Results_ explorer is shown — either in the _Explorer_ or _Source Control_ view
- Adds `gitlens.resultsView.location` setting to the interactive settings editor to specify where the _GitLens Results_ explorer is shown — either in the _Explorer_ or _Source Control_ view
### Changed
@ -270,7 +270,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds a tree layout option to tags in the _GitLens_ explorer — closes [#358](https://github.com/eamodio/vscode-gitlens/issues/358)
- Adds _Show GitLens Explorer_ (`gitlens.showGitExplorer`) command — shows/expands the _GitLens_ explorer
- Adds _Show File History Explorer_ (`gitlens.showHistoryExplorer`) command — shows/expands the _GitLens File History_ explorer
- Adds _Show Results Explorer_ (`gitlens.showResultsExplorer`) command — shows/expands the _GitLens Results_ explorer
- Adds _Show Results Explorer_ (`gitlens.showResultsView`) command — shows/expands the _GitLens Results_ explorer
### Changed
@ -501,9 +501,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Renames _Show Files in Automatic View_ (`gitlens.gitExplorer.setFilesLayoutToAuto`) command to _Automatic Layout_
- Renames _Show Files in List View_ (`gitlens.gitExplorer.setFilesLayoutToList`) command to _List Layout_
- Renames _Show Files in Tree View_ (`gitlens.gitExplorer.setFilesLayoutToTree`) command to _Tree Layout_
- Renames _Show Files in Automatic View_ (`gitlens.resultsExplorer.setFilesLayoutToAuto`) command to _Automatic Layout_
- Renames _Show Files in List View_ (`gitlens.resultsExplorer.setFilesLayoutToAuto`) command to _List Layout_
- Renames _Show Files in Tree View_ (`gitlens.resultsExplorer.setFilesLayoutToAuto`) command to _Tree Layout_
- Renames _Show Files in Automatic View_ (`gitlens.resultsView.setFilesLayoutToAuto`) command to _Automatic Layout_
- Renames _Show Files in List View_ (`gitlens.resultsView.setFilesLayoutToAuto`) command to _List Layout_
- Renames _Show Files in Tree View_ (`gitlens.resultsView.setFilesLayoutToAuto`) command to _Tree Layout_
- Overhauls GitLens' settings for better clarity and ease-of-use
- Renames `gitlens.annotations.file.gutter.gravatars` setting to `gitlens.blame.avatars`
- Renames `gitlens.annotations.file.gutter.compact` setting to `gitlens.blame.compact`
@ -539,13 +539,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Removes `gitlens.codeLens.debug` setting, use `gitlens.debug` instead
- Removes `gitlens.blame.file.annotationType` setting, use `gitlens.hovers.annotations.enabled`
- Removes `gitlens.blame.line.annotationType` setting, use `gitlens.currentLine.enabled` or `gitlens.hovers.currentLine.enabled` instead
- Removes `gitlens.resultsExplorer.gravatars` setting, use `gitlens.explorers.avatars` instead
- Removes `gitlens.resultsExplorer.commitFileFormat` setting, use `gitlens.explorers.commitFileFormat` instead
- Removes `gitlens.resultsExplorer.commitFormat` setting, use `gitlens.explorers.commitFormat` instead
- Removes `gitlens.resultsExplorer.showTrackingBranch` setting
- Removes `gitlens.resultsExplorer.stashFileFormat` setting, use `gitlens.explorers.stashFileFormat` instead
- Removes `gitlens.resultsExplorer.stashFormat` setting, use `gitlens.explorers.stashFormat` instead
- Removes `gitlens.resultsExplorer.statusFileFormat` setting, use `gitlens.explorers.statusFileFormat` instead
- Removes `gitlens.resultsView.gravatars` setting, use `gitlens.explorers.avatars` instead
- Removes `gitlens.resultsView.commitFileFormat` setting, use `gitlens.explorers.commitFileFormat` instead
- Removes `gitlens.resultsView.commitFormat` setting, use `gitlens.explorers.commitFormat` instead
- Removes `gitlens.resultsView.showTrackingBranch` setting
- Removes `gitlens.resultsView.stashFileFormat` setting, use `gitlens.explorers.stashFileFormat` instead
- Removes `gitlens.resultsView.stashFormat` setting, use `gitlens.explorers.stashFormat` instead
- Removes `gitlens.resultsView.statusFileFormat` setting, use `gitlens.explorers.statusFileFormat` instead
- Removes `gitlens.annotations.file.hover.changes` setting, use `gitlens.hovers.annotations.changes` instead
- Removes `gitlens.annotations.file.hover.details` setting, use `gitlens.hovers.annotations.details` instead
- Removes `gitlens.annotations.file.hover.heatmap.enabled` setting
@ -669,7 +669,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Renames _Compare Line Revision with Working_ command (`gitlens.diffLineWithWorking`) to _Compare Line Revision with Working File_
- Renames _Open Changes with Working Tree_ command (`gitlens.openChangesWithWorking`) to _Open Changes with Working File_
- Deprecates `gitlens.gitExplorer.gravatarsDefault` setting, replaced by `gitlens.defaultGravatarsStyle`
- Deprecates `gitlens.resultsExplorer.gravatarsDefault` setting, replaced by `gitlens.defaultGravatarsStyle`
- Deprecates `gitlens.resultsView.gravatarsDefault` setting, replaced by `gitlens.defaultGravatarsStyle`
### Fixed
@ -750,8 +750,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds `gitlens.gitExplorer.gravatars` setting to specify whether to show gravatar images instead of commit (or status) icons in the _GitLens_ explorer
- Adds `gitlens.gitExplorer.gravatarsDefault` setting to specify the style of the gravatar default (fallback) images in the _GitLens_ explorer<br />`identicon` - a geometric pattern<br />`mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)<br />`monsterid` - a monster with different colors, faces, etc<br />`retro` - 8-bit arcade-style pixelated faces<br />`robohash` - a robot with different colors, faces, etc<br />`wavatar` - faces with differing features and backgrounds
- Adds `gitlens.resultsExplorer.gravatars` setting to specify whether to show gravatar images instead of commit (or status) icons in the _GitLens Results_ explorer
- Adds `gitlens.resultsExplorer.gravatarsDefault` setting to specify the style of the gravatar default (fallback) images in the _GitLens Results_ explorer<br />`identicon` - a geometric pattern<br />`mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)<br />`monsterid` - a monster with different colors, faces, etc<br />`retro` - 8-bit arcade-style pixelated faces<br />`robohash` - a robot with different colors, faces, etc<br />`wavatar` - faces with differing features and backgrounds
- Adds `gitlens.resultsView.gravatars` setting to specify whether to show gravatar images instead of commit (or status) icons in the _GitLens Results_ explorer
- Adds `gitlens.resultsView.gravatarsDefault` setting to specify the style of the gravatar default (fallback) images in the _GitLens Results_ explorer<br />`identicon` - a geometric pattern<br />`mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)<br />`monsterid` - a monster with different colors, faces, etc<br />`retro` - 8-bit arcade-style pixelated faces<br />`robohash` - a robot with different colors, faces, etc<br />`wavatar` - faces with differing features and backgrounds
- Adds _Select for Compare_ command (`gitlens.explorers.selectForCompare`) to branch, remote branch, tag, and revision (commit) nodes in the _GitLens_ explorer to mark the base reference of a comparison
- Adds _Compare with Selected_ command (`gitlens.explorers.compareWithSelected`) to branch, remote branch, tag, and revision (commit) nodes in the _GitLens_ explorer once another reference within the same repository has been selected to compare the current selection with the previously selected reference in the _GitLens Results_ explorer

+ 90
- 90
README.md Näytä tiedosto

@ -5,13 +5,13 @@
<p align="center">
<br />
<a title="Learn more about GitLens" href="http://gitlens.amod.io"><img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/gitlens-logo.png" alt="GitLens Logo" /></a>
<a title="Learn more about GitLens" href="http://gitlens.amod.io"><img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/gitlens-logo.png" alt="GitLens Logo" /></a>
</p>
> GitLens **supercharges** the Git capabilities built into Visual Studio Code. It helps you to **visualize code authorship** at a glance via Git blame annotations and code lens, **seamlessly navigate and explore** Git repositories, **gain valuable insights** via powerful comparison commands, and so much more.
<br />
https://raw.githubusercontent.com/eamodio/vscode-gitlens/blob/cd90faa526720cb4b07a52b3cf84abaa55a978a0/images/cl-heatmap-cold.png
# What's new in GitLens 9
## 9.0 &mdash; September 2018
@ -27,10 +27,10 @@ GitLens simply helps you understand code better. Quickly glimpse into whom, why,
Here are just some of the features that GitLens provides,
- a [_Repositories_ explorer](#repositories-explorer 'Jump to the Repositories explorer') to visualize, navigate, and explore Git repositories
- a [_File History_ explorer](#file-history-explorer 'Jump to the File History explorer') to visualize, navigate, and explore the revision history of the current file
- a [_Line History_ explorer](#line-history-explorer 'Jump to the Line History explorer') to visualize, navigate, and explore the revision history of the selected lines of current file
- an on-demand [_Results_ explorer](#results-explorer 'Jump to the Results explorer') to navigate and explore commits, histories, and searches, or visualize comparisons between branches, tags, commits, and more
- a [_Repositories_ view](#repositories-view 'Jump to the Repositories view') to visualize, navigate, and explore Git repositories
- a [_File History_ view](#file-history-view 'Jump to the File History view') to visualize, navigate, and explore the revision history of the current file
- a [_Line History_ view](#line-history-view 'Jump to the Line History view') to visualize, navigate, and explore the revision history of the selected lines of current file
- an on-demand [_Results_ view](#results-view 'Jump to the Results view') to navigate and explore commits, histories, and searches, or visualize comparisons between branches, tags, commits, and more
- [authorship code lens](#code-lens 'Jump to the Code Lens') showing the most recent commit and # of authors to the top of files and/or on code blocks
- an unobtrusive [current line blame](#current-line-blame 'Jump to the Current Line Blame') annotation at the end of the line
- on-demand [gutter blame](#gutter-blame 'Jump to the Gutter Blame') annotations, including a heatmap, for the whole file
@ -81,7 +81,7 @@ None yet — could be you!
#### Bronze Sponsors ($50+)
- Michael Duffy
None yet &mdash; could be you!
## Configuration
@ -95,22 +95,22 @@ For more advanced customizations, refer to the [settings documentation](#gitlens
## Features
### Repositories Explorer
### Repositories view
<p align="center">
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/repositories-explorer.png" alt="Repositories Explorer" />
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/repositories-explorer.png" alt="Repositories view" />
</p>
A [customizable](#repositories-explorer-settings 'Jump to the Repositories explorer settings') explorer to visualize, navigate, and explore Git repositories.
A [customizable](#repositories-view-settings 'Jump to the Repositories view settings') view to visualize, navigate, and explore Git repositories.
- A toolbar provides _Search Commits_, and _Refresh_ commands
- A context menu provides _Automatic Layout_, _List Layout_, _Tree Layout_, and _Enable Automatic Refresh_ or _Disable Automatic Refresh_ commands
The repositories explorer provides the following features,
The repositories view provides the following features,
- **Repository Status**
- Provides the name of the current branch, [optionally](#repositories-explorer-settings 'Jump to the Repositories explorer settings') its working tree status, and its upstream tracking branch and status (if available)
- Provides the name of the current branch, [optionally](#repositories-view-settings 'Jump to the Repositories view settings') its working tree status, and its upstream tracking branch and status (if available)
- Provides indicator dots on the repository icon which denote the following:
- _None_ &mdash; up-to-date with the upstream
- _Green_ &mdash; ahead of the upstream
@ -121,13 +121,13 @@ The repositories explorer provides the following features,
- is ahead of the upstream &mdash; quickly see and explore the specific commits ahead of the upstream (i.e. commits that haven't been pushed)
- A context menu provides _Open Repository on Remote_, and _Refresh_ commands
- **Changed Files** &mdash; lists all the "working" changes
- Expands to a file-based view of all changed files in the working tree ([optionally](#repositories-explorer-settings 'Jump to the Repositories explorer settings')) and/or all files in all commits ahead of the upstream
- Expands to a file-based view of all changed files in the working tree ([optionally](#repositories-view-settings 'Jump to the Repositories view settings')) and/or all files in all commits ahead of the upstream
- **History (current-branch)** &mdash; lists the revision (commit) history of the current branch
- See the _Branches expand_ section under **Branches** below for more details
- **Branches** &mdash; lists the local branches
- Indicates which branch is the current branch and [optionally](#repositories-explorer-settings 'Jump to the Repositories explorer settings') shows the remote tracking branch
- Indicates which branch is the current branch and [optionally](#repositories-view-settings 'Jump to the Repositories view settings') shows the remote tracking branch
- A context menu provides _Open Branches on Remote_, and _Refresh_ commands
- Branches expand to show its revision (commit) history
- Provides indicator dots on each branch icon which denote the following:
@ -173,18 +173,18 @@ The repositories explorer provides the following features,
---
### File History Explorer
### File History view
<p align="center">
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/file-history-explorer.png" alt="File History Explorer" />
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/file-history-explorer.png" alt="File History view" />
</p>
A [customizable](#file-history-explorer-settings 'Jump to the File History explorer settings') explorer to visualize, navigate, and explore the revision history of the current file.
A [customizable](#file-history-view-settings 'Jump to the File History view settings') view to visualize, navigate, and explore the revision history of the current file.
- A toolbar provides a _Refresh_ command
- A context menu provides a _Follow Renames_ or _Don't Follow Renames_ command
The file history explorer provides the following features,
The file history view provides the following features,
- Automatically updates to track the current editor
- A context menu provides _Open File_, _Open File on Remote_ (if available), _Copy Remote File Url to Clipboard_ (if available), and _Refresh_ commands
@ -194,13 +194,13 @@ The file history explorer provides the following features,
---
### Line History Explorer
### Line History view
<p align="center">
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/line-history-explorer.png" alt="Line History Explorer" />
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/line-history-explorer.png" alt="Line History view" />
</p>
A [customizable](#line-history-explorer-settings 'Jump to the Line History explorer settings') explorer to visualize, navigate, and explore the revision history of the selected lines of current file.
A [customizable](#line-history-view-settings 'Jump to the Line History view settings') view to visualize, navigate, and explore the revision history of the selected lines of current file.
- A toolbar provides a _Refresh_ command
- A context menu provides a _Follow Renames_ or _Don't Follow Renames_ command
@ -215,18 +215,18 @@ The line history explorer provides the following features,
---
### Results Explorer
### Results view
<p align="center">
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/results-explorer.png" alt="Results explorer" />
<img src="https://raw.githubusercontent.com/eamodio/vscode-gitlens/develop/images/docs/results-explorer.png" alt="Results view" />
</p>
An on-demand, [customizable](#results-explorer-settings 'Jump to the Results explorer settings') explorer to navigate and explore commits, histories, and searches, or visualize comparisons between branches, tags, commits, and more
An on-demand, [customizable](#results-view-settings 'Jump to the Results view settings') view to navigate and explore commits, histories, and searches, or visualize comparisons between branches, tags, commits, and more
- A toolbar provides _Search Commits_, _Keep Results_, and _Refresh_ commands
- A context menu provides _Automatic Layout_, _List Layout_, _Tree Layout_, and _Close_ commands
The results explorer provides the following features,
The results view provides the following features,
#### Explore
@ -248,11 +248,11 @@ The results explorer provides the following features,
- Provides a semi-persistent results view for comparison operations
- Accessible via the following commands
- _Compare with Remote_ command (`gitlens.explorers.compareWithRemote`)
- _Compare with HEAD_ command (`gitlens.explorers.compareWithHead`)
- _Compare with Working Tree_ command (`gitlens.explorers.compareWithWorking`)
- _Compare with Selected_ command (`gitlens.explorers.compareWithSelected`)
- _Compare Ancestry with Working Tree_ command (`gitlens.explorers.compareAncestryWithWorking`)
- _Compare with Remote_ command (`gitlens.views.compareWithRemote`)
- _Compare with HEAD_ command (`gitlens.views.compareWithHead`)
- _Compare with Working Tree_ command (`gitlens.views.compareWithWorking`)
- _Compare with Selected_ command (`gitlens.views.compareWithSelected`)
- _Compare Ancestry with Working Tree_ command (`gitlens.views.compareAncestryWithWorking`)
- An inline toolbar provides _Swap Comparision_, and _Clear Results_ commands
- A context menu provides _Clear Results_, _Swap Comparision_, _Open Directory Compare_, and _Refresh_ commands
@ -454,7 +454,7 @@ The results explorer provides the following features,
- Use `#<sha>` to search for a commit with id of `<sha>` &mdash; See [Git docs](https://git-scm.com/docs/git-log 'Open Git docs')
- Use `~<pattern>` to search for commits with differences whose patch text contains added/removed lines that match `<pattern>` &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log--Gltregexgt 'Open Git docs')
- Use `=<string>` to search for commits with differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file &mdash; See [Git docs](https://git-scm.com/docs/git-log#git-log--Sltstringgt 'Open Git docs')
- Provides a _Show in Results_ option to show the search results in the _Results_ explorer
- Provides a _Show in Results_ option to show the search results in the _Results_ view
---
@ -635,65 +635,65 @@ GitLens is highly customizable and provides many configuration settings to allow
| `gitlens.settings.mode` | Specifies the display mode of the interactive settings editor<br />`simple` - only displays common settings<br />`advanced` - displays all settings |
| `gitlens.showWhatsNewAfterUpgrades` | Specifies whether to show What's New after upgrading to new feature releases |
### Repositories Explorer Settings
See also [Explorer Settings](#explorer-settings 'Jump to the Explorer settings')
| Name | Description |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.repositoriesExplorer.autoRefresh` | Specifies whether to automatically refresh the _Repositories_ explorer when the repository or the file system changes |
| `gitlens.repositoriesExplorer.autoReveal` | Specifies whether to automatically reveal repositories in the _Repositories_ explorer when opening files |
| `gitlens.repositoriesExplorer.branches.layout` | Specifies how the _Repositories_ explorer will display branches<br />`list` - displays branches as a list<br />`tree` - displays branches as a tree when branch names contain slashes `/` |
| `gitlens.repositoriesExplorer.enabled` | Specifies whether to show the _Repositories_ explorer |
| `gitlens.repositoriesExplorer.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Repositories_ explorer<br />Only applies when `gitlens.repositoriesExplorer.files.layout` is set to `tree` or `auto` |
| `gitlens.repositoriesExplorer.files.layout` | Specifies how the _Repositories_ explorer will display files<br />`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.repositoriesExplorer.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 |
| `gitlens.repositoriesExplorer.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Repositories_ explorer<br />Only applies when `gitlens.repositoriesExplorer.files.layout` is set to `auto` |
| `gitlens.repositoriesExplorer.includeWorkingTree` | Specifies whether to include working tree files inside the `Repository Status` node of the _Repositories_ explorer |
| `gitlens.repositoriesExplorer.location` | Specifies where to show the _Repositories_ explorer<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
| `gitlens.repositoriesExplorer.showTrackingBranch` | Specifies whether to show the tracking branch when displaying local branches in the _Repositories_ explorer |
### File History Explorer Settings
See also [Explorer Settings](#explorer-settings 'Jump to the Explorer settings')
| Name | Description |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.fileHistoryExplorer.avatars` | Specifies whether to show avatar images instead of status icons in the _File History_ explorer |
| `gitlens.fileHistoryExplorer.enabled` | Specifies whether to show the _File History_ explorer |
| `gitlens.fileHistoryExplorer.location` | Specifies where to show the _File History_ explorer<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
### Line History Explorer Settings
See also [Explorer Settings](#explorer-settings 'Jump to the Explorer settings')
| Name | Description |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.lineHistoryExplorer.avatars` | Specifies whether to show avatar images instead of status icons in the _Line History_ explorer |
| `gitlens.lineHistoryExplorer.enabled` | Specifies whether to show the _Line History_ explorer |
| `gitlens.lineHistoryExplorer.location` | Specifies where to show the _Line History_ explorer<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
### Results Explorer Settings
See also [Explorer Settings](#explorer-settings 'Jump to the Explorer settings')
| Name | Description |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `gitlens.resultsExplorer.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Results_ explorer<br />Only applies when `gitlens.resultsExplorer.files.layout` is set to `tree` or `auto` |
| `gitlens.resultsExplorer.files.layout` | Specifies how the _Results_ explorer will display files<br />`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.resultsExplorer.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 |
| `gitlens.resultsExplorer.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Results_ explorer<br />Only applies when `gitlens.resultsExplorer.files.layout` is set to `auto` |
| `gitlens.resultsExplorer.location` | Specifies where to show the _Results_ explorer<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
### Explorer Settings
| Name | Description |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.explorers.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Repositories_ and _Results_ explorers |
| `gitlens.explorers.commitFileFormat` | Specifies the format of a committed file in the _Repositories_ and _Results_ explorers<br />Available tokens<br /> ${directory} - directory name<br /> ${file} - file name<br /> ${filePath} - formatted file name and path<br /> ${path} - full file path |
| `gitlens.explorers.commitFormat` | Specifies the format of committed changes in the _Repositories_ and _Results_ explorers<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`<br /> ${authorAgo} - commit author, relative commit date<br /> ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting |
| `gitlens.explorers.defaultItemLimit` | Specifies the default number of items to show in an explorer list. Use 0 to specify no limit |
| `gitlens.explorers.stashFileFormat` | Specifies the format of a stashed file in the _Repositories_ and _Results_ explorers<br />Available tokens<br /> ${directory} - directory name<br /> ${file} - file name<br /> ${filePath} - formatted file name and path<br /> ${path} - full file path |
| `gitlens.explorers.stashFormat` | Specifies the format of stashed changes in the _Repositories_ and _Results_ explorers<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`<br /> ${authorAgo} - commit author, relative commit date<br /> ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting |
| `gitlens.explorers.statusFileFormat` | Specifies the format of the status of a working or committed file in the _Repositories_ explorer<br />Available tokens<br /> ${directory} - directory name<br /> ${file} - file name<br /> ${filePath} - formatted file name and path<br /> ${path} - full file path<br />${working} - optional indicator if the file is uncommitted |
### Repositories View Settings
See also [View Settings](#view-settings 'Jump to the View settings')
| Name | Description |
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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 />`list` - displays branches as a list<br />`tree` - displays branches as a tree when branch names contain slashes `/` |
| `gitlens.views.repositories.enabled` | Specifies whether to show the _Repositories_ view |
| `gitlens.views.repositories.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Repositories_ view<br />Only applies when `gitlens.views.repositories.files.layout` is set to `tree` or `auto` |
| `gitlens.views.repositories.files.layout` | Specifies how the _Repositories_ view will display files<br />`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.repositories.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 |
| `gitlens.views.repositories.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Repositories_ view<br />Only applies when `gitlens.views.repositories.files.layout` is set to `auto` |
| `gitlens.views.repositories.includeWorkingTree` | Specifies whether to include working tree files inside the `Repository Status` node of the _Repositories_ view |
| `gitlens.views.repositories.location` | Specifies where to show the _Repositories_ view<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
| `gitlens.views.repositories.showTrackingBranch` | Specifies whether to show the tracking branch when displaying local branches in the _Repositories_ view |
### File History View Settings
See also [View Settings](#view-settings 'Jump to the View settings')
| Name | Description |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.fileHistory.avatars` | Specifies whether to show avatar images instead of status icons in the _File History_ view |
| `gitlens.views.fileHistory.enabled` | Specifies whether to show the _File History_ view |
| `gitlens.views.fileHistory.location` | Specifies where to show the _File History_ view<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
### Line History View Settings
See also [View Settings](#view-settings 'Jump to the View settings')
| Name | Description |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.lineHistory.avatars` | Specifies whether to show avatar images instead of status icons in the _Line History_ view |
| `gitlens.views.lineHistory.enabled` | Specifies whether to show the _Line History_ view |
| `gitlens.views.lineHistory.location` | Specifies where to show the _Line History_ view<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
### Results View Settings
See also [View Settings](#view-settings 'Jump to the View settings')
| Name | Description |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.results.files.compact` | Specifies whether to compact (flatten) unnecessary file nesting in the _Results_ view<br />Only applies when `gitlens.views.results.files.layout` is set to `tree` or `auto` |
| `gitlens.views.results.files.layout` | Specifies how the _Results_ view will display files<br />`auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.views.results.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 |
| `gitlens.views.results.files.threshold` | Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Results_ view<br />Only applies when `gitlens.views.results.files.layout` is set to `auto` |
| `gitlens.views.results.location` | Specifies where to show the _Results_ view<br />`gitlens` - adds to the GitLens view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view |
### View Settings
| Name | Description |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.views.avatars` | Specifies whether to show avatar images instead of commit (or status) icons in the _Repositories_ and _Results_ views |
| `gitlens.views.commitFileFormat` | Specifies the format of a committed file in the _Repositories_ and _Results_ views<br />Available tokens<br /> ${directory} - directory name<br /> ${file} - file name<br /> ${filePath} - formatted file name and path<br /> ${path} - full file path |
| `gitlens.views.commitFormat` | Specifies the format of committed changes in the _Repositories_ and _Results_ views<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`<br /> ${authorAgo} - commit author, relative commit date<br /> ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting |
| `gitlens.views.defaultItemLimit` | Specifies the default number of items to show in a view list. Use 0 to specify no limit |
| `gitlens.views.stashFileFormat` | Specifies the format of a stashed file in the _Repositories_ and _Results_ views<br />Available tokens<br /> ${directory} - directory name<br /> ${file} - file name<br /> ${filePath} - formatted file name and path<br /> ${path} - full file path |
| `gitlens.views.stashFormat` | Specifies the format of stashed changes in the _Repositories_ and _Results_ views<br />Available tokens<br /> ${id} - commit id<br /> ${author} - commit author<br /> ${message} - commit message<br /> ${ago} - relative commit date (e.g. 1 day ago)<br /> ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br /> ${agoOrDate} - commit date specified by `gitlens.defaultDateStyle`<br /> ${authorAgo} - commit author, relative commit date<br /> ${authorAgoOrDate} - commit author, commit date specified by `gitlens.defaultDateStyle`<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting |
| `gitlens.views.statusFileFormat` | Specifies the format of the status of a working or committed file in the _Repositories_ view<br />Available tokens<br /> ${directory} - directory name<br /> ${file} - file name<br /> ${filePath} - formatted file name and path<br /> ${path} - full file path<br />${working} - optional indicator if the file is uncommitted |
### Code Lens Settings

+ 536
- 537
package.json
File diff suppressed because it is too large
Näytä tiedosto


+ 3
- 3
src/commands.ts Näytä tiedosto

@ -26,7 +26,6 @@ import { OpenRepoInRemoteCommand } from './commands/openRepoInRemote';
import { OpenWorkingFileCommand } from './commands/openWorkingFile';
import { ResetSuppressedWarningsCommand } from './commands/resetSuppressedWarnings';
import { ShowCommitSearchCommand } from './commands/showCommitSearch';
import { ShowExplorerCommand } from './commands/showExplorer';
import { ShowLastQuickPickCommand } from './commands/showLastQuickPick';
import { ShowQuickBranchHistoryCommand } from './commands/showQuickBranchHistory';
import { ShowQuickCommitDetailsCommand } from './commands/showQuickCommitDetails';
@ -35,6 +34,7 @@ import { ShowQuickCurrentBranchHistoryCommand } from './commands/showQuickCurren
import { ShowQuickFileHistoryCommand } from './commands/showQuickFileHistory';
import { ShowQuickRepoStatusCommand } from './commands/showQuickRepoStatus';
import { ShowQuickStashListCommand } from './commands/showQuickStashList';
import { ShowViewCommand } from './commands/showView';
import { StashApplyCommand } from './commands/stashApply';
import { StashDeleteCommand } from './commands/stashDelete';
import { StashSaveCommand } from './commands/stashSave';
@ -75,7 +75,7 @@ export * from './commands/openRepoInRemote';
export * from './commands/openWorkingFile';
export * from './commands/resetSuppressedWarnings';
export * from './commands/showCommitSearch';
export * from './commands/showExplorer';
export * from './commands/showView';
export * from './commands/showLastQuickPick';
export * from './commands/showQuickBranchHistory';
export * from './commands/showQuickCommitDetails';
@ -124,7 +124,7 @@ export function configureCommands(): void {
Container.context.subscriptions.push(new OpenWorkingFileCommand());
Container.context.subscriptions.push(new ResetSuppressedWarningsCommand());
Container.context.subscriptions.push(new ShowCommitSearchCommand());
Container.context.subscriptions.push(new ShowExplorerCommand());
Container.context.subscriptions.push(new ShowViewCommand());
Container.context.subscriptions.push(new ShowLastQuickPickCommand());
Container.context.subscriptions.push(new ShowQuickBranchHistoryCommand());
Container.context.subscriptions.push(new ShowQuickCommitDetailsCommand());

+ 27
- 27
src/commands/common.ts Näytä tiedosto

@ -19,7 +19,7 @@ import { GitBranch, GitCommit, GitFile, GitRemote, GitUri, Repository } from '..
import { Logger } from '../logger';
import { CommandQuickPickItem, RepositoriesQuickPick } from '../quickpicks';
// import { Telemetry } from '../telemetry';
import { ExplorerNode, ExplorerRefNode } from '../views/nodes';
import { ViewNode, ViewRefNode } from '../views/nodes';
export enum Commands {
ClearFileAnnotations = 'gitlens.clearFileAnnotations',
@ -42,8 +42,6 @@ export enum Commands {
DiffWithWorking = 'gitlens.diffWithWorking',
DiffLineWithWorking = 'gitlens.diffLineWithWorking',
ExternalDiff = 'gitlens.externalDiff',
ExplorersOpenDirectoryDiff = 'gitlens.explorers.openDirectoryDiff',
ExplorersOpenDirectoryDiffWithWorking = 'gitlens.explorers.openDirectoryDiffWithWorking',
OpenChangedFiles = 'gitlens.openChangedFiles',
OpenBranchesInRemote = 'gitlens.openBranchesInRemote',
OpenBranchInRemote = 'gitlens.openBranchInRemote',
@ -56,9 +54,9 @@ export enum Commands {
ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings',
ShowCommitInResults = 'gitlens.showCommitInResults',
ShowCommitSearch = 'gitlens.showCommitSearch',
ShowFileHistoryExplorer = 'gitlens.showFileHistoryExplorer',
ShowFileHistoryView = 'gitlens.showFileHistoryView',
ShowFileHistoryInResults = 'gitlens.showFileHistoryInResults',
ShowLineHistoryExplorer = 'gitlens.showLineHistoryExplorer',
ShowLineHistoryView = 'gitlens.showLineHistoryView',
ShowLastQuickPick = 'gitlens.showLastQuickPick',
ShowQuickBranchHistory = 'gitlens.showQuickBranchHistory',
ShowQuickCommitDetails = 'gitlens.showQuickCommitDetails',
@ -68,8 +66,8 @@ export enum Commands {
ShowQuickRepoStatus = 'gitlens.showQuickRepoStatus',
ShowQuickRevisionDetails = 'gitlens.showQuickRevisionDetails',
ShowQuickStashList = 'gitlens.showQuickStashList',
ShowRepositoriesExplorer = 'gitlens.showRepositoriesExplorer',
ShowResultsExplorer = 'gitlens.showResultsExplorer',
ShowRepositoriesView = 'gitlens.showRepositoriesView',
ShowResultsView = 'gitlens.showResultsView',
ShowSettingsPage = 'gitlens.showSettingsPage',
ShowWelcomePage = 'gitlens.showWelcomePage',
StashApply = 'gitlens.stashApply',
@ -82,7 +80,9 @@ export enum Commands {
ToggleFileRecentChanges = 'gitlens.toggleFileRecentChanges',
ToggleLineBlame = 'gitlens.toggleLineBlame',
ToggleReviewMode = 'gitlens.toggleReviewMode',
ToggleZenMode = 'gitlens.toggleZenMode'
ToggleZenMode = 'gitlens.toggleZenMode',
ViewsOpenDirectoryDiff = 'gitlens.views.openDirectoryDiff',
ViewsOpenDirectoryDiffWithWorking = 'gitlens.views.openDirectoryDiffWithWorking'
}
export function getCommandUri(uri?: Uri, editor?: TextEditor): Uri | undefined {
@ -181,40 +181,40 @@ export interface CommandViewContext extends CommandBaseContext {
export interface CommandViewItemContext extends CommandBaseContext {
type: 'viewItem';
node: ExplorerNode;
node: ViewNode;
}
export function isCommandViewContextWithBranch(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { branch: GitBranch } } {
): context is CommandViewItemContext & { node: ViewNode & { branch: GitBranch } } {
if (context.type !== 'viewItem') return false;
return (context.node as ExplorerNode & { branch: GitBranch }).branch instanceof GitBranch;
return (context.node as ViewNode & { branch: GitBranch }).branch instanceof GitBranch;
}
export function isCommandViewContextWithCommit<T extends GitCommit>(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { commit: T } } {
): context is CommandViewItemContext & { node: ViewNode & { commit: T } } {
if (context.type !== 'viewItem') return false;
return (context.node as ExplorerNode & { commit: GitCommit }).commit instanceof GitCommit;
return (context.node as ViewNode & { commit: GitCommit }).commit instanceof GitCommit;
}
export function isCommandViewContextWithFile(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { file: GitFile; repoPath: string } } {
): context is CommandViewItemContext & { node: ViewNode & { file: GitFile; repoPath: string } } {
if (context.type !== 'viewItem') return false;
const node = context.node as ExplorerNode & { file: GitFile; repoPath: string };
const node = context.node as ViewNode & { file: GitFile; repoPath: string };
return node.file !== undefined && (node.file.repoPath !== undefined || node.repoPath !== undefined);
}
export function isCommandViewContextWithFileCommit(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { commit: GitCommit; file: GitFile; repoPath: string } } {
): context is CommandViewItemContext & { node: ViewNode & { commit: GitCommit; file: GitFile; repoPath: string } } {
if (context.type !== 'viewItem') return false;
const node = context.node as ExplorerNode & { commit: GitCommit; file: GitFile; repoPath: string };
const node = context.node as ViewNode & { commit: GitCommit; file: GitFile; repoPath: string };
return (
node.file !== undefined &&
node.commit instanceof GitCommit &&
@ -225,11 +225,11 @@ export function isCommandViewContextWithFileCommit(
export function isCommandViewContextWithFileRefs(
context: CommandContext
): context is CommandViewItemContext & {
node: ExplorerNode & { file: GitFile; ref1: string; ref2: string; repoPath: string };
node: ViewNode & { file: GitFile; ref1: string; ref2: string; repoPath: string };
} {
if (context.type !== 'viewItem') return false;
const node = context.node as ExplorerNode & { file: GitFile; ref1: string; ref2: string; repoPath: string };
const node = context.node as ViewNode & { file: GitFile; ref1: string; ref2: string; repoPath: string };
return (
node.file !== undefined &&
node.ref1 !== undefined &&
@ -240,24 +240,24 @@ export function isCommandViewContextWithFileRefs(
export function isCommandViewContextWithRef(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { ref: string } } {
return context.type === 'viewItem' && context.node instanceof ExplorerRefNode;
): context is CommandViewItemContext & { node: ViewNode & { ref: string } } {
return context.type === 'viewItem' && context.node instanceof ViewRefNode;
}
export function isCommandViewContextWithRemote(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { remote: GitRemote } } {
): context is CommandViewItemContext & { node: ViewNode & { remote: GitRemote } } {
if (context.type !== 'viewItem') return false;
return (context.node as ExplorerNode & { remote: GitRemote }).remote instanceof GitRemote;
return (context.node as ViewNode & { remote: GitRemote }).remote instanceof GitRemote;
}
export function isCommandViewContextWithRepo(
context: CommandContext
): context is CommandViewItemContext & { node: ExplorerNode & { repo: Repository } } {
): context is CommandViewItemContext & { node: ViewNode & { repo: Repository } } {
if (context.type !== 'viewItem') return false;
return (context.node as ExplorerNode & { repo?: Repository }).repo instanceof Repository;
return (context.node as ViewNode & { repo?: Repository }).repo instanceof Repository;
}
export type CommandContext =
@ -362,8 +362,8 @@ export abstract class Command implements Disposable {
}
}
if (firstArg instanceof ExplorerNode) {
const [node, ...rest] = args as [ExplorerNode, any];
if (firstArg instanceof ViewNode) {
const [node, ...rest] = args as [ViewNode, any];
return [{ command: command, type: 'viewItem', node: node, uri: node.uri }, rest];
}

+ 1
- 1
src/commands/diffBranchWithBranch.ts Näytä tiedosto

@ -80,7 +80,7 @@ export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
if (args.ref1 === undefined) return undefined;
}
await Container.resultsExplorer.addComparison(repoPath, args.ref1, args.ref2);
await Container.resultsView.addComparison(repoPath, args.ref1, args.ref2);
return undefined;
}

+ 3
- 7
src/commands/diffDirectory.ts Näytä tiedosto

@ -22,23 +22,19 @@ export interface DiffDirectoryCommandArgs {
export class DiffDirectoryCommand extends ActiveEditorCommand {
constructor() {
super([
Commands.DiffDirectory,
Commands.ExplorersOpenDirectoryDiff,
Commands.ExplorersOpenDirectoryDiffWithWorking
]);
super([Commands.DiffDirectory, Commands.ViewsOpenDirectoryDiff, Commands.ViewsOpenDirectoryDiffWithWorking]);
}
protected async preExecute(context: CommandContext, args: DiffDirectoryCommandArgs = {}): Promise<any> {
switch (context.command) {
case Commands.ExplorersOpenDirectoryDiff:
case Commands.ViewsOpenDirectoryDiff:
if (context.type === 'viewItem' && context.node instanceof ResultsComparisonNode) {
args.ref1 = context.node.ref1.ref;
args.ref2 = context.node.ref2.ref;
}
break;
case Commands.ExplorersOpenDirectoryDiffWithWorking:
case Commands.ViewsOpenDirectoryDiffWithWorking:
if (isCommandViewContextWithRef(context)) {
args.ref1 = context.node.ref;
args.ref2 = undefined;

+ 2
- 2
src/commands/showCommitSearch.ts Näytä tiedosto

@ -142,7 +142,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
}
if (args.showInResults) {
Container.resultsExplorer.addSearchResults(
Container.resultsView.addSearchResults(
repoPath,
Container.git.getLogForSearch(repoPath, args.search!, args.searchBy!, {
maxCount: args.maxCount
@ -187,7 +187,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
[uri, { ...args, maxCount: 0, goBackCommand: goBackCommand }]
)
: undefined,
showInResultsExplorerCommand:
showInResultsCommand:
log !== undefined ? new ShowCommitsSearchInResultsQuickPickItem(log, searchLabel!) : undefined
});
if (pick === undefined) return undefined;

+ 0
- 33
src/commands/showExplorer.ts Näytä tiedosto

@ -1,33 +0,0 @@
'use strict';
import { Container } from '../container';
import { Command, CommandContext, Commands } from './common';
export class ShowExplorerCommand extends Command {
constructor() {
super([
Commands.ShowRepositoriesExplorer,
Commands.ShowFileHistoryExplorer,
Commands.ShowLineHistoryExplorer,
Commands.ShowResultsExplorer
]);
}
protected async preExecute(context: CommandContext): Promise<any> {
return this.execute(context.command as Commands);
}
execute(command: Commands) {
switch (command) {
case Commands.ShowRepositoriesExplorer:
return Container.repositoriesExplorer.show();
case Commands.ShowFileHistoryExplorer:
return Container.fileHistoryExplorer.show();
case Commands.ShowLineHistoryExplorer:
return Container.lineHistoryExplorer.show();
case Commands.ShowResultsExplorer:
return Container.resultsExplorer.show();
}
return undefined;
}
}

+ 1
- 1
src/commands/showQuickCommitDetails.ts Näytä tiedosto

@ -134,7 +134,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
}
if (args.showInResults) {
void (await Container.resultsExplorer.addCommit(args.commit as GitLogCommit));
void (await Container.resultsView.addCommit(args.commit as GitLogCommit));
return undefined;
}

+ 2
- 2
src/commands/showQuickFileHistory.ts Näytä tiedosto

@ -78,7 +78,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
}
if (args.showInResults) {
void (await Container.resultsExplorer.addSearchResults(gitUri.repoPath!, args.log, {
void (await Container.resultsView.addSearchResults(gitUri.repoPath!, args.log, {
label: placeHolder,
resultsType: { singular: 'commit', plural: 'commits' }
}));
@ -153,7 +153,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
[uri, { ...args, log: undefined, maxCount: 0 }]
)
: undefined,
showInResultsExplorerCommand:
showInResultsCommand:
args.log !== undefined
? new ShowCommitsInResultsQuickPickItem(args.log, {
label: placeHolder,

+ 33
- 0
src/commands/showView.ts Näytä tiedosto

@ -0,0 +1,33 @@
'use strict';
import { Container } from '../container';
import { Command, CommandContext, Commands } from './common';
export class ShowViewCommand extends Command {
constructor() {
super([
Commands.ShowRepositoriesView,
Commands.ShowFileHistoryView,
Commands.ShowLineHistoryView,
Commands.ShowResultsView
]);
}
protected async preExecute(context: CommandContext): Promise<any> {
return this.execute(context.command as Commands);
}
execute(command: Commands) {
switch (command) {
case Commands.ShowRepositoriesView:
return Container.repositoriesView.show();
case Commands.ShowFileHistoryView:
return Container.fileHistoryView.show();
case Commands.ShowLineHistoryView:
return Container.lineHistoryView.show();
case Commands.ShowResultsView:
return Container.resultsView.show();
}
return undefined;
}
}

+ 5
- 4
src/configuration.ts Näytä tiedosto

@ -42,11 +42,12 @@ export class Configuration {
`gitlens.${this.name('modes').value}`,
`gitlens.${this.name('codeLens').value}`,
`gitlens.${this.name('currentLine').value}`,
`gitlens.${this.name('fileHistoryExplorer').value}`,
`gitlens.${this.name('hovers').value}`,
`gitlens.${this.name('lineHistoryExplorer').value}`,
`gitlens.${this.name('repositoriesExplorer').value}`,
`gitlens.${this.name('statusBar').value}`
`gitlens.${this.name('statusBar').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}`
];
}

+ 11
- 11
src/constants.ts Näytä tiedosto

@ -31,18 +31,18 @@ export enum CommandContext {
AnnotationStatus = 'gitlens:annotationStatus',
CanToggleCodeLens = 'gitlens:canToggleCodeLens',
Enabled = 'gitlens:enabled',
ExplorersCanCompare = 'gitlens:explorers:canCompare',
HasRemotes = 'gitlens:hasRemotes',
FileHistoryExplorer = 'gitlens:fileHistoryExplorer',
FileHistoryExplorerEditorFollowing = 'gitlens:fileHistoryExplorer:editorFollowing',
LineHistoryExplorer = 'gitlens:lineHistoryExplorer',
LineHistoryExplorerEditorFollowing = 'gitlens:lineHistoryExplorer:editorFollowing',
Key = 'gitlens:key',
KeyMap = 'gitlens:keymap',
RepositoriesExplorer = 'gitlens:repositoriesExplorer',
RepositoriesExplorerAutoRefresh = 'gitlens:repositoriesExplorer:autoRefresh',
ResultsExplorer = 'gitlens:resultsExplorer',
ResultsExplorerKeepResults = 'gitlens:resultsExplorer:keepResults'
ViewsCanCompare = 'gitlens:views:canCompare',
ViewsFileHistory = 'gitlens:views:fileHistory',
ViewsFileHistoryEditorFollowing = 'gitlens:views:fileHistory:editorFollowing',
ViewsLineHistory = 'gitlens:views:lineHistory',
ViewsLineHistoryEditorFollowing = 'gitlens:views:lineHistory:editorFollowing',
ViewsRepositories = 'gitlens:views:repositories',
ViewsRepositoriesAutoRefresh = 'gitlens:views:repositories:autoRefresh',
ViewsResults = 'gitlens:views:results',
ViewsResultsKeepResults = 'gitlens:views:results:keepResults'
}
export function setCommandContext(key: CommandContext | string, value: any) {
@ -129,6 +129,6 @@ export const ImageMimetypes: { [key: string]: string } = {
};
export enum WorkspaceState {
RepositoriesExplorerAutoRefresh = 'gitlens:repositoriesExplorer:autoRefresh',
ResultsExplorerKeepResults = 'gitlens:resultsExplorer:keepResults'
ViewsRepositoriesAutoRefresh = 'gitlens:views:repositories:autoRefresh',
ViewsResultsKeepResults = 'gitlens:views:results:keepResults'
}

+ 55
- 49
src/container.ts Näytä tiedosto

@ -11,11 +11,11 @@ import { Keyboard } from './keyboard';
import { StatusBarController } from './statusbar/statusBarController';
import { GitDocumentTracker } from './trackers/gitDocumentTracker';
import { GitLineTracker } from './trackers/gitLineTracker';
import { ExplorerCommands } from './views/explorerCommands';
import { FileHistoryExplorer } from './views/fileHistoryExplorer';
import { LineHistoryExplorer } from './views/lineHistoryExplorer';
import { RepositoriesExplorer } from './views/repositoriesExplorer';
import { ResultsExplorer } from './views/resultsExplorer';
import { FileHistoryView } from './views/fileHistoryView';
import { LineHistoryView } from './views/lineHistoryView';
import { RepositoriesView } from './views/repositoriesView';
import { ResultsView } from './views/resultsView';
import { ViewCommands } from './views/viewCommands';
import { SettingsEditor } from './webviews/settingsEditor';
import { WelcomeEditor } from './webviews/welcomeEditor';
@ -40,41 +40,41 @@ export class Container {
context.subscriptions.push((this._settingsEditor = new SettingsEditor()));
context.subscriptions.push((this._welcomeEditor = new WelcomeEditor()));
if (config.repositoriesExplorer.enabled) {
context.subscriptions.push((this._repositoriesExplorer = new RepositoriesExplorer()));
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('repositoriesExplorer')('enabled').value)) {
if (configuration.changed(e, configuration.name('views')('repositories')('enabled').value)) {
disposable.dispose();
context.subscriptions.push((this._repositoriesExplorer = new RepositoriesExplorer()));
context.subscriptions.push((this._repositoriesView = new RepositoriesView()));
}
});
}
if (config.fileHistoryExplorer.enabled) {
context.subscriptions.push((this._fileHistoryExplorer = new FileHistoryExplorer()));
if (config.views.fileHistory.enabled) {
context.subscriptions.push((this._fileHistoryView = new FileHistoryView()));
}
else {
let disposable: Disposable;
disposable = configuration.onDidChange(e => {
if (configuration.changed(e, configuration.name('fileHistoryExplorer')('enabled').value)) {
if (configuration.changed(e, configuration.name('views')('fileHistory')('enabled').value)) {
disposable.dispose();
context.subscriptions.push((this._fileHistoryExplorer = new FileHistoryExplorer()));
context.subscriptions.push((this._fileHistoryView = new FileHistoryView()));
}
});
}
if (config.lineHistoryExplorer.enabled) {
context.subscriptions.push((this._lineHistoryExplorer = new LineHistoryExplorer()));
if (config.views.lineHistory.enabled) {
context.subscriptions.push((this._lineHistoryView = new LineHistoryView()));
}
else {
let disposable: Disposable;
disposable = configuration.onDidChange(e => {
if (configuration.changed(e, configuration.name('lineHistoryExplorer')('enabled').value)) {
if (configuration.changed(e, configuration.name('views')('lineHistory')('enabled').value)) {
disposable.dispose();
context.subscriptions.push((this._lineHistoryExplorer = new LineHistoryExplorer()));
context.subscriptions.push((this._lineHistoryView = new LineHistoryView()));
}
});
}
@ -100,26 +100,18 @@ export class Container {
return this._context;
}
private static _explorerCommands: ExplorerCommands | undefined;
static get explorerCommands() {
if (this._explorerCommands === undefined) {
this._context.subscriptions.push((this._explorerCommands = new ExplorerCommands()));
}
return this._explorerCommands;
}
private static _fileAnnotationController: FileAnnotationController;
static get fileAnnotations() {
return this._fileAnnotationController;
}
private static _fileHistoryExplorer: FileHistoryExplorer | undefined;
static get fileHistoryExplorer() {
if (this._fileHistoryExplorer === undefined) {
this._context.subscriptions.push((this._fileHistoryExplorer = new FileHistoryExplorer()));
private static _fileHistoryView: FileHistoryView | undefined;
static get fileHistoryView() {
if (this._fileHistoryView === undefined) {
this._context.subscriptions.push((this._fileHistoryView = new FileHistoryView()));
}
return this._fileHistoryExplorer;
return this._fileHistoryView;
}
private static _git: GitService;
@ -127,9 +119,9 @@ export class Container {
return this._git;
}
private static _repositoriesExplorer: RepositoriesExplorer | undefined;
static get repositoriesExplorer(): RepositoriesExplorer {
return this._repositoriesExplorer!;
private static _repositoriesView: RepositoriesView | undefined;
static get repositoriesView(): RepositoriesView {
return this._repositoriesView!;
}
private static _keyboard: Keyboard;
@ -142,13 +134,13 @@ export class Container {
return this._lineAnnotationController;
}
private static _lineHistoryExplorer: LineHistoryExplorer | undefined;
static get lineHistoryExplorer() {
if (this._lineHistoryExplorer === undefined) {
this._context.subscriptions.push((this._lineHistoryExplorer = new LineHistoryExplorer()));
private static _lineHistoryView: LineHistoryView | undefined;
static get lineHistoryView() {
if (this._lineHistoryView === undefined) {
this._context.subscriptions.push((this._lineHistoryView = new LineHistoryView()));
}
return this._lineHistoryExplorer;
return this._lineHistoryView;
}
private static _lineHoverController: LineHoverController;
@ -161,13 +153,13 @@ export class Container {
return this._lineTracker;
}
private static _resultsExplorer: ResultsExplorer | undefined;
static get resultsExplorer() {
if (this._resultsExplorer === undefined) {
this._context.subscriptions.push((this._resultsExplorer = new ResultsExplorer()));
private static _resultsView: ResultsView | undefined;
static get resultsView() {
if (this._resultsView === undefined) {
this._context.subscriptions.push((this._resultsView = new ResultsView()));
}
return this._resultsExplorer;
return this._resultsView;
}
private static _settingsEditor: SettingsEditor;
@ -185,6 +177,14 @@ export class Container {
return this._tracker;
}
private static _viewCommands: ViewCommands | undefined;
static get viewCommands() {
if (this._viewCommands === undefined) {
this._context.subscriptions.push((this._viewCommands = new ViewCommands()));
}
return this._viewCommands;
}
private static _welcomeEditor: WelcomeEditor;
static get welcomeEditor() {
return this._welcomeEditor;
@ -206,18 +206,24 @@ export class Container {
if (mode.currentLine != null) {
config.currentLine.enabled = mode.currentLine;
}
if (mode.explorers != null) {
config.repositoriesExplorer.enabled = mode.explorers;
}
if (mode.explorers != null) {
config.fileHistoryExplorer.enabled = mode.explorers;
}
if (mode.hovers != null) {
config.hovers.enabled = mode.hovers;
}
if (mode.statusBar != null) {
config.statusBar.enabled = mode.statusBar;
}
if (mode.views != null) {
config.views.fileHistory.enabled = mode.views;
}
if (mode.views != null) {
config.views.lineHistory.enabled = mode.views;
}
if (mode.views != null) {
config.views.repositories.enabled = mode.views;
}
// if (mode.views != null) {
// config.views.results.enabled = mode.views;
// }
return config;
}

+ 83
- 22
src/extension.ts Näytä tiedosto

@ -9,6 +9,7 @@ import { GitService } from './git/gitService';
import { Logger } from './logger';
import { Messages } from './messages';
import { Strings, Versions } from './system';
import { ModeConfig } from './ui/config';
// import { Telemetry } from './telemetry';
export async function activate(context: ExtensionContext) {
@ -33,20 +34,20 @@ export async function activate(context: ExtensionContext) {
const cfg = configuration.get<Config>();
// Pretend we are enabled (until we know otherwise) and set the explorer contexts to reduce flashing on load
// Pretend we are enabled (until we know otherwise) and set the view contexts to reduce flashing on load
await Promise.all([
setCommandContext(CommandContext.Enabled, true),
setCommandContext(
CommandContext.RepositoriesExplorer,
cfg.repositoriesExplorer.enabled ? cfg.repositoriesExplorer.location : false
CommandContext.ViewsRepositories,
cfg.views.repositories.enabled ? cfg.views.repositories.location : false
),
setCommandContext(
CommandContext.FileHistoryExplorer,
cfg.fileHistoryExplorer.enabled ? cfg.fileHistoryExplorer.location : false
CommandContext.ViewsFileHistory,
cfg.views.fileHistory.enabled ? cfg.views.fileHistory.location : false
),
setCommandContext(
CommandContext.LineHistoryExplorer,
cfg.lineHistoryExplorer.enabled ? cfg.lineHistoryExplorer.location : false
CommandContext.ViewsLineHistory,
cfg.views.lineHistory.enabled ? cfg.views.lineHistory.location : false
)
]);
@ -105,66 +106,126 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
if (Versions.compare(previous, Versions.from(9, 0, 0)) !== 1) {
await configuration.migrate(
'gitExplorer.autoRefresh',
configuration.name('repositoriesExplorer')('autoRefresh').value
configuration.name('views')('repositories')('autoRefresh').value
);
await configuration.migrate(
'gitExplorer.branches.layout',
configuration.name('repositoriesExplorer')('branches')('layout').value
configuration.name('views')('repositories')('branches')('layout').value
);
await configuration.migrate(
'gitExplorer.enabled',
configuration.name('repositoriesExplorer')('enabled').value
configuration.name('views')('repositories')('enabled').value
);
await configuration.migrate(
'gitExplorer.files.compact',
configuration.name('repositoriesExplorer')('files')('compact').value
configuration.name('views')('repositories')('files')('compact').value
);
await configuration.migrate(
'gitExplorer.files.layout',
configuration.name('repositoriesExplorer')('files')('layout').value
configuration.name('views')('repositories')('files')('layout').value
);
await configuration.migrate(
'gitExplorer.files.threshold',
configuration.name('repositoriesExplorer')('files')('threshold').value
configuration.name('views')('repositories')('files')('threshold').value
);
await configuration.migrate(
'gitExplorer.includeWorkingTree',
configuration.name('repositoriesExplorer')('includeWorkingTree').value
configuration.name('views')('repositories')('includeWorkingTree').value
);
await configuration.migrate(
'gitExplorer.location',
configuration.name('repositoriesExplorer')('location').value
configuration.name('views')('repositories')('location').value
);
await configuration.migrate(
'gitExplorer.showTrackingBranch',
configuration.name('repositoriesExplorer')('showTrackingBranch').value
configuration.name('views')('repositories')('showTrackingBranch').value
);
await configuration.migrate(
'historyExplorer.avatars',
configuration.name('fileHistoryExplorer')('avatars').value
configuration.name('views')('fileHistory')('avatars').value
);
await configuration.migrate(
'historyExplorer.enabled',
configuration.name('fileHistoryExplorer')('enabled').value
configuration.name('views')('fileHistory')('enabled').value
);
await configuration.migrate(
'historyExplorer.location',
configuration.name('fileHistoryExplorer')('location').value
configuration.name('views')('fileHistory')('location').value
);
await configuration.migrate(
'historyExplorer.avatars',
configuration.name('lineHistoryExplorer')('avatars').value
configuration.name('views')('lineHistory')('avatars').value
);
await configuration.migrate(
'historyExplorer.enabled',
configuration.name('lineHistoryExplorer')('enabled').value
configuration.name('views')('lineHistory')('enabled').value
);
await configuration.migrate(
'historyExplorer.location',
configuration.name('lineHistoryExplorer')('location').value
configuration.name('views')('lineHistory')('location').value
);
await configuration.migrate('explorers.avatars', configuration.name('views')('avatars').value);
await configuration.migrate(
'explorers.commitFileFormat',
configuration.name('views')('commitFileFormat').value
);
await configuration.migrate('explorers.commitFormat', configuration.name('views')('commitFormat').value);
await configuration.migrate(
'explorers.defaultItemLimit',
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
);
await configuration.migrate('explorers.stashFormat', configuration.name('views')('stashFormat').value);
await configuration.migrate(
'explorers.statusFileFormat',
configuration.name('views')('statusFileFormat').value
);
await configuration.migrate<
{
[key: string]: {
name: string;
statusBarItemName?: string;
description?: string;
codeLens?: boolean;
currentLine?: boolean;
explorers?: boolean;
hovers?: boolean;
statusBar?: boolean;
};
},
{
[key: string]: ModeConfig;
}
>('modes', configuration.name('modes').value, {
migrationFn: v => {
const modes = Object.create(null);
for (const k in v) {
const { explorers, ...mode } = v[k];
modes[k] = { ...mode, views: explorers };
}
return modes;
}
});
// await configuration.migrate('modes', configuration.name('modes')('').value);
}
}
catch (ex) {

+ 3
- 3
src/quickpicks/commitsQuickPick.ts Näytä tiedosto

@ -28,15 +28,15 @@ export class CommitsQuickPick {
options: {
goBackCommand?: CommandQuickPickItem;
showAllCommand?: CommandQuickPickItem;
showInResultsExplorerCommand?: CommandQuickPickItem;
showInResultsCommand?: 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.showInResultsExplorerCommand !== undefined) {
items.splice(0, 0, options.showInResultsExplorerCommand);
if (options.showInResultsCommand !== undefined) {
items.splice(0, 0, options.showInResultsCommand);
}
if (options.showAllCommand !== undefined) {

+ 5
- 5
src/quickpicks/commonQuickPicks.ts Näytä tiedosto

@ -238,7 +238,7 @@ export class ShowCommitInResultsQuickPickItem extends CommandQuickPickItem {
public readonly commit: GitLogCommit,
item: QuickPickItem = {
label: 'Show in Results',
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} displays commit in the GitLens Results explorer`
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} displays commit in the GitLens Results view`
}
) {
super(item, undefined, undefined);
@ -247,7 +247,7 @@ export class ShowCommitInResultsQuickPickItem extends CommandQuickPickItem {
async execute(
options: TextDocumentShowOptions = { preserveFocus: false, preview: false }
): Promise<{} | undefined> {
await Container.resultsExplorer.addCommit(this.commit);
await Container.resultsView.addCommit(this.commit);
return undefined;
}
}
@ -258,7 +258,7 @@ export class ShowCommitsInResultsQuickPickItem extends CommandQuickPickItem {
public readonly resultsLabel: string | { label: string; resultsType?: { singular: string; plural: string } },
item: QuickPickItem = {
label: 'Show in Results',
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} displays commits in the GitLens Results explorer`
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} displays commits in the GitLens Results view`
}
) {
super(item, undefined, undefined);
@ -267,7 +267,7 @@ export class ShowCommitsInResultsQuickPickItem extends CommandQuickPickItem {
async execute(
options: TextDocumentShowOptions = { preserveFocus: false, preview: false }
): Promise<{} | undefined> {
await Container.resultsExplorer.addSearchResults(this.results.repoPath, this.results, this.resultsLabel);
await Container.resultsView.addSearchResults(this.results.repoPath, this.results, this.resultsLabel);
return undefined;
}
}
@ -278,7 +278,7 @@ export class ShowCommitsSearchInResultsQuickPickItem extends ShowCommitsInResult
public readonly search: string,
item: QuickPickItem = {
label: 'Show in Results',
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} displays results in the GitLens Results explorer`
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} displays results in the GitLens Results view`
}
) {
super(results, { label: search }, item);

+ 3
- 3
src/quickpicks/fileHistoryQuickPick.ts Näytä tiedosto

@ -37,7 +37,7 @@ export class FileHistoryQuickPick {
pickerOnly?: boolean;
progressCancellation?: CancellationTokenSource;
showAllCommand?: CommandQuickPickItem;
showInResultsExplorerCommand?: CommandQuickPickItem;
showInResultsCommand?: CommandQuickPickItem;
} = {}
): Promise<CommitQuickPickItem | CommandQuickPickItem | undefined> {
options = { pickerOnly: false, ...options };
@ -55,9 +55,9 @@ export class FileHistoryQuickPick {
new ChooseFromBranchesAndTagsQuickPickItem(log.repoPath, placeHolder, options.currentCommand)
);
if (options.showInResultsExplorerCommand !== undefined) {
if (options.showInResultsCommand !== undefined) {
index++;
items.splice(0, 0, options.showInResultsExplorerCommand);
items.splice(0, 0, options.showInResultsCommand);
}
if (log.truncated || log.sha) {

+ 19
- 19
src/ui/config.ts Näytä tiedosto

@ -39,12 +39,12 @@ export enum DateStyle {
Relative = 'relative'
}
export enum ExplorerBranchesLayout {
export enum ViewBranchesLayout {
List = 'list',
Tree = 'tree'
}
export enum ExplorerFilesLayout {
export enum ViewFilesLayout {
Auto = 'auto',
List = 'list',
Tree = 'tree'
@ -140,10 +140,11 @@ export interface CodeLensConfig {
symbolScopes: string[];
}
export interface ExplorersConfig {
export interface ViewsConfig {
avatars: boolean;
fileHistory: FileHistoryViewConfig;
files: {
layout: ExplorerFilesLayout;
layout: ViewFilesLayout;
compact: boolean;
threshold: number;
};
@ -151,24 +152,27 @@ export interface ExplorersConfig {
commitFormat: string;
// dateFormat: string | null;
defaultItemLimit: number;
lineHistory: LineHistoryViewConfig;
repositories: RepositoriesViewConfig;
results: ResultsViewConfig;
stashFileFormat: string;
stashFormat: string;
statusFileFormat: string;
}
export interface ExplorersFilesConfig {
export interface ViewsFilesConfig {
compact: boolean;
layout: ExplorerFilesLayout;
layout: ViewFilesLayout;
threshold: number;
}
export interface FileHistoryExplorerConfig {
export interface FileHistoryViewConfig {
avatars: boolean;
enabled: boolean;
location: 'explorer' | 'gitlens' | 'scm';
}
export interface LineHistoryExplorerConfig extends FileHistoryExplorerConfig {}
export interface LineHistoryViewConfig extends FileHistoryViewConfig {}
export interface MenuConfig {
editor:
@ -209,26 +213,26 @@ export interface ModeConfig {
description?: string;
codeLens?: boolean;
currentLine?: boolean;
explorers?: boolean;
hovers?: boolean;
statusBar?: boolean;
views?: boolean;
}
export interface RepositoriesExplorerConfig {
export interface RepositoriesViewConfig {
autoRefresh: boolean;
autoReveal: boolean;
branches: {
layout: ExplorerBranchesLayout;
layout: ViewBranchesLayout;
};
enabled: boolean;
files: ExplorersFilesConfig;
files: ViewsFilesConfig;
includeWorkingTree: boolean;
location: 'explorer' | 'gitlens' | 'scm';
showTrackingBranch: boolean;
}
export interface ResultsExplorerConfig {
files: ExplorersFilesConfig;
export interface ResultsViewConfig {
files: ViewsFilesConfig;
location: 'explorer' | 'gitlens' | 'scm';
}
@ -281,14 +285,12 @@ export interface Config {
defaultDateFormat: string | null;
defaultDateStyle: DateStyle;
defaultGravatarsStyle: GravatarDefaultStyle;
explorers: ExplorersConfig;
heatmap: {
ageThreshold: number;
coldColor: string;
hotColor: string;
toggleMode: AnnotationsToggleMode;
};
fileHistoryExplorer: FileHistoryExplorerConfig;
hovers: {
annotations: {
changes: boolean;
@ -307,7 +309,6 @@ export interface Config {
};
insiders: boolean;
keymap: KeyMap;
lineHistoryExplorer: LineHistoryExplorerConfig;
menus: boolean | MenuConfig;
mode: {
active: string;
@ -325,8 +326,6 @@ export interface Config {
toggleMode: AnnotationsToggleMode;
};
remotes: RemotesConfig[];
repositoriesExplorer: RepositoriesExplorerConfig;
resultsExplorer: ResultsExplorerConfig;
showWhatsNewAfterUpgrades: boolean;
statusBar: {
alignment: 'left' | 'right';
@ -345,5 +344,6 @@ export interface Config {
};
};
};
views: ViewsConfig;
advanced: AdvancedConfig;
}

+ 87
- 87
src/ui/settings/index.html Näytä tiedosto

@ -291,28 +291,28 @@
</div>
</section>
<section id="repositories-explorer">
<section id="repositories-view">
<div class="section__header">
<h2 class="section__title">Repositories Explorer
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#repositories-explorer">
<h2 class="section__title">Repositories view
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#repositories-view">
<i class="icon icon__info"></i>
</a>
</h2>
<p class="section__title-hint">
Adds a Repositories explorer to visualize, navigate, and explore Git repositories
Adds a Repositories view to visualize, navigate, and explore Git repositories
</p>
</div>
<div class="section__settings">
<div class="settings-group">
<div class="settings-group__setting nowrap">
<input class="setting" id="repositoriesExplorer.enabled" name="repositoriesExplorer.enabled"
<input class="setting" id="repositoriesView.enabled" name="repositoriesView.enabled"
type="checkbox" />
<label for="repositoriesExplorer.enabled">Show the Repositories explorer</label>
<label for="repositoriesView.enabled">Show the Repositories view</label>
</div>
<div class="settings-group__setting ml-2" data-enablement="repositoriesExplorer.enabled">
<label for="repositoriesExplorer.location">Show in the</label>
<select class="setting" id="repositoriesExplorer.location" name="repositoriesExplorer.location"
<div class="settings-group__setting ml-2" data-enablement="repositoriesView.enabled">
<label for="repositoriesView.location">Show in the</label>
<select class="setting" id="repositoriesView.location" name="repositoriesView.location"
disabled>
<option value="gitlens">GitLens view</option>
<option value="explorer">Explorer view</option>
@ -320,74 +320,74 @@
</select>
</div>
<div class="settings-group__setting ml-2 hidden" data-enablement="repositoriesExplorer.enabled"
<div class="settings-group__setting ml-2 hidden" data-enablement="repositoriesView.enabled"
data-visibility="settings.mode =advanced">
<label for="repositoriesExplorer.branches.layout">Layout branches</label>
<select class="setting" id="repositoriesExplorer.branches.layout" name="repositoriesExplorer.branches.layout"
<label for="repositoriesView.branches.layout">Layout branches</label>
<select class="setting" id="repositoriesView.branches.layout" name="repositoriesView.branches.layout"
disabled>
<option value="list">as a list</option>
<option value="tree">as a tree</option>
</select>
</div>
<div class="settings-group__setting ml-2 hidden" data-enablement="repositoriesExplorer.enabled"
<div class="settings-group__setting ml-2 hidden" data-enablement="repositoriesView.enabled"
data-visibility="settings.mode =advanced">
<label for="repositoriesExplorer.files.layout">Layout files</label>
<select class="setting" id="repositoriesExplorer.files.layout" name="repositoriesExplorer.files.layout"
<label for="repositoriesView.files.layout">Layout files</label>
<select class="setting" id="repositoriesView.files.layout" name="repositoriesView.files.layout"
disabled>
<option value="auto">automatically</option>
<option value="list">as a list</option>
<option value="tree">as a tree</option>
</select>
</div>
<p class="setting__hint ml-3 hidden" data-visibility="repositoriesExplorer.files.layout =auto &amp; settings.mode =advanced">
<p class="setting__hint ml-3 hidden" data-visibility="repositoriesView.files.layout =auto &amp; settings.mode =advanced">
Chooses the best layout based on the number of files at each nesting level
</p>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesExplorer.enabled"
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesView.enabled"
data-visibility="settings.mode =advanced">
<input class="setting" id="repositoriesExplorer.files.compact" name="repositoriesExplorer.files.compact"
<input class="setting" id="repositoriesView.files.compact" name="repositoriesView.files.compact"
type="checkbox" disabled />
<label for="repositoriesExplorer.files.compact">Use compact layout</label>
<label for="repositoriesView.files.compact">Use compact layout</label>
</div>
<p class="setting__hint ml-3 hidden" data-visibility="settings.mode =advanced">
Compacts (flattens) unnecessary nesting when using a tree layouts
</p>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesExplorer.enabled"
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesView.enabled"
data-visibility="settings.mode =advanced">
<input class="setting" id="repositoriesExplorer.avatars" name="explorers.avatars"
type="checkbox" disabled />
<label for="repositoriesExplorer.avatars">Use author avatars icons</label>
<input class="setting" id="repositoriesView.avatars" name="views.avatars" type="checkbox"
disabled />
<label for="repositoriesView.avatars">Use author avatars icons</label>
</div>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesExplorer.enabled"
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesView.enabled"
data-visibility="settings.mode =advanced">
<input class="setting" id="repositoriesExplorer.autoRefresh" name="repositoriesExplorer.autoRefresh"
<input class="setting" id="repositoriesView.autoRefresh" name="repositoriesView.autoRefresh"
type="checkbox" disabled />
<label for="repositoriesExplorer.autoRefresh">
<label for="repositoriesView.autoRefresh">
Automatically refreshes when the file system or any repository changes
</label>
</div>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesExplorer.enabled"
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="repositoriesView.enabled"
data-visibility="settings.mode =advanced">
<input class="setting" id="repositoriesExplorer.autoReveal" name="repositoriesExplorer.autoReveal"
<input class="setting" id="repositoriesView.autoReveal" name="repositoriesView.autoReveal"
type="checkbox" disabled />
<label for="repositoriesExplorer.autoReveal">
<label for="repositoriesView.autoReveal">
Automatically reveal repositories when opening files
</label>
</div>
</div>
<div class="section__preview">
<img class="image__preview hidden" src="{{root}}/images/settings/repositories-explorer.png"
data-visibility="repositoriesExplorer.enabled &amp; repositoriesExplorer.files.layout !tree" />
data-visibility="repositoriesView.enabled &amp; repositoriesView.files.layout !tree" />
<img class="image__preview hidden" src="{{root}}/images/settings/repositories-explorer-tree-compact.png"
data-visibility="repositoriesExplorer.enabled &amp; repositoriesExplorer.files.layout =tree &amp; repositoriesExplorer.files.compact" />
data-visibility="repositoriesView.enabled &amp; repositoriesView.files.layout =tree &amp; repositoriesView.files.compact" />
<img class="image__preview hidden" src="{{root}}/images/settings/repositories-explorer-tree.png"
data-visibility="repositoriesExplorer.enabled &amp; repositoriesExplorer.files.layout =tree &amp; repositoriesExplorer.files.compact =false" />
data-visibility="repositoriesView.enabled &amp; repositoriesView.files.layout =tree &amp; repositoriesView.files.compact =false" />
<img class="image__preview--overlay hidden" src="{{root}}/images/settings/repositories-explorer-avatars.png"
data-visibility="repositoriesExplorer.enabled &amp; explorers.avatars" />
data-visibility="repositoriesView.enabled &amp; views.avatars" />
</div>
<p class="settings-group__hint">
<i class="icon icon--lg icon__info"></i>
@ -395,34 +395,34 @@
<a class="command" title="Open User Settings" href="command:workbench.action.openGlobalSettings">
User Settings
</a>
and search for <b><i>gitlens.repositoriesExplorer</i></b> or <b><i>gitlens.explorers</i></b>
and search for <b><i>gitlens.views.repositories</i></b> or <b><i>gitlens.views</i></b>
</p>
</div>
</section>
<section id="file-history-explorer">
<section id="file-history-view">
<div class="section__header">
<h2 class="section__title">File History Explorer
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#file-history-explorer">
<h2 class="section__title">File History view
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#file-history-view">
<i class="icon icon__info"></i>
</a>
</h2>
<p class="section__title-hint">
Adds a File History explorer to visualize, navigate, and explore the revision history
Adds a File History view to visualize, navigate, and explore the revision history
of the current file
</p>
</div>
<div class="section__settings">
<div class="settings-group">
<div class="settings-group__setting nowrap">
<input class="setting" id="fileHistoryExplorer.enabled" name="fileHistoryExplorer.enabled"
<input class="setting" id="fileHistoryView.enabled" name="fileHistoryView.enabled"
type="checkbox" />
<label for="fileHistoryExplorer.enabled">Show the File History explorer</label>
<label for="fileHistoryView.enabled">Show the File History view</label>
</div>
<div class="settings-group__setting ml-2" data-enablement="fileHistoryExplorer.enabled">
<label for="fileHistoryExplorer.location">Show in the</label>
<select class="setting" id="fileHistoryExplorer.location" name="fileHistoryExplorer.location"
<div class="settings-group__setting ml-2" data-enablement="fileHistoryView.enabled">
<label for="fileHistoryView.location">Show in the</label>
<select class="setting" id="fileHistoryView.location" name="fileHistoryView.location"
disabled>
<option value="gitlens">GitLens view</option>
<option value="explorer">Explorer view</option>
@ -430,45 +430,45 @@
</select>
</div>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="fileHistoryExplorer.enabled"
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="fileHistoryView.enabled"
data-visibility="settings.mode =advanced">
<input class="setting" id="fileHistoryExplorer.avatars" name="fileHistoryExplorer.avatars"
<input class="setting" id="fileHistoryView.avatars" name="fileHistoryView.avatars"
type="checkbox" disabled />
<label for="fileHistoryExplorer.avatars">Use author avatars icons</label>
<label for="fileHistoryView.avatars">Use author avatars icons</label>
</div>
</div>
<div class="section__preview">
<img class="image__preview hidden" src="{{root}}/images/settings/file-history-explorer.png"
data-visibility="fileHistoryExplorer.enabled" />
data-visibility="fileHistoryView.enabled" />
<img class="image__preview--overlay hidden" src="{{root}}/images/settings/file-history-explorer-avatars.png"
data-visibility="fileHistoryExplorer.enabled &amp; fileHistoryExplorer.avatars" />
data-visibility="fileHistoryView.enabled &amp; fileHistoryView.avatars" />
</div>
</div>
</section>
<section id="line-history-explorer">
<section id="line-history-view">
<div class="section__header">
<h2 class="section__title">Line History Explorer
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#line-history-explorer">
<h2 class="section__title">Line History view
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#line-history-view">
<i class="icon icon__info"></i>
</a>
</h2>
<p class="section__title-hint">
Adds a Line History explorer to visualize, navigate, and explore the revision history
Adds a Line History view to visualize, navigate, and explore the revision history
of the selected lines of current file
</p>
</div>
<div class="section__settings">
<div class="settings-group">
<div class="settings-group__setting nowrap">
<input class="setting" id="lineHistoryExplorer.enabled" name="lineHistoryExplorer.enabled"
<input class="setting" id="lineHistoryView.enabled" name="lineHistoryView.enabled"
type="checkbox" />
<label for="lineHistoryExplorer.enabled">Show the Line History explorer</label>
<label for="lineHistoryView.enabled">Show the Line History view</label>
</div>
<div class="settings-group__setting ml-2" data-enablement="lineHistoryExplorer.enabled">
<label for="lineHistoryExplorer.location">Show in the</label>
<select class="setting" id="lineHistoryExplorer.location" name="lineHistoryExplorer.location"
<div class="settings-group__setting ml-2" data-enablement="lineHistoryView.enabled">
<label for="lineHistoryView.location">Show in the</label>
<select class="setting" id="lineHistoryView.location" name="lineHistoryView.location"
disabled>
<option value="gitlens">GitLens view</option>
<option value="explorer">Explorer view</option>
@ -476,39 +476,39 @@
</select>
</div>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="lineHistoryExplorer.enabled"
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="lineHistoryView.enabled"
data-visibility="settings.mode =advanced">
<input class="setting" id="lineHistoryExplorer.avatars" name="lineHistoryExplorer.avatars"
<input class="setting" id="lineHistoryView.avatars" name="lineHistoryView.avatars"
type="checkbox" disabled />
<label for="lineHistoryExplorer.avatars">Use author avatars icons</label>
<label for="lineHistoryView.avatars">Use author avatars icons</label>
</div>
</div>
<div class="section__preview">
<img class="image__preview hidden" src="{{root}}/images/settings/line-history-explorer.png"
data-visibility="lineHistoryExplorer.enabled" />
data-visibility="lineHistoryView.enabled" />
<img class="image__preview--overlay hidden" src="{{root}}/images/settings/line-history-explorer-avatars.png"
data-visibility="lineHistoryExplorer.enabled &amp; lineHistoryExplorer.avatars" />
data-visibility="lineHistoryView.enabled &amp; lineHistoryView.avatars" />
</div>
</div>
</section>
<section id="results-explorer">
<section id="results-view">
<div class="section__header">
<h2 class="section__title">Results Explorer
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#results-explorer">
<h2 class="section__title">Results view
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#results-view">
<i class="icon icon__info"></i>
</a>
</h2>
<p class="section__title-hint">
Adds an on-demand Results explorer to navigate and explore commits, histories, and
Adds an on-demand Results view to navigate and explore commits, histories, and
searches, or visualize comparisons between branches, tags, commits, and more
</p>
</div>
<div class="section__settings">
<div class="settings-group">
<div class="settings-group__setting">
<label for="resultsExplorer.location">Show in the</label>
<select class="setting" id="resultsExplorer.location" name="resultsExplorer.location">
<label for="resultsView.location">Show in the</label>
<select class="setting" id="resultsView.location" name="resultsView.location">
<option value="gitlens">GitLens view</option>
<option value="explorer">Explorer view</option>
<option value="scm">Source Control view</option>
@ -516,8 +516,8 @@
</div>
<div class="settings-group__setting hidden" data-visibility="settings.mode =advanced">
<label for="resultsExplorer.files.layout">Layout files</label>
<select class="setting" id="resultsExplorer.files.layout" name="resultsExplorer.files.layout">
<label for="resultsView.files.layout">Layout files</label>
<select class="setting" id="resultsView.files.layout" name="resultsView.files.layout">
<option value="auto">automatically</option>
<option value="list">as a list</option>
<option value="tree">as a tree</option>
@ -525,29 +525,29 @@
</div>
<div class="settings-group__setting nowrap hidden" data-visibility="settings.mode =advanced">
<input class="setting" id="resultsExplorer.files.compact" name="resultsExplorer.files.compact"
<input class="setting" id="resultsView.files.compact" name="resultsView.files.compact"
type="checkbox" />
<label for="resultsExplorer.files.compact">Use compact layout</label>
<label for="resultsView.files.compact">Use compact layout</label>
</div>
<p class="setting__hint hidden" data-visibility="settings.mode =advanced">
Compacts (flattens) unnecessary nesting when using a tree layouts
</p>
<div class="settings-group__setting nowrap hidden" data-visibility="settings.mode =advanced">
<input class="setting" id="resultsExplorer.avatars" name="explorers.avatars" type="checkbox" />
<label for="resultsExplorer.avatars">Use author avatars icons</label>
<input class="setting" id="resultsView.avatars" name="views.avatars" type="checkbox" />
<label for="resultsView.avatars">Use author avatars icons</label>
</div>
</div>
<div class="section__preview">
<img class="image__preview hidden" src="{{root}}/images/settings/results-explorer.png"
data-visibility="resultsExplorer.files.layout !tree" />
data-visibility="resultsView.files.layout !tree" />
<img class="image__preview hidden" src="{{root}}/images/settings/results-explorer-tree-compact.png"
data-visibility="resultsExplorer.files.layout =tree &amp; resultsExplorer.files.compact" />
data-visibility="resultsView.files.layout =tree &amp; resultsView.files.compact" />
<img class="image__preview hidden" src="{{root}}/images/settings/results-explorer-tree.png"
data-visibility="resultsExplorer.files.layout =tree &amp; resultsExplorer.files.compact =false" />
data-visibility="resultsView.files.layout =tree &amp; resultsView.files.compact =false" />
<img class="image__preview--overlay hidden" src="{{root}}/images/settings/results-explorer-avatars.png"
data-visibility="explorers.avatars" />
data-visibility="views.avatars" />
</div>
<p class="settings-group__hint">
<i class="icon icon--lg icon__info"></i>
@ -555,7 +555,7 @@
<a class="command" title="Open User Settings" href="command:workbench.action.openGlobalSettings">
User Settings
</a>
and search for <b><i>gitlens.resultsExplorer</i></b> or <b><i>gitlens.explorers</i></b>
and search for <b><i>gitlens.views.results</i></b> or <b><i>gitlens.views</i></b>
</p>
</div>
</section>
@ -1603,23 +1603,23 @@
<a class="jump-to" href="#general" title="Jump to General settings">General</a>
</li>
<li>
<a class="jump-to" href="#repositories-explorer" title="Jump to Repositories Explorer settings">
Repositories Explorer
<a class="jump-to" href="#repositories-view" title="Jump to Repositories view settings">
Repositories view
</a>
</li>
<li>
<a class="jump-to" href="#file-history-explorer" title="Jump to File History Explorer settings">
File History Explorer
<a class="jump-to" href="#file-history-view" title="Jump to File History view settings">
File History view
</a>
</li>
<li>
<a class="jump-to" href="#file-history-explorer" title="Jump to Line History Explorer settings">
Line History Explorer
<a class="jump-to" href="#file-history-view" title="Jump to Line History view settings">
Line History view
</a>
</li>
<li>
<a class="jump-to" href="#results-explorer" title="Jump to Results Explorer settings">
Results Explorer
<a class="jump-to" href="#results-view" title="Jump to Results view settings">
Results view
</a>
</li>
<li>

+ 8
- 8
src/ui/welcome/index.html Näytä tiedosto

@ -99,27 +99,27 @@
Here are just some of the features that GitLens provides,
<ul class="section-list">
<li>
a <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#repositories-explorer">
<i>Repositories</i> explorer
a <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#repositories-view">
<i>Repositories</i> view
</a>
to visualize, navigate, and explore Git repositories
</li>
<li>
a <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#file-history-explorer">
<i>File History</i> explorer
a <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#file-history-view">
<i>File History</i> view
</a>
to visualize, navigate, and explore the revision history of the current file
</li>
<li>
a <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#line-history-explorer">
<i>Line History</i> explorer
a <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#line-history-view">
<i>Line History</i> view
</a>
to visualize, navigate, and explore the revision history of the selected lines of
current file
</li>
<li>
an on-demand <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#results-explorer">
<i>Results</i> explorer
an on-demand <a title="Open the GitLens docs" href="https://github.com/eamodio/vscode-gitlens/#results-view">
<i>Results</i> view
</a>
to navigate and explore commits, histories, and searches, or visualize comparisons
between branches, tags, commits, and more

src/views/fileHistoryExplorer.ts → src/views/fileHistoryView.ts Näytä tiedosto

@ -1,15 +1,15 @@
'use strict';
import { commands, ConfigurationChangeEvent } from 'vscode';
import { configuration, ExplorersConfig, FileHistoryExplorerConfig } from '../configuration';
import { configuration, FileHistoryViewConfig, ViewsConfig } from '../configuration';
import { CommandContext, setCommandContext } from '../constants';
import { Container } from '../container';
import { ExplorerBase, RefreshReason } from './explorer';
import { RefreshNodeCommandArgs } from './explorerCommands';
import { ExplorerNode, FileHistoryTrackerNode } from './nodes';
import { FileHistoryTrackerNode, ViewNode } from './nodes';
import { RefreshReason, ViewBase } from './viewBase';
import { RefreshNodeCommandArgs } from './viewCommands';
export class FileHistoryExplorer extends ExplorerBase<FileHistoryTrackerNode> {
export class FileHistoryView extends ViewBase<FileHistoryTrackerNode> {
constructor() {
super('gitlens.fileHistoryExplorer');
super('gitlens.views.fileHistory');
}
getRoot() {
@ -17,11 +17,11 @@ export class FileHistoryExplorer extends ExplorerBase {
}
protected registerCommands() {
Container.explorerCommands;
Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);
commands.registerCommand(
this.getQualifiedCommand('refreshNode'),
(node: ExplorerNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
(node: ViewNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
this
);
@ -52,8 +52,8 @@ export class FileHistoryExplorer extends ExplorerBase {
if (
!initializing &&
!configuration.changed(e, configuration.name('fileHistoryExplorer').value) &&
!configuration.changed(e, configuration.name('explorers').value) &&
!configuration.changed(e, configuration.name('views')('fileHistory').value) &&
!configuration.changed(e, configuration.name('views').value) &&
!configuration.changed(e, configuration.name('defaultGravatarsStyle').value) &&
!configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value)
) {
@ -62,14 +62,14 @@ export class FileHistoryExplorer extends ExplorerBase {
if (
initializing ||
configuration.changed(e, configuration.name('fileHistoryExplorer')('enabled').value) ||
configuration.changed(e, configuration.name('fileHistoryExplorer')('location').value)
configuration.changed(e, configuration.name('views')('fileHistory')('enabled').value) ||
configuration.changed(e, configuration.name('views')('fileHistory')('location').value)
) {
setCommandContext(CommandContext.FileHistoryExplorer, this.config.enabled ? this.config.location : false);
setCommandContext(CommandContext.FileHistoryExplorerEditorFollowing, true);
setCommandContext(CommandContext.ViewsFileHistory, this.config.enabled ? this.config.location : false);
setCommandContext(CommandContext.ViewsFileHistoryEditorFollowing, true);
}
if (initializing || configuration.changed(e, configuration.name('fileHistoryExplorer')('location').value)) {
if (initializing || configuration.changed(e, configuration.name('views')('fileHistory')('location').value)) {
this.initialize(this.config.location);
}
@ -78,12 +78,12 @@ export class FileHistoryExplorer extends ExplorerBase {
}
}
get config(): ExplorersConfig & FileHistoryExplorerConfig {
return { ...Container.config.explorers, ...Container.config.fileHistoryExplorer };
get config(): ViewsConfig & FileHistoryViewConfig {
return { ...Container.config.views, ...Container.config.views.fileHistory };
}
private setEditorFollowing(enabled: boolean) {
setCommandContext(CommandContext.FileHistoryExplorerEditorFollowing, enabled);
setCommandContext(CommandContext.ViewsFileHistoryEditorFollowing, enabled);
if (this._root !== undefined) {
this._root.setEditorFollowing(enabled);
}

src/views/lineHistoryExplorer.ts → src/views/lineHistoryView.ts Näytä tiedosto

@ -1,15 +1,15 @@
'use strict';
import { commands, ConfigurationChangeEvent } from 'vscode';
import { configuration, ExplorersConfig, LineHistoryExplorerConfig } from '../configuration';
import { configuration, LineHistoryViewConfig, ViewsConfig } from '../configuration';
import { CommandContext, setCommandContext } from '../constants';
import { Container } from '../container';
import { ExplorerBase, RefreshReason } from './explorer';
import { RefreshNodeCommandArgs } from './explorerCommands';
import { ExplorerNode, LineHistoryTrackerNode } from './nodes';
import { LineHistoryTrackerNode, ViewNode } from './nodes';
import { RefreshReason, ViewBase } from './viewBase';
import { RefreshNodeCommandArgs } from './viewCommands';
export class LineHistoryExplorer extends ExplorerBase<LineHistoryTrackerNode> {
export class LineHistoryView extends ViewBase<LineHistoryTrackerNode> {
constructor() {
super('gitlens.lineHistoryExplorer');
super('gitlens.views.lineHistory');
}
getRoot() {
@ -17,11 +17,11 @@ export class LineHistoryExplorer extends ExplorerBase {
}
protected registerCommands() {
Container.explorerCommands;
Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);
commands.registerCommand(
this.getQualifiedCommand('refreshNode'),
(node: ExplorerNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
(node: ViewNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
this
);
commands.registerCommand(
@ -51,8 +51,8 @@ export class LineHistoryExplorer extends ExplorerBase {
if (
!initializing &&
!configuration.changed(e, configuration.name('lineHistoryExplorer').value) &&
!configuration.changed(e, configuration.name('explorers').value) &&
!configuration.changed(e, configuration.name('views')('lineHistory').value) &&
!configuration.changed(e, configuration.name('views').value) &&
!configuration.changed(e, configuration.name('defaultGravatarsStyle').value) &&
!configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value)
) {
@ -61,14 +61,14 @@ export class LineHistoryExplorer extends ExplorerBase {
if (
initializing ||
configuration.changed(e, configuration.name('lineHistoryExplorer')('enabled').value) ||
configuration.changed(e, configuration.name('lineHistoryExplorer')('location').value)
configuration.changed(e, configuration.name('views')('lineHistory')('enabled').value) ||
configuration.changed(e, configuration.name('views')('lineHistory')('location').value)
) {
setCommandContext(CommandContext.LineHistoryExplorer, this.config.enabled ? this.config.location : false);
setCommandContext(CommandContext.LineHistoryExplorerEditorFollowing, true);
setCommandContext(CommandContext.ViewsLineHistory, this.config.enabled ? this.config.location : false);
setCommandContext(CommandContext.ViewsLineHistoryEditorFollowing, true);
}
if (initializing || configuration.changed(e, configuration.name('lineHistoryExplorer')('location').value)) {
if (initializing || configuration.changed(e, configuration.name('views')('lineHistory')('location').value)) {
this.initialize(this.config.location);
}
@ -77,12 +77,12 @@ export class LineHistoryExplorer extends ExplorerBase {
}
}
get config(): ExplorersConfig & LineHistoryExplorerConfig {
return { ...Container.config.explorers, ...Container.config.lineHistoryExplorer };
get config(): ViewsConfig & LineHistoryViewConfig {
return { ...Container.config.views, ...Container.config.views.lineHistory };
}
private setEditorFollowing(enabled: boolean) {
setCommandContext(CommandContext.LineHistoryExplorerEditorFollowing, enabled);
setCommandContext(CommandContext.ViewsLineHistoryEditorFollowing, enabled);
if (this._root !== undefined) {
this._root.setEditorFollowing(enabled);
}

+ 1
- 1
src/views/nodes.ts Näytä tiedosto

@ -1,6 +1,6 @@
'use strict';
export * from './nodes/explorerNode';
export * from './nodes/viewNode';
export * from './nodes/branchesNode';
export * from './nodes/branchNode';
export * from './nodes/commitFileNode';

+ 13
- 13
src/views/nodes/branchNode.ts Näytä tiedosto

@ -1,27 +1,27 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerBranchesLayout } from '../../configuration';
import { ViewBranchesLayout } from '../../configuration';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { GitBranch, GitUri } from '../../git/gitService';
import { Arrays, Iterables } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { CommitNode } from './commitNode';
import { MessageNode, ShowMoreNode } from './common';
import { ExplorerNode, ExplorerRefNode, PageableExplorerNode, ResourceType } from './explorerNode';
import { insertDateMarkers } from './helpers';
import { PageableViewNode, ResourceType, ViewNode, ViewRefNode } from './viewNode';
export class BranchNode extends ExplorerRefNode implements PageableExplorerNode {
export class BranchNode extends ViewRefNode implements PageableViewNode {
readonly supportsPaging: boolean = true;
maxCount: number | undefined;
private _children: ExplorerNode[] | undefined;
private _children: ViewNode[] | undefined;
constructor(
public readonly branch: GitBranch,
uri: GitUri,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer,
parent: ViewNode,
public readonly view: RepositoriesView,
private readonly _markCurrent: boolean = true
) {
super(uri, parent);
@ -39,7 +39,7 @@ export class BranchNode extends ExplorerRefNode implements PageableExplorerNode
get label(): string {
const branchName = this.branch.getName();
if (this.explorer.config.branches.layout === ExplorerBranchesLayout.List) return branchName;
if (this.view.config.branches.layout === ViewBranchesLayout.List) return branchName;
return this.current || GitBranch.isDetached(branchName) ? branchName : this.branch.getBasename();
}
@ -48,10 +48,10 @@ export class BranchNode extends ExplorerRefNode implements PageableExplorerNode
return this.branch.ref;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._children === undefined) {
const log = await Container.git.getLog(this.uri.repoPath!, {
maxCount: this.maxCount || this.explorer.config.defaultItemLimit,
maxCount: this.maxCount || this.view.config.defaultItemLimit,
ref: this.ref
});
if (log === undefined) return [new MessageNode(this, 'No commits yet')];
@ -75,14 +75,14 @@ export class BranchNode extends ExplorerRefNode implements PageableExplorerNode
...insertDateMarkers(
Iterables.map(
log.commits.values(),
c => new CommitNode(c, this, this.explorer, this.branch, getBranchTips)
c => new CommitNode(c, this, this.view, this.branch, getBranchTips)
),
this
)
];
if (log.truncated) {
children.push(new ShowMoreNode('Commits', this, this.explorer));
children.push(new ShowMoreNode('Commits', this, this.view));
}
this._children = children;
@ -96,7 +96,7 @@ export class BranchNode extends ExplorerRefNode implements PageableExplorerNode
let iconSuffix = '';
if (!this.branch.remote && this.branch.tracking !== undefined) {
if (this.explorer.config.showTrackingBranch) {
if (this.view.config.showTrackingBranch) {
name += `${this.branch.getTrackingStatus({ prefix: `${GlyphChars.Space} ` })}${GlyphChars.Space} ${
GlyphChars.ArrowLeftRightLong
}${GlyphChars.Space} ${this.branch.tracking}`;

+ 7
- 7
src/views/nodes/branchOrTagFolderNode.ts Näytä tiedosto

@ -2,20 +2,20 @@
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { GitUri } from '../../git/gitService';
import { Arrays, Objects } from '../../system';
import { Explorer } from '../explorer';
import { View } from '../viewBase';
import { BranchNode } from './branchNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { TagNode } from './tagNode';
import { ResourceType, ViewNode } from './viewNode';
export class BranchOrTagFolderNode extends ExplorerNode {
export class BranchOrTagFolderNode extends ViewNode {
constructor(
public readonly type: 'branch' | 'remote-branch' | 'tag',
public readonly repoPath: string,
public readonly folderName: string,
public readonly relativePath: string | undefined,
public readonly root: Arrays.IHierarchicalItem<BranchNode | TagNode>,
parent: ExplorerNode,
public readonly explorer: Explorer,
parent: ViewNode,
public readonly view: View,
private readonly _expanded: boolean = false
) {
super(GitUri.fromRepoPath(repoPath), parent);
@ -25,7 +25,7 @@ export class BranchOrTagFolderNode extends ExplorerNode {
return `gitlens:repository(${this.repoPath}):${this.type}-folder(${this.folderName})`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this.root.descendants === undefined || this.root.children === undefined) return [];
const children: (BranchOrTagFolderNode | BranchNode | TagNode)[] = [];
@ -44,7 +44,7 @@ export class BranchOrTagFolderNode extends ExplorerNode {
folder.relativePath,
folder,
this,
this.explorer,
this.view,
expanded
)
);

+ 12
- 20
src/views/nodes/branchesNode.ts Näytä tiedosto

@ -1,22 +1,22 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerBranchesLayout } from '../../configuration';
import { ViewBranchesLayout } from '../../configuration';
import { Container } from '../../container';
import { GitUri, Repository } from '../../git/gitService';
import { Arrays, Iterables } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { BranchNode } from './branchNode';
import { BranchOrTagFolderNode } from './branchOrTagFolderNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { ResourceType, ViewNode } from './viewNode';
export class BranchesNode extends ExplorerNode {
private _children: ExplorerNode[] | undefined;
export class BranchesNode extends ViewNode {
private _children: ViewNode[] | undefined;
constructor(
uri: GitUri,
public readonly repo: Repository,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(uri, parent);
}
@ -25,7 +25,7 @@ export class BranchesNode extends ExplorerNode {
return `gitlens:repository(${this.repo.path}):branches`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._children === undefined) {
const branches = await this.repo.getBranches();
if (branches === undefined) return [];
@ -36,27 +36,19 @@ export class BranchesNode extends ExplorerNode {
const branchNodes = [
...Iterables.filterMap(
branches,
b => (b.remote ? undefined : new BranchNode(b, this.uri, this, this.explorer))
b => (b.remote ? undefined : new BranchNode(b, this.uri, this, this.view))
)
];
if (this.explorer.config.branches.layout === ExplorerBranchesLayout.List) return branchNodes;
if (this.view.config.branches.layout === ViewBranchesLayout.List) return branchNodes;
const hierarchy = Arrays.makeHierarchical(
branchNodes,
n => (n.branch.detached ? [n.branch.name] : n.branch.getName().split('/')),
(...paths: string[]) => paths.join('/'),
this.explorer.config.files.compact
this.view.config.files.compact
);
const root = new BranchOrTagFolderNode(
'branch',
this.repo.path,
'',
undefined,
hierarchy,
this,
this.explorer
);
const root = new BranchOrTagFolderNode('branch', this.repo.path, '', undefined, hierarchy, this, this.view);
this._children = await root.getChildren();
}
return this._children;

+ 8
- 8
src/views/nodes/commitFileNode.ts Näytä tiedosto

@ -13,8 +13,8 @@ import {
IStatusFormatOptions,
StatusFileFormatter
} from '../../git/gitService';
import { Explorer } from '../explorer';
import { ExplorerNode, ExplorerRefNode, ResourceType } from './explorerNode';
import { View } from '../viewBase';
import { ResourceType, ViewNode, ViewRefNode } from './viewNode';
export enum CommitFileNodeDisplayAs {
CommitLabel = 1 << 0,
@ -27,12 +27,12 @@ export enum CommitFileNodeDisplayAs {
File = FileLabel | StatusIcon
}
export class CommitFileNode extends ExplorerRefNode {
export class CommitFileNode extends ViewRefNode {
constructor(
public readonly file: GitFile,
public commit: GitLogCommit,
parent: ExplorerNode,
public readonly explorer: Explorer,
parent: ViewNode,
public readonly view: View,
private readonly _displayAs: CommitFileNodeDisplayAs,
private readonly _selection?: Selection
) {
@ -47,7 +47,7 @@ export class CommitFileNode extends ExplorerRefNode {
return this.commit.sha;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
return [];
}
@ -161,11 +161,11 @@ export class CommitFileNode extends ExplorerRefNode {
}
protected getCommitTemplate() {
return this.explorer.config.commitFormat;
return this.view.config.commitFormat;
}
protected getCommitFileTemplate() {
return this.explorer.config.commitFileFormat;
return this.view.config.commitFileFormat;
}
getCommand(): Command | undefined {

+ 16
- 16
src/views/nodes/commitNode.ts Näytä tiedosto

@ -2,21 +2,21 @@
import * as path from 'path';
import { Command, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Commands, DiffWithPreviousCommandArgs } from '../../commands';
import { ExplorerFilesLayout } from '../../configuration';
import { ViewFilesLayout } from '../../configuration';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { CommitFormatter, GitBranch, GitLogCommit, ICommitFormatOptions } from '../../git/gitService';
import { Arrays, Iterables, Strings } from '../../system';
import { Explorer } from '../explorer';
import { View } from '../viewBase';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { ExplorerNode, ExplorerRefNode, ResourceType } from './explorerNode';
import { FileExplorerNode, FolderNode } from './folderNode';
import { FileNode, FolderNode } from './folderNode';
import { ResourceType, ViewNode, ViewRefNode } from './viewNode';
export class CommitNode extends ExplorerRefNode {
export class CommitNode extends ViewRefNode {
constructor(
public readonly commit: GitLogCommit,
parent: ExplorerNode,
public readonly explorer: Explorer,
parent: ViewNode,
public readonly view: View,
public readonly branch?: GitBranch,
private readonly getBranchTips?: (sha: string) => string | undefined
) {
@ -27,25 +27,25 @@ export class CommitNode extends ExplorerRefNode {
return this.commit.sha;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const commit = this.commit;
let children: FileExplorerNode[] = [
let children: FileNode[] = [
...Iterables.map(
commit.files,
s => new CommitFileNode(s, commit.toFileCommit(s), this, this.explorer, CommitFileNodeDisplayAs.File)
s => new CommitFileNode(s, commit.toFileCommit(s), this, this.view, CommitFileNodeDisplayAs.File)
)
];
if (this.explorer.config.files.layout !== ExplorerFilesLayout.List) {
if (this.view.config.files.layout !== ViewFilesLayout.List) {
const hierarchy = Arrays.makeHierarchical(
children,
n => n.uri.getRelativePath().split('/'),
(...paths: string[]) => Strings.normalizePath(path.join(...paths)),
this.explorer.config.files.compact
this.view.config.files.compact
);
const root = new FolderNode(this.repoPath, '', undefined, hierarchy, this, this.explorer);
children = (await root.getChildren()) as FileExplorerNode[];
const root = new FolderNode(this.repoPath, '', undefined, hierarchy, this, this.view);
children = (await root.getChildren()) as FileNode[];
}
else {
children.sort((a, b) => a.label!.localeCompare(b.label!));
@ -54,7 +54,7 @@ export class CommitNode extends ExplorerRefNode {
}
getTreeItem(): TreeItem {
let label = CommitFormatter.fromTemplate(this.explorer.config.commitFormat, this.commit, {
let label = CommitFormatter.fromTemplate(this.view.config.commitFormat, this.commit, {
truncateMessageAtNewLine: true,
dateFormat: Container.config.defaultDateFormat
} as ICommitFormatOptions);
@ -71,7 +71,7 @@ export class CommitNode extends ExplorerRefNode {
item.contextValue =
this.branch === undefined || this.branch.current ? ResourceType.CommitOnCurrentBranch : ResourceType.Commit;
if (this.explorer.config.avatars) {
if (this.view.config.avatars) {
item.iconPath = this.commit.getGravatarUri(Container.config.defaultGravatarsStyle);
}
else {

+ 19
- 24
src/views/nodes/common.ts Näytä tiedosto

@ -1,13 +1,13 @@
import { Command, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { Explorer } from '../explorer';
import { RefreshNodeCommandArgs } from '../explorerCommands';
import { ExplorerNode, ResourceType, unknownGitUri } from '../nodes/explorerNode';
import { View } from '../viewBase';
import { RefreshNodeCommandArgs } from '../viewCommands';
import { ResourceType, unknownGitUri, ViewNode } from './viewNode';
export class MessageNode extends ExplorerNode {
export class MessageNode extends ViewNode {
constructor(
parent: ExplorerNode,
parent: ViewNode,
private readonly _message: string,
private readonly _tooltip?: string,
private readonly _iconPath?:
@ -22,7 +22,7 @@ export class MessageNode extends ExplorerNode {
super(unknownGitUri, parent);
}
getChildren(): ExplorerNode[] | Promise<ExplorerNode[]> {
getChildren(): ViewNode[] | Promise<ViewNode[]> {
return [];
}
@ -37,7 +37,7 @@ export class MessageNode extends ExplorerNode {
export class CommandMessageNode extends MessageNode {
constructor(
parent: ExplorerNode,
parent: ViewNode,
private readonly _command: Command,
message: string,
tooltip?: string,
@ -67,9 +67,9 @@ export class CommandMessageNode extends MessageNode {
}
}
export class UpdateableMessageNode extends ExplorerNode {
export class UpdateableMessageNode extends ViewNode {
constructor(
parent: ExplorerNode,
parent: ViewNode,
public readonly id: string,
private _message: string,
private _tooltip?: string,
@ -85,7 +85,7 @@ export class UpdateableMessageNode extends ExplorerNode {
super(unknownGitUri, parent);
}
getChildren(): ExplorerNode[] | Promise<ExplorerNode[]> {
getChildren(): ViewNode[] | Promise<ViewNode[]> {
return [];
}
@ -112,7 +112,7 @@ export class UpdateableMessageNode extends ExplorerNode {
}
| ThemeIcon;
},
explorer: Explorer
view: View
) {
if (changes.message !== undefined) {
this._message = changes.message;
@ -126,22 +126,22 @@ export class UpdateableMessageNode extends ExplorerNode {
this._iconPath = changes.iconPath === null ? undefined : changes.iconPath;
}
explorer.triggerNodeUpdate(this);
view.triggerNodeUpdate(this);
}
}
export abstract class PagerNode extends ExplorerNode {
export abstract class PagerNode extends ViewNode {
protected _args: RefreshNodeCommandArgs = {};
constructor(
protected readonly message: string,
protected readonly parent: ExplorerNode,
protected readonly explorer: Explorer
protected readonly parent: ViewNode,
protected readonly view: View
) {
super(unknownGitUri, parent);
}
getChildren(): ExplorerNode[] | Promise<ExplorerNode[]> {
getChildren(): ViewNode[] | Promise<ViewNode[]> {
return [];
}
@ -159,25 +159,20 @@ export abstract class PagerNode extends ExplorerNode {
getCommand(): Command | undefined {
return {
title: 'Refresh',
command: this.explorer.getQualifiedCommand('refreshNode'),
command: this.view.getQualifiedCommand('refreshNode'),
arguments: [this.parent, this._args]
} as Command;
}
}
export class ShowMoreNode extends PagerNode {
constructor(
type: string,
parent: ExplorerNode,
explorer: Explorer,
maxCount: number = Container.config.advanced.maxListItems
) {
constructor(type: string, parent: ViewNode, view: View, maxCount: number = Container.config.advanced.maxListItems) {
super(
maxCount === 0
? `Show All ${type} ${GlyphChars.Space}${GlyphChars.Dash}${GlyphChars.Space} this may take a while`
: `Show More ${type}`,
parent,
explorer
view
);
this._args.maxCount = maxCount;
}

+ 12
- 12
src/views/nodes/fileHistoryNode.ts Näytä tiedosto

@ -12,23 +12,23 @@ import {
} from '../../git/gitService';
import { Logger } from '../../logger';
import { Iterables } from '../../system';
import { FileHistoryExplorer } from '../fileHistoryExplorer';
import { FileHistoryView } from '../fileHistoryView';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType, SubscribeableExplorerNode } from './explorerNode';
import { insertDateMarkers } from './helpers';
import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode';
export class FileHistoryNode extends SubscribeableExplorerNode<FileHistoryExplorer> {
constructor(uri: GitUri, parent: ExplorerNode, explorer: FileHistoryExplorer) {
super(uri, parent, explorer);
export class FileHistoryNode extends SubscribeableViewNode<FileHistoryView> {
constructor(uri: GitUri, parent: ViewNode, view: FileHistoryView) {
super(uri, parent, view);
}
async getChildren(): Promise<ExplorerNode[]> {
const children: ExplorerNode[] = [];
async getChildren(): Promise<ViewNode[]> {
const children: ViewNode[] = [];
const displayAs =
CommitFileNodeDisplayAs.CommitLabel |
(this.explorer.config.avatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.StatusIcon);
(this.view.config.avatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.StatusIcon);
const status = await Container.git.getStatusForFile(this.uri.repoPath!, this.uri.fsPath);
if (status !== undefined && (status.indexStatus !== undefined || status.workingTreeStatus !== undefined)) {
@ -65,7 +65,7 @@ export class FileHistoryNode extends SubscribeableExplorerNode
previousSha,
status.originalFileName || status.fileName
);
children.push(new CommitFileNode(status, commit, this, this.explorer, displayAs));
children.push(new CommitFileNode(status, commit, this, this.view, displayAs));
}
const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, { ref: this.uri.sha });
@ -74,7 +74,7 @@ export class FileHistoryNode extends SubscribeableExplorerNode
...insertDateMarkers(
Iterables.map(
log.commits.values(),
c => new CommitFileNode(c.files[0], c, this, this.explorer, displayAs)
c => new CommitFileNode(c.files[0], c, this, this.view, displayAs)
),
this
)
@ -120,7 +120,7 @@ export class FileHistoryNode extends SubscribeableExplorerNode
Logger.log(`FileHistoryNode.onRepoChanged(${e.changes.join()}); triggering node refresh`);
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
private onRepoFileSystemChanged(e: RepositoryFileSystemChangeEvent) {
@ -128,6 +128,6 @@ export class FileHistoryNode extends SubscribeableExplorerNode
Logger.log(`FileHistoryNode.onRepoFileSystemChanged; triggering node refresh`);
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}

+ 8
- 8
src/views/nodes/fileHistoryTrackerNode.ts Näytä tiedosto

@ -5,16 +5,16 @@ import { UriComparer } from '../../comparers';
import { Container } from '../../container';
import { GitUri } from '../../git/gitService';
import { Functions } from '../../system';
import { FileHistoryExplorer } from '../fileHistoryExplorer';
import { FileHistoryView } from '../fileHistoryView';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType, SubscribeableExplorerNode, unknownGitUri } from './explorerNode';
import { FileHistoryNode } from './fileHistoryNode';
import { ResourceType, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode';
export class FileHistoryTrackerNode extends SubscribeableExplorerNode<FileHistoryExplorer> {
export class FileHistoryTrackerNode extends SubscribeableViewNode<FileHistoryView> {
private _child: FileHistoryNode | undefined;
constructor(explorer: FileHistoryExplorer) {
super(unknownGitUri, undefined, explorer);
constructor(view: FileHistoryView) {
super(unknownGitUri, undefined, view);
}
dispose() {
@ -30,13 +30,13 @@ export class FileHistoryTrackerNode extends SubscribeableExplorerNode
}
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._child === undefined) {
if (this.uri === unknownGitUri) {
return [new MessageNode(this, 'There are no editors open that can provide file history')];
}
this._child = new FileHistoryNode(this.uri, this, this.explorer);
this._child = new FileHistoryNode(this.uri, this, this.view);
}
return [this._child];
@ -113,6 +113,6 @@ export class FileHistoryTrackerNode extends SubscribeableExplorerNode
}
private onActiveEditorChanged(editor: TextEditor | undefined) {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}

+ 21
- 21
src/views/nodes/folderNode.ts Näytä tiedosto

@ -1,49 +1,49 @@
'use strict';
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerFilesLayout, ExplorersFilesConfig } from '../../configuration';
import { ViewFilesLayout, ViewsFilesConfig } from '../../configuration';
import { GitUri } from '../../git/gitService';
import { Arrays, Objects } from '../../system';
import { Explorer } from '../explorer';
import { ExplorerNode, ResourceType } from './explorerNode';
import { View } from '../viewBase';
import { ResourceType, ViewNode } from './viewNode';
export interface FileExplorerNode extends ExplorerNode {
export interface FileNode extends ViewNode {
folderName: string;
label?: string;
priority: number;
relativePath?: string;
root?: Arrays.IHierarchicalItem<FileExplorerNode>;
root?: Arrays.IHierarchicalItem<FileNode>;
}
export class FolderNode extends ExplorerNode {
export class FolderNode extends ViewNode {
readonly priority: number = 1;
constructor(
public readonly repoPath: string,
public readonly folderName: string,
public readonly relativePath: string | undefined,
public readonly root: Arrays.IHierarchicalItem<FileExplorerNode>,
parent: ExplorerNode,
public readonly explorer: Explorer
public readonly root: Arrays.IHierarchicalItem<FileNode>,
parent: ViewNode,
public readonly view: View
) {
super(GitUri.fromRepoPath(repoPath), parent);
}
async getChildren(): Promise<(FolderNode | FileExplorerNode)[]> {
async getChildren(): Promise<(FolderNode | FileNode)[]> {
if (this.root.descendants === undefined || this.root.children === undefined) return [];
let children: (FolderNode | FileExplorerNode)[];
let children: (FolderNode | FileNode)[];
const nesting = FolderNode.getFileNesting(
this.explorer.config.files,
this.view.config.files,
this.root.descendants,
this.relativePath === undefined
);
if (nesting !== ExplorerFilesLayout.List) {
if (nesting !== ViewFilesLayout.List) {
children = [];
for (const folder of Objects.values(this.root.children)) {
if (folder.value === undefined) {
children.push(
new FolderNode(this.repoPath, folder.name, folder.relativePath, folder, this, this.explorer)
new FolderNode(this.repoPath, folder.name, folder.relativePath, folder, this, this.view)
);
continue;
}
@ -81,18 +81,18 @@ export class FolderNode extends ExplorerNode {
return this.folderName;
}
static getFileNesting<T extends FileExplorerNode>(
config: ExplorersFilesConfig,
static getFileNesting<T extends FileNode>(
config: ViewsFilesConfig,
children: T[],
isRoot: boolean
): ExplorerFilesLayout {
const nesting = config.layout || ExplorerFilesLayout.Auto;
if (nesting === ExplorerFilesLayout.Auto) {
): ViewFilesLayout {
const nesting = config.layout || ViewFilesLayout.Auto;
if (nesting === ViewFilesLayout.Auto) {
if (isRoot || config.compact) {
const nestingThreshold = config.threshold || 5;
if (children.length <= nestingThreshold) return ExplorerFilesLayout.List;
if (children.length <= nestingThreshold) return ViewFilesLayout.List;
}
return ExplorerFilesLayout.Tree;
return ViewFilesLayout.Tree;
}
return nesting;
}

+ 4
- 4
src/views/nodes/helpers.ts Näytä tiedosto

@ -1,7 +1,7 @@
'use strict';
import { GitLogCommit } from '../../git/gitService';
import { MessageNode } from './common';
import { ExplorerNode } from './explorerNode';
import { ViewNode } from './viewNode';
const markers: [number, string][] = [
[0, 'Less than a week ago'],
@ -11,10 +11,10 @@ const markers: [number, string][] = [
];
export function* insertDateMarkers(
iterable: Iterable<ExplorerNode & { commit: GitLogCommit }>,
parent: ExplorerNode,
iterable: Iterable<ViewNode & { commit: GitLogCommit }>,
parent: ViewNode,
skip?: number
): Iterable<ExplorerNode> {
): Iterable<ViewNode> {
let index = skip || 0;
let time = undefined;
const now = Date.now();

+ 13
- 13
src/views/nodes/lineHistoryNode.ts Näytä tiedosto

@ -11,28 +11,28 @@ import {
} from '../../git/gitService';
import { Logger } from '../../logger';
import { Iterables } from '../../system';
import { LineHistoryExplorer } from '../lineHistoryExplorer';
import { LineHistoryView } from '../lineHistoryView';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType, SubscribeableExplorerNode } from './explorerNode';
import { insertDateMarkers } from './helpers';
import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode';
export class LineHistoryNode extends SubscribeableExplorerNode<LineHistoryExplorer> {
export class LineHistoryNode extends SubscribeableViewNode<LineHistoryView> {
constructor(
uri: GitUri,
public readonly selection: Selection,
parent: ExplorerNode,
explorer: LineHistoryExplorer
parent: ViewNode,
view: LineHistoryView
) {
super(uri, parent, explorer);
super(uri, parent, view);
}
async getChildren(): Promise<ExplorerNode[]> {
const children: ExplorerNode[] = [];
async getChildren(): Promise<ViewNode[]> {
const children: ViewNode[] = [];
const displayAs =
CommitFileNodeDisplayAs.CommitLabel |
(this.explorer.config.avatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.StatusIcon);
(this.view.config.avatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.StatusIcon);
const log = await Container.git.getLogForFile(this.uri.repoPath, this.uri.fsPath, {
ref: this.uri.sha,
@ -43,7 +43,7 @@ export class LineHistoryNode extends SubscribeableExplorerNode
...insertDateMarkers(
Iterables.filterMap(
log.commits.values(),
c => new CommitFileNode(c.files[0], c, this, this.explorer, displayAs, this.selection)
c => new CommitFileNode(c.files[0], c, this, this.view, displayAs, this.selection)
),
this
)
@ -85,7 +85,7 @@ export class LineHistoryNode extends SubscribeableExplorerNode
blame.commit.originalFileName || blame.commit.fileName
);
children.splice(0, 0, new CommitFileNode(file, commit, this, this.explorer, displayAs, this.selection));
children.splice(0, 0, new CommitFileNode(file, commit, this, this.view, displayAs, this.selection));
}
}
@ -144,7 +144,7 @@ export class LineHistoryNode extends SubscribeableExplorerNode
Logger.log(`LineHistoryNode.onRepoChanged(${e.changes.join()}); triggering node refresh`);
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
private onRepoFileSystemChanged(e: RepositoryFileSystemChangeEvent) {
@ -152,6 +152,6 @@ export class LineHistoryNode extends SubscribeableExplorerNode
Logger.log(`LineHistoryNode.onRepoFileSystemChanged; triggering node refresh`);
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}

+ 8
- 8
src/views/nodes/lineHistoryTrackerNode.ts Näytä tiedosto

@ -5,17 +5,17 @@ import { Container } from '../../container';
import { GitUri } from '../../git/gitService';
import { Functions } from '../../system';
import { LinesChangeEvent } from '../../trackers/gitLineTracker';
import { LineHistoryExplorer } from '../lineHistoryExplorer';
import { LineHistoryView } from '../lineHistoryView';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType, SubscribeableExplorerNode, unknownGitUri } from './explorerNode';
import { LineHistoryNode } from './lineHistoryNode';
import { ResourceType, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode';
export class LineHistoryTrackerNode extends SubscribeableExplorerNode<LineHistoryExplorer> {
export class LineHistoryTrackerNode extends SubscribeableViewNode<LineHistoryView> {
private _child: LineHistoryNode | undefined;
private _selection: Selection | undefined;
constructor(explorer: LineHistoryExplorer) {
super(unknownGitUri, undefined, explorer);
constructor(view: LineHistoryView) {
super(unknownGitUri, undefined, view);
}
dispose() {
@ -31,13 +31,13 @@ export class LineHistoryTrackerNode extends SubscribeableExplorerNode
}
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._child === undefined) {
if (this.uri === unknownGitUri) {
return [new MessageNode(this, 'There are no editors open that can provide line history')];
}
this._child = new LineHistoryNode(this.uri, this._selection!, this, this.explorer);
this._child = new LineHistoryNode(this.uri, this._selection!, this, this.view);
}
return [this._child];
@ -116,6 +116,6 @@ export class LineHistoryTrackerNode extends SubscribeableExplorerNode
}
private onActiveLinesChanged(e: LinesChangeEvent) {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}

+ 11
- 11
src/views/nodes/remoteNode.ts Näytä tiedosto

@ -1,22 +1,22 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerBranchesLayout } from '../../configuration';
import { ViewBranchesLayout } from '../../configuration';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { GitRemote, GitRemoteType, GitUri, Repository } from '../../git/gitService';
import { Arrays, Iterables } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { BranchNode } from './branchNode';
import { BranchOrTagFolderNode } from './branchOrTagFolderNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { ResourceType, ViewNode } from './viewNode';
export class RemoteNode extends ExplorerNode {
export class RemoteNode extends ViewNode {
constructor(
public readonly remote: GitRemote,
uri: GitUri,
public readonly repo: Repository,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(uri, parent);
}
@ -25,7 +25,7 @@ export class RemoteNode extends ExplorerNode {
return `gitlens:repository(${this.remote.repoPath}):remote(${this.remote.name})`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const branches = await this.repo.getBranches();
if (branches === undefined) return [];
@ -38,16 +38,16 @@ export class RemoteNode extends ExplorerNode {
b =>
!b.remote || !b.name.startsWith(this.remote.name)
? undefined
: new BranchNode(b, this.uri, this, this.explorer)
: new BranchNode(b, this.uri, this, this.view)
)
];
if (this.explorer.config.branches.layout === ExplorerBranchesLayout.List) return branchNodes;
if (this.view.config.branches.layout === ViewBranchesLayout.List) return branchNodes;
const hierarchy = Arrays.makeHierarchical(
branchNodes,
n => (n.branch.detached ? [n.branch.name] : n.branch.getName().split('/')),
(...paths: string[]) => paths.join('/'),
this.explorer.config.files.compact
this.view.config.files.compact
);
const root = new BranchOrTagFolderNode(
@ -57,7 +57,7 @@ export class RemoteNode extends ExplorerNode {
undefined,
hierarchy,
this,
this.explorer
this.view
);
const children = (await root.getChildren()) as (BranchOrTagFolderNode | BranchNode)[];

+ 7
- 7
src/views/nodes/remotesNode.ts Näytä tiedosto

@ -3,17 +3,17 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { GitUri, Repository } from '../../git/gitService';
import { Iterables } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType } from './explorerNode';
import { RemoteNode } from './remoteNode';
import { ResourceType, ViewNode } from './viewNode';
export class RemotesNode extends ExplorerNode {
export class RemotesNode extends ViewNode {
constructor(
uri: GitUri,
public readonly repo: Repository,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(uri, parent);
}
@ -22,12 +22,12 @@ export class RemotesNode extends ExplorerNode {
return `gitlens:repository(${this.repo.path}):remotes`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const remotes = await this.repo.getRemotes();
if (remotes === undefined || remotes.length === 0) return [new MessageNode(this, 'No remotes configured')];
remotes.sort((a, b) => a.name.localeCompare(b.name));
return [...Iterables.map(remotes, r => new RemoteNode(r, this.uri, this.repo, this, this.explorer))];
return [...Iterables.map(remotes, r => new RemoteNode(r, this.uri, this.repo, this, this.view))];
}
getTreeItem(): TreeItem {

+ 13
- 13
src/views/nodes/repositoriesNode.ts Näytä tiedosto

@ -4,17 +4,17 @@ import { Container } from '../../container';
import { GitUri } from '../../git/gitService';
import { Logger } from '../../logger';
import { Functions } from '../../system';
import { RefreshReason } from '../explorer';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { RefreshReason } from '../viewBase';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType, SubscribeableExplorerNode, unknownGitUri } from './explorerNode';
import { RepositoryNode } from './repositoryNode';
import { ResourceType, SubscribeableViewNode, unknownGitUri, ViewNode } from './viewNode';
export class RepositoriesNode extends SubscribeableExplorerNode<RepositoriesExplorer> {
export class RepositoriesNode extends SubscribeableViewNode<RepositoriesView> {
private _children: (RepositoryNode | MessageNode)[] | undefined;
constructor(explorer: RepositoriesExplorer) {
super(unknownGitUri, undefined, explorer);
constructor(view: RepositoriesView) {
super(unknownGitUri, undefined, view);
}
dispose() {
@ -30,7 +30,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode
}
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._children === undefined) {
const repositories = [...(await Container.git.getRepositories())];
if (repositories.length === 0) return [new MessageNode(this, 'No repositories found')];
@ -39,7 +39,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode
for (const repo of repositories.sort((a, b) => a.index - b.index)) {
if (repo.closed) continue;
children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this, this.explorer));
children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this, this.view));
}
this._children = children;
@ -133,7 +133,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode
child.refresh();
}
else {
children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this, this.explorer));
children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), repo, this, this.view));
}
}
@ -156,7 +156,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode
protected async subscribe() {
const subscriptions = [Container.git.onDidChangeRepositories(this.onRepositoriesChanged, this)];
if (this.explorer.config.autoReveal) {
if (this.view.config.autoReveal) {
subscriptions.push(
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveEditorChanged, 500), this)
);
@ -178,7 +178,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode
if (node === undefined) return;
// Check to see if this repo has a descendent that is already selected
let parent = this.explorer.selection.length === 0 ? undefined : this.explorer.selection[0];
let parent = this.view.selection.length === 0 ? undefined : this.view.selection[0];
while (parent !== undefined) {
if (parent === node) return;
@ -188,7 +188,7 @@ export class RepositoriesNode extends SubscribeableExplorerNode
// HACK: Since we have no expand/collapse api, reveal the first child to force an expand
// See https://github.com/Microsoft/vscode/issues/55879
const children = await node.getChildren();
await this.explorer.reveal(children !== undefined && children.length !== 0 ? children[0] : node);
await this.view.reveal(children !== undefined && children.length !== 0 ? children[0] : node);
}
catch (ex) {
Logger.error(ex);
@ -196,6 +196,6 @@ export class RepositoriesNode extends SubscribeableExplorerNode
}
private onRepositoriesChanged() {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}

+ 26
- 26
src/views/nodes/repositoryNode.ts Näytä tiedosto

@ -15,29 +15,29 @@ import {
} from '../../git/gitService';
import { Logger } from '../../logger';
import { Dates, Functions, Strings } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { BranchesNode } from './branchesNode';
import { BranchNode } from './branchNode';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType, SubscribeableExplorerNode } from './explorerNode';
import { RemotesNode } from './remotesNode';
import { StashesNode } from './stashesNode';
import { StatusFilesNode } from './statusFilesNode';
import { StatusUpstreamNode } from './statusUpstreamNode';
import { TagsNode } from './tagsNode';
import { ResourceType, SubscribeableViewNode, ViewNode } from './viewNode';
export class RepositoryNode extends SubscribeableExplorerNode<RepositoriesExplorer> {
private _children: ExplorerNode[] | undefined;
export class RepositoryNode extends SubscribeableViewNode<RepositoriesView> {
private _children: ViewNode[] | undefined;
private _lastFetched: number = 0;
private _status: Promise<GitStatus | undefined>;
constructor(
uri: GitUri,
public readonly repo: Repository,
parent: ExplorerNode,
explorer: RepositoriesExplorer
parent: ViewNode,
view: RepositoriesView
) {
super(uri, parent, explorer);
super(uri, parent, view);
this._status = this.repo.getStatus();
}
@ -46,7 +46,7 @@ export class RepositoryNode extends SubscribeableExplorerNode
return `gitlens:repository(${this.repo.path})`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._children === undefined) {
const children = [];
@ -62,29 +62,29 @@ export class RepositoryNode extends SubscribeableExplorerNode
status.state.behind,
status.detached
);
children.push(new BranchNode(branch, this.uri, this, this.explorer, false));
children.push(new BranchNode(branch, this.uri, this, this.view, false));
if (status.state.behind) {
children.push(new StatusUpstreamNode(status, 'behind', this, this.explorer));
children.push(new StatusUpstreamNode(status, 'behind', this, this.view));
}
if (status.state.ahead) {
children.push(new StatusUpstreamNode(status, 'ahead', this, this.explorer));
children.push(new StatusUpstreamNode(status, 'ahead', this, this.view));
}
if (status.state.ahead || (status.files.length !== 0 && this.includeWorkingTree)) {
const range = status.upstream ? `${status.upstream}..${branch.ref}` : undefined;
children.push(new StatusFilesNode(status, range, this, this.explorer));
children.push(new StatusFilesNode(status, range, this, this.view));
}
children.push(new MessageNode(this, GlyphChars.Dash.repeat(2), ''));
}
children.push(
new BranchesNode(this.uri, this.repo, this, this.explorer),
new RemotesNode(this.uri, this.repo, this, this.explorer),
new StashesNode(this.uri, this.repo, this, this.explorer),
new TagsNode(this.uri, this.repo, this, this.explorer)
new BranchesNode(this.uri, this.repo, this, this.view),
new RemotesNode(this.uri, this.repo, this, this.view),
new StashesNode(this.uri, this.repo, this, this.view),
new TagsNode(this.uri, this.repo, this, this.view)
);
this._children = children;
}
@ -186,7 +186,7 @@ export class RepositoryNode extends SubscribeableExplorerNode
await commands.executeCommand('git.fetch', this.repo.path);
await this.updateLastFetched();
this.explorer.triggerNodeUpdate(this);
this.view.triggerNodeUpdate(this);
}
async pull(progress: boolean = true) {
@ -206,7 +206,7 @@ export class RepositoryNode extends SubscribeableExplorerNode
await commands.executeCommand('git.pull', this.repo.path);
await this.updateLastFetched();
this.explorer.triggerNodeUpdate(this);
this.view.triggerNodeUpdate(this);
}
async push(progress: boolean = true) {
@ -225,7 +225,7 @@ export class RepositoryNode extends SubscribeableExplorerNode
private async pushCore() {
await commands.executeCommand('git.push', this.repo.path);
this.explorer.triggerNodeUpdate(this);
this.view.triggerNodeUpdate(this);
}
refresh() {
@ -254,11 +254,11 @@ export class RepositoryNode extends SubscribeableExplorerNode
}
private get includeWorkingTree(): boolean {
return this.explorer.config.includeWorkingTree;
return this.view.config.includeWorkingTree;
}
private onFileSystemChanged(e: RepositoryFileSystemChangeEvent) {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
private onRepoChanged(e: RepositoryChangeEvent) {
@ -275,7 +275,7 @@ export class RepositoryNode extends SubscribeableExplorerNode
e.changed(RepositoryChange.Repository) ||
e.changed(RepositoryChange.Config)
) {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
return;
}
@ -283,21 +283,21 @@ export class RepositoryNode extends SubscribeableExplorerNode
if (e.changed(RepositoryChange.Stashes)) {
const node = this._children.find(c => c instanceof StashesNode);
if (node !== undefined) {
void this.explorer.refreshNode(node);
void this.view.refreshNode(node);
}
}
if (e.changed(RepositoryChange.Remotes)) {
const node = this._children.find(c => c instanceof RemotesNode);
if (node !== undefined) {
void this.explorer.refreshNode(node);
void this.view.refreshNode(node);
}
}
if (e.changed(RepositoryChange.Tags)) {
const node = this._children.find(c => c instanceof TagsNode);
if (node !== undefined) {
void this.explorer.refreshNode(node);
void this.view.refreshNode(node);
}
}
}
@ -332,6 +332,6 @@ export class RepositoryNode extends SubscribeableExplorerNode
// If the fetched date hasn't changed and it was over a day ago, kick out
if (this._lastFetched === prevLastFetched && Date.now() - this._lastFetched >= Dates.MillisecondsPerDay) return;
this.explorer.triggerNodeUpdate(this);
this.view.triggerNodeUpdate(this);
}
}

+ 6
- 6
src/views/nodes/resultsCommitNode.ts Näytä tiedosto

@ -1,20 +1,20 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { GitLogCommit } from '../../git/gitService';
import { ResultsExplorer } from '../resultsExplorer';
import { ResultsView } from '../resultsView';
import { CommitNode } from './commitNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { ResourceType, ViewNode } from './viewNode';
export class ResultsCommitNode extends ExplorerNode {
export class ResultsCommitNode extends ViewNode {
constructor(
public readonly commit: GitLogCommit,
public readonly explorer: ResultsExplorer
public readonly view: ResultsView
) {
super(commit.toGitUri(), undefined);
}
getChildren(): ExplorerNode[] {
return [new CommitNode(this.commit, this, this.explorer)];
getChildren(): ViewNode[] {
return [new CommitNode(this.commit, this, this.view)];
}
getTreeItem(): TreeItem {

+ 8
- 8
src/views/nodes/resultsCommitsNode.ts Näytä tiedosto

@ -2,40 +2,40 @@
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { GitLog, GitUri } from '../../git/gitService';
import { Iterables } from '../../system';
import { ResultsExplorer } from '../resultsExplorer';
import { ResultsView } from '../resultsView';
import { CommitNode } from './commitNode';
import { ShowMoreNode } from './common';
import { ExplorerNode, PageableExplorerNode, ResourceType } from './explorerNode';
import { PageableViewNode, ResourceType, ViewNode } from './viewNode';
export interface CommitsQueryResults {
label: string;
log: GitLog | undefined;
}
export class ResultsCommitsNode extends ExplorerNode implements PageableExplorerNode {
export class ResultsCommitsNode extends ViewNode implements PageableViewNode {
readonly supportsPaging: boolean = true;
maxCount: number | undefined;
constructor(
public readonly repoPath: string,
private readonly _commitsQuery: (maxCount: number | undefined) => Promise<CommitsQueryResults>,
parent: ExplorerNode | undefined,
public readonly explorer: ResultsExplorer,
parent: ViewNode | undefined,
public readonly view: ResultsView,
private readonly _contextValue: ResourceType = ResourceType.ResultsCommits
) {
super(GitUri.fromRepoPath(repoPath), parent);
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const { log } = await this.getCommitsQueryResults();
if (log === undefined) return [];
const children: (CommitNode | ShowMoreNode)[] = [
...Iterables.map(log.commits.values(), c => new CommitNode(c, this, this.explorer))
...Iterables.map(log.commits.values(), c => new CommitNode(c, this, this.view))
];
if (log.truncated) {
children.push(new ShowMoreNode('Results', this, this.explorer));
children.push(new ShowMoreNode('Results', this, this.view));
}
return children;

+ 8
- 8
src/views/nodes/resultsComparisonNode.ts Näytä tiedosto

@ -4,17 +4,17 @@ import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import { GitService, GitUri } from '../../git/gitService';
import { Strings } from '../../system';
import { ResultsExplorer } from '../resultsExplorer';
import { ExplorerNode, NamedRef, ResourceType } from './explorerNode';
import { ResultsView } from '../resultsView';
import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode';
import { ResultsFilesNode } from './resultsFilesNode';
import { NamedRef, ResourceType, ViewNode } from './viewNode';
export class ResultsComparisonNode extends ExplorerNode {
export class ResultsComparisonNode extends ViewNode {
constructor(
public readonly repoPath: string,
ref1: NamedRef,
ref2: NamedRef,
public readonly explorer: ResultsExplorer
public readonly view: ResultsView
) {
super(GitUri.fromRepoPath(repoPath), undefined);
@ -32,10 +32,10 @@ export class ResultsComparisonNode extends ExplorerNode {
return this._ref2;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
return [
new ResultsCommitsNode(this.uri.repoPath!, this.getCommitsQuery.bind(this), this, this.explorer),
new ResultsFilesNode(this.uri.repoPath!, this._ref1.ref, this._ref2.ref, this, this.explorer)
new ResultsCommitsNode(this.uri.repoPath!, this.getCommitsQuery.bind(this), this, this.view),
new ResultsFilesNode(this.uri.repoPath!, this._ref1.ref, this._ref2.ref, this, this.view)
];
}
@ -62,7 +62,7 @@ export class ResultsComparisonNode extends ExplorerNode {
this._ref1 = this._ref2;
this._ref2 = ref1;
this.explorer.triggerNodeUpdate(this);
this.view.triggerNodeUpdate(this);
}
private async getCommitsQuery(maxCount: number | undefined): Promise<CommitsQueryResults> {

+ 6
- 6
src/views/nodes/resultsFileNode.ts Näytä tiedosto

@ -4,22 +4,22 @@ import { Command, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Commands, DiffWithCommandArgs } from '../../commands';
import { Container } from '../../container';
import { GitFile, GitUri, IStatusFormatOptions, StatusFileFormatter } from '../../git/gitService';
import { Explorer } from '../explorer';
import { ExplorerNode, ResourceType } from './explorerNode';
import { View } from '../viewBase';
import { ResourceType, ViewNode } from './viewNode';
export class ResultsFileNode extends ExplorerNode {
export class ResultsFileNode extends ViewNode {
constructor(
public readonly repoPath: string,
public readonly file: GitFile,
public readonly ref1: string,
public readonly ref2: string,
parent: ExplorerNode,
public readonly explorer: Explorer
parent: ViewNode,
public readonly view: View
) {
super(GitUri.fromFile(file, repoPath, ref1 ? ref1 : ref2 ? ref2 : undefined), parent);
}
getChildren(): ExplorerNode[] {
getChildren(): ViewNode[] {
return [];
}

+ 14
- 17
src/views/nodes/resultsFilesNode.ts Näytä tiedosto

@ -1,52 +1,49 @@
'use strict';
import * as path from 'path';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerFilesLayout } from '../../configuration';
import { ViewFilesLayout } from '../../configuration';
import { Container } from '../../container';
import { GitFile, GitUri } from '../../git/gitService';
import { Arrays, Iterables, Strings } from '../../system';
import { Explorer } from '../explorer';
import { ExplorerNode, ResourceType } from './explorerNode';
import { FileExplorerNode, FolderNode } from './folderNode';
import { View } from '../viewBase';
import { FileNode, FolderNode } from './folderNode';
import { ResultsFileNode } from './resultsFileNode';
import { ResourceType, ViewNode } from './viewNode';
export interface FilesQueryResults {
label: string;
diff: GitFile[] | undefined;
}
export class ResultsFilesNode extends ExplorerNode {
export class ResultsFilesNode extends ViewNode {
constructor(
public readonly repoPath: string,
private readonly _ref1: string,
private readonly _ref2: string,
parent: ExplorerNode,
public readonly explorer: Explorer
parent: ViewNode,
public readonly view: View
) {
super(GitUri.fromRepoPath(repoPath), parent);
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const { diff } = await this.getFilesQueryResults();
if (diff === undefined) return [];
let children: FileExplorerNode[] = [
...Iterables.map(
diff,
s => new ResultsFileNode(this.repoPath, s, this._ref1, this._ref2, this, this.explorer)
)
let children: FileNode[] = [
...Iterables.map(diff, s => new ResultsFileNode(this.repoPath, s, this._ref1, this._ref2, this, this.view))
];
if (this.explorer.config.files.layout !== ExplorerFilesLayout.List) {
if (this.view.config.files.layout !== ViewFilesLayout.List) {
const hierarchy = Arrays.makeHierarchical(
children,
n => n.uri.getRelativePath().split('/'),
(...paths: string[]) => Strings.normalizePath(path.join(...paths)),
this.explorer.config.files.compact
this.view.config.files.compact
);
const root = new FolderNode(this.repoPath, '', undefined, hierarchy, this, this.explorer);
children = (await root.getChildren()) as FileExplorerNode[];
const root = new FolderNode(this.repoPath, '', undefined, hierarchy, this, this.view);
children = (await root.getChildren()) as FileNode[];
}
else {
children.sort((a, b) => a.priority - b.priority || a.label!.localeCompare(b.label!));

+ 11
- 11
src/views/nodes/resultsNode.ts Näytä tiedosto

@ -4,20 +4,20 @@ import { ShowCommitSearchCommandArgs } from '../../commands';
import { GlyphChars } from '../../constants';
import { GitRepoSearchBy } from '../../git/gitService';
import { Strings } from '../../system';
import { ResultsExplorer } from '../resultsExplorer';
import { ResultsView } from '../resultsView';
import { CommandMessageNode, MessageNode } from './common';
import { ExplorerNode, ResourceType, unknownGitUri } from './explorerNode';
import { ResourceType, unknownGitUri, ViewNode } from './viewNode';
export class ResultsNode extends ExplorerNode {
private _children: (ExplorerNode | MessageNode)[] = [];
export class ResultsNode extends ViewNode {
private _children: (ViewNode | MessageNode)[] = [];
constructor(
public readonly explorer: ResultsExplorer
public readonly view: ResultsView
) {
super(unknownGitUri, undefined);
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
if (this._children.length === 0) {
const command = {
title: 'Search Commits',
@ -100,7 +100,7 @@ export class ResultsNode extends ExplorerNode {
return item;
}
addOrReplace(results: ExplorerNode, replace: boolean) {
addOrReplace(results: ViewNode, replace: boolean) {
if (this._children.includes(results)) return;
if (this._children.length !== 0 && replace) {
@ -111,24 +111,24 @@ export class ResultsNode extends ExplorerNode {
this._children.splice(0, 0, results);
}
this.explorer.triggerNodeUpdate();
this.view.triggerNodeUpdate();
}
clear() {
if (this._children.length === 0) return;
this._children.length = 0;
this.explorer.triggerNodeUpdate();
this.view.triggerNodeUpdate();
}
dismiss(node: ExplorerNode) {
dismiss(node: ViewNode) {
if (this._children.length === 0) return;
const index = this._children.findIndex(n => n === node);
if (index === -1) return;
this._children.splice(index, 1);
this.explorer.triggerNodeUpdate();
this.view.triggerNodeUpdate();
}
async refresh() {

+ 6
- 6
src/views/nodes/stashFileNode.ts Näytä tiedosto

@ -1,12 +1,12 @@
'use strict';
import { GitFile, GitLogCommit } from '../../git/gitService';
import { Explorer } from '../explorer';
import { View } from '../viewBase';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { ResourceType, ViewNode } from './viewNode';
export class StashFileNode extends CommitFileNode {
constructor(file: GitFile, commit: GitLogCommit, parent: ExplorerNode, explorer: Explorer) {
super(file, commit, parent, explorer, CommitFileNodeDisplayAs.File);
constructor(file: GitFile, commit: GitLogCommit, parent: ViewNode, view: View) {
super(file, commit, parent, view, CommitFileNodeDisplayAs.File);
}
protected get resourceType(): ResourceType {
@ -14,10 +14,10 @@ export class StashFileNode extends CommitFileNode {
}
protected getCommitTemplate() {
return this.explorer.config.stashFormat;
return this.view.config.stashFormat;
}
protected getCommitFileTemplate() {
return this.explorer.config.stashFileFormat;
return this.view.config.stashFileFormat;
}
}

+ 8
- 8
src/views/nodes/stashNode.ts Näytä tiedosto

@ -3,15 +3,15 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { CommitFormatter, GitStashCommit, ICommitFormatOptions } from '../../git/gitService';
import { Iterables } from '../../system';
import { Explorer } from '../explorer';
import { ExplorerNode, ExplorerRefNode, ResourceType } from './explorerNode';
import { View } from '../viewBase';
import { StashFileNode } from './stashFileNode';
import { ResourceType, ViewNode, ViewRefNode } from './viewNode';
export class StashNode extends ExplorerRefNode {
export class StashNode extends ViewRefNode {
constructor(
public readonly commit: GitStashCommit,
parent: ExplorerNode,
public readonly explorer: Explorer
parent: ViewNode,
public readonly view: View
) {
super(commit.toGitUri(), parent);
}
@ -24,7 +24,7 @@ export class StashNode extends ExplorerRefNode {
return this.commit.sha;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const files = (this.commit as GitStashCommit).files;
// Check for any untracked files -- since git doesn't return them via `git stash list` :(
@ -41,14 +41,14 @@ export class StashNode extends ExplorerRefNode {
}
}
const children = files.map(s => new StashFileNode(s, this.commit.toFileCommit(s), this, this.explorer));
const children = files.map(s => new StashFileNode(s, this.commit.toFileCommit(s), this, this.view));
children.sort((a, b) => a.label!.localeCompare(b.label!));
return children;
}
getTreeItem(): TreeItem {
const item = new TreeItem(
CommitFormatter.fromTemplate(this.explorer.config.stashFormat, this.commit, {
CommitFormatter.fromTemplate(this.view.config.stashFormat, this.commit, {
truncateMessageAtNewLine: true,
dateFormat: Container.config.defaultDateFormat
} as ICommitFormatOptions),

+ 7
- 7
src/views/nodes/stashesNode.ts Näytä tiedosto

@ -3,17 +3,17 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { GitUri, Repository } from '../../git/gitService';
import { Iterables } from '../../system';
import { Explorer } from '../explorer';
import { View } from '../viewBase';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType } from './explorerNode';
import { StashNode } from './stashNode';
import { ResourceType, ViewNode } from './viewNode';
export class StashesNode extends ExplorerNode {
export class StashesNode extends ViewNode {
constructor(
uri: GitUri,
public readonly repo: Repository,
parent: ExplorerNode,
public readonly explorer: Explorer
parent: ViewNode,
public readonly view: View
) {
super(uri, parent);
}
@ -22,11 +22,11 @@ export class StashesNode extends ExplorerNode {
return `gitlens:repository(${this.repo.path}):stashes`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const stash = await this.repo.getStashList();
if (stash === undefined) return [new MessageNode(this, 'No stashed changes')];
return [...Iterables.map(stash.commits.values(), c => new StashNode(c, this, this.explorer))];
return [...Iterables.map(stash.commits.values(), c => new StashNode(c, this, this.view))];
}
getTreeItem(): TreeItem {

+ 9
- 9
src/views/nodes/statusFileNode.ts Näytä tiedosto

@ -12,11 +12,11 @@ import {
StatusFileFormatter
} from '../../git/gitService';
import { Strings } from '../../system';
import { Explorer } from '../explorer';
import { View } from '../viewBase';
import { CommitFileNode, CommitFileNodeDisplayAs } from './commitFileNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { ResourceType, ViewNode } from './viewNode';
export class StatusFileNode extends ExplorerNode {
export class StatusFileNode extends ViewNode {
private readonly _hasStagedChanges: boolean = false;
private readonly _hasUnstagedChanges: boolean = false;
@ -24,8 +24,8 @@ export class StatusFileNode extends ExplorerNode {
public readonly repoPath: string,
public readonly file: GitFile,
public readonly commits: GitLogCommit[],
parent: ExplorerNode,
public readonly explorer: Explorer
parent: ViewNode,
public readonly view: View
) {
super(GitUri.fromFile(file, repoPath, 'HEAD'), parent);
@ -41,16 +41,16 @@ export class StatusFileNode extends ExplorerNode {
}
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
return this.commits.map(
c =>
new CommitFileNode(
this.file,
c,
this,
this.explorer,
this.view,
CommitFileNodeDisplayAs.CommitLabel |
(this.explorer.config.avatars
(this.view.config.avatars
? CommitFileNodeDisplayAs.Gravatar
: CommitFileNodeDisplayAs.CommitIcon)
)
@ -132,7 +132,7 @@ export class StatusFileNode extends ExplorerNode {
get label() {
if (this._label === undefined) {
this._label = StatusFileFormatter.fromTemplate(
this.explorer.config.statusFileFormat,
this.view.config.statusFileFormat,
{
...this.file,
commit: this.commit

+ 15
- 15
src/views/nodes/statusFilesNode.ts Näytä tiedosto

@ -1,7 +1,7 @@
'use strict';
import * as path from 'path';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerFilesLayout } from '../../configuration';
import { ViewFilesLayout } from '../../configuration';
import { Container } from '../../container';
import { GitStatusFile } from '../../git/git';
import {
@ -14,19 +14,19 @@ import {
GitUri
} from '../../git/gitService';
import { Arrays, Iterables, Objects, Strings } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { ExplorerNode, ResourceType } from './explorerNode';
import { FileExplorerNode, FolderNode } from './folderNode';
import { RepositoriesView } from '../repositoriesView';
import { FileNode, FolderNode } from './folderNode';
import { StatusFileNode } from './statusFileNode';
import { ResourceType, ViewNode } from './viewNode';
export class StatusFilesNode extends ExplorerNode {
export class StatusFilesNode extends ViewNode {
readonly repoPath: string;
constructor(
public readonly status: GitStatus,
public readonly range: string | undefined,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(GitUri.fromRepoPath(status.repoPath), parent);
this.repoPath = status.repoPath;
@ -36,7 +36,7 @@ export class StatusFilesNode extends ExplorerNode {
return `gitlens:repository(${this.status.repoPath}):status:files`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
let files: GitFileWithCommit[] = [];
const repoPath = this.repoPath;
@ -82,24 +82,24 @@ export class StatusFilesNode extends ExplorerNode {
const groups = Arrays.groupBy(files, s => s.fileName);
let children: FileExplorerNode[] = [
let children: FileNode[] = [
...Iterables.map(
Objects.values(groups),
files =>
new StatusFileNode(repoPath, files[files.length - 1], files.map(s => s.commit), this, this.explorer)
new StatusFileNode(repoPath, files[files.length - 1], files.map(s => s.commit), this, this.view)
)
];
if (this.explorer.config.files.layout !== ExplorerFilesLayout.List) {
if (this.view.config.files.layout !== ViewFilesLayout.List) {
const hierarchy = Arrays.makeHierarchical(
children,
n => n.uri.getRelativePath().split('/'),
(...paths: string[]) => Strings.normalizePath(path.join(...paths)),
this.explorer.config.files.compact
this.view.config.files.compact
);
const root = new FolderNode(repoPath, '', undefined, hierarchy, this, this.explorer);
children = (await root.getChildren()) as FileExplorerNode[];
const root = new FolderNode(repoPath, '', undefined, hierarchy, this, this.view);
children = (await root.getChildren()) as FileNode[];
}
else {
children.sort((a, b) => a.priority - b.priority || a.label!.localeCompare(b.label!));
@ -147,7 +147,7 @@ export class StatusFilesNode extends ExplorerNode {
}
private get includeWorkingTree(): boolean {
return this.explorer.config.includeWorkingTree;
return this.view.config.includeWorkingTree;
}
private toStatusFile(file: GitStatusFile, ref: string, previousRef: string, date?: Date): GitFileWithCommit {

+ 10
- 10
src/views/nodes/statusUpstreamNode.ts Näytä tiedosto

@ -3,21 +3,21 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../../container';
import { GitStatus, GitUri } from '../../git/gitService';
import { Iterables, Strings } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { CommitNode } from './commitNode';
import { ShowMoreNode } from './common';
import { ExplorerNode, PageableExplorerNode, ResourceType } from './explorerNode';
import { insertDateMarkers } from './helpers';
import { PageableViewNode, ResourceType, ViewNode } from './viewNode';
export class StatusUpstreamNode extends ExplorerNode implements PageableExplorerNode {
export class StatusUpstreamNode extends ViewNode implements PageableViewNode {
readonly supportsPaging: boolean = true;
maxCount: number | undefined;
constructor(
public readonly status: GitStatus,
public readonly direction: 'ahead' | 'behind',
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(GitUri.fromRepoPath(status.repoPath), parent);
}
@ -26,14 +26,14 @@ export class StatusUpstreamNode extends ExplorerNode implements PageableExplorer
return `gitlens:repository(${this.status.repoPath}):status:upstream:${this.direction}`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const ahead = this.direction === 'ahead';
const range = ahead
? `${this.status.upstream}..${this.status.ref}`
: `${this.status.ref}..${this.status.upstream}`;
const log = await Container.git.getLog(this.uri.repoPath!, {
maxCount: this.maxCount || this.explorer.config.defaultItemLimit,
maxCount: this.maxCount || this.view.config.defaultItemLimit,
ref: range
});
if (log === undefined) return [];
@ -50,12 +50,12 @@ export class StatusUpstreamNode extends ExplorerNode implements PageableExplorer
}
}
children = [...insertDateMarkers(commits.map(c => new CommitNode(c, this, this.explorer)), this, 1)];
children = [...insertDateMarkers(commits.map(c => new CommitNode(c, this, this.view)), this, 1)];
}
else {
children = [
...insertDateMarkers(
Iterables.map(log.commits.values(), c => new CommitNode(c, this, this.explorer)),
Iterables.map(log.commits.values(), c => new CommitNode(c, this, this.view)),
this,
1
)
@ -63,7 +63,7 @@ export class StatusUpstreamNode extends ExplorerNode implements PageableExplorer
}
if (log.truncated) {
children.push(new ShowMoreNode('Commits', this, this.explorer));
children.push(new ShowMoreNode('Commits', this, this.view));
}
return children;
}

+ 11
- 13
src/views/nodes/tagNode.ts Näytä tiedosto

@ -1,24 +1,24 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerBranchesLayout } from '../../configuration';
import { ViewBranchesLayout } from '../../configuration';
import { Container } from '../../container';
import { GitTag, GitUri } from '../../git/gitService';
import { Iterables } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { CommitNode } from './commitNode';
import { MessageNode, ShowMoreNode } from './common';
import { ExplorerNode, ExplorerRefNode, PageableExplorerNode, ResourceType } from './explorerNode';
import { insertDateMarkers } from './helpers';
import { PageableViewNode, ResourceType, ViewNode, ViewRefNode } from './viewNode';
export class TagNode extends ExplorerRefNode implements PageableExplorerNode {
export class TagNode extends ViewRefNode implements PageableViewNode {
readonly supportsPaging: boolean = true;
maxCount: number | undefined;
constructor(
public readonly tag: GitTag,
uri: GitUri,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(uri, parent);
}
@ -28,28 +28,26 @@ export class TagNode extends ExplorerRefNode implements PageableExplorerNode {
}
get label(): string {
return this.explorer.config.branches.layout === ExplorerBranchesLayout.Tree
? this.tag.getBasename()
: this.tag.name;
return this.view.config.branches.layout === ViewBranchesLayout.Tree ? this.tag.getBasename() : this.tag.name;
}
get ref(): string {
return this.tag.name;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const log = await Container.git.getLog(this.uri.repoPath!, {
maxCount: this.maxCount || this.explorer.config.defaultItemLimit,
maxCount: this.maxCount || this.view.config.defaultItemLimit,
ref: this.tag.name
});
if (log === undefined) return [new MessageNode(this, 'No commits yet')];
const children = [
...insertDateMarkers(Iterables.map(log.commits.values(), c => new CommitNode(c, this, this.explorer)), this)
...insertDateMarkers(Iterables.map(log.commits.values(), c => new CommitNode(c, this, this.view)), this)
];
if (log.truncated) {
children.push(new ShowMoreNode('Commits', this, this.explorer));
children.push(new ShowMoreNode('Commits', this, this.view));
}
return children;
}

+ 11
- 11
src/views/nodes/tagsNode.ts Näytä tiedosto

@ -1,21 +1,21 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerBranchesLayout } from '../../configuration';
import { ViewBranchesLayout } from '../../configuration';
import { Container } from '../../container';
import { GitUri, Repository } from '../../git/gitService';
import { Arrays } from '../../system';
import { RepositoriesExplorer } from '../repositoriesExplorer';
import { RepositoriesView } from '../repositoriesView';
import { BranchOrTagFolderNode } from './branchOrTagFolderNode';
import { MessageNode } from './common';
import { ExplorerNode, ResourceType } from './explorerNode';
import { TagNode } from './tagNode';
import { ResourceType, ViewNode } from './viewNode';
export class TagsNode extends ExplorerNode {
export class TagsNode extends ViewNode {
constructor(
uri: GitUri,
public readonly repo: Repository,
parent: ExplorerNode,
public readonly explorer: RepositoriesExplorer
parent: ViewNode,
public readonly view: RepositoriesView
) {
super(uri, parent);
}
@ -24,22 +24,22 @@ export class TagsNode extends ExplorerNode {
return `gitlens:repository(${this.repo.path}):tags`;
}
async getChildren(): Promise<ExplorerNode[]> {
async getChildren(): Promise<ViewNode[]> {
const tags = await this.repo.getTags();
if (tags.length === 0) return [new MessageNode(this, 'No tags yet')];
tags.sort((a, b) => a.name.localeCompare(b.name));
const tagNodes = [...tags.map(t => new TagNode(t, this.uri, this, this.explorer))];
if (this.explorer.config.branches.layout === ExplorerBranchesLayout.List) return tagNodes;
const tagNodes = [...tags.map(t => new TagNode(t, this.uri, this, this.view))];
if (this.view.config.branches.layout === ViewBranchesLayout.List) return tagNodes;
const hierarchy = Arrays.makeHierarchical(
tagNodes,
n => n.tag.name.split('/'),
(...paths: string[]) => paths.join('/'),
this.explorer.config.files.compact
this.view.config.files.compact
);
const root = new BranchOrTagFolderNode('tag', this.repo.path, '', undefined, hierarchy, this, this.explorer);
const root = new BranchOrTagFolderNode('tag', this.repo.path, '', undefined, hierarchy, this, this.view);
const children = (await root.getChildren()) as (BranchOrTagFolderNode | TagNode)[];
return children;
}

src/views/nodes/explorerNode.ts → src/views/nodes/viewNode.ts Näytä tiedosto

@ -1,7 +1,7 @@
'use strict';
import { Command, Disposable, Event, TreeItem, TreeViewVisibilityChangeEvent } from 'vscode';
import { GitUri } from '../../git/gitService';
import { Explorer, RefreshReason } from '../explorer';
import { RefreshReason, View } from '../viewBase';
export enum ResourceType {
ActiveFileHistory = 'gitlens:active:history-file',
@ -51,10 +51,10 @@ export interface NamedRef {
export const unknownGitUri = new GitUri();
export abstract class ExplorerNode {
export abstract class ViewNode {
constructor(
uri: GitUri,
private readonly _parent: ExplorerNode | undefined
private readonly _parent: ViewNode | undefined
) {
this._uri = uri;
}
@ -64,8 +64,8 @@ export abstract class ExplorerNode {
return this._uri;
}
abstract getChildren(): ExplorerNode[] | Promise<ExplorerNode[]>;
getParent(): ExplorerNode | undefined {
abstract getChildren(): ViewNode[] | Promise<ViewNode[]>;
getParent(): ViewNode | undefined {
return this._parent;
}
abstract getTreeItem(): TreeItem | Promise<TreeItem>;
@ -77,7 +77,7 @@ export abstract class ExplorerNode {
refresh(reason?: RefreshReason): void | boolean | Promise<void> | Promise<boolean> {}
}
export abstract class ExplorerRefNode extends ExplorerNode {
export abstract class ViewRefNode extends ViewNode {
abstract get ref(): string;
get repoPath(): string {
@ -85,38 +85,38 @@ export abstract class ExplorerRefNode extends ExplorerNode {
}
}
export interface PageableExplorerNode {
export interface PageableViewNode {
readonly supportsPaging: boolean;
maxCount: number | undefined;
}
export function isPageable(
node: ExplorerNode
): node is ExplorerNode & { supportsPaging: boolean; maxCount: number | undefined } {
node: ViewNode
): node is ViewNode & { supportsPaging: boolean; maxCount: number | undefined } {
return Boolean((node as any).supportsPaging);
}
export function supportsAutoRefresh(
explorer: Explorer
): explorer is Explorer & { autoRefresh: boolean; onDidChangeAutoRefresh: Event<void> } {
return (explorer as any).onDidChangeAutoRefresh !== undefined;
view: View
): view is View & { autoRefresh: boolean; onDidChangeAutoRefresh: Event<void> } {
return (view as any).onDidChangeAutoRefresh !== undefined;
}
export abstract class SubscribeableExplorerNode<TExplorer extends Explorer> extends ExplorerNode {
export abstract class SubscribeableViewNode<TView extends View> extends ViewNode {
protected _disposable: Disposable;
protected _subscription: Disposable | undefined;
constructor(
uri: GitUri,
parent: ExplorerNode | undefined,
public readonly explorer: TExplorer
parent: ViewNode | undefined,
public readonly view: TView
) {
super(uri, parent);
const disposables = [this.explorer.onDidChangeVisibility(this.onVisibilityChanged, this)];
const disposables = [this.view.onDidChangeVisibility(this.onVisibilityChanged, this)];
if (supportsAutoRefresh(this.explorer)) {
disposables.push(this.explorer.onDidChangeAutoRefresh(this.onAutoRefreshChanged, this));
if (supportsAutoRefresh(this.view)) {
disposables.push(this.view.onDidChangeAutoRefresh(this.onAutoRefreshChanged, this));
}
this._disposable = Disposable.from(...disposables);
@ -141,7 +141,7 @@ export abstract class SubscribeableExplorerNode exte
void this.ensureSubscription();
if (value) {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}
@ -154,24 +154,20 @@ export abstract class SubscribeableExplorerNode exte
}
protected onAutoRefreshChanged() {
this.onVisibilityChanged({ visible: this.explorer.visible });
this.onVisibilityChanged({ visible: this.view.visible });
}
protected onVisibilityChanged(e: TreeViewVisibilityChangeEvent) {
void this.ensureSubscription();
if (e.visible) {
void this.explorer.refreshNode(this);
void this.view.refreshNode(this);
}
}
async ensureSubscription() {
// We only need to subscribe if we are visible and if auto-refresh enabled (when supported)
if (
!this.canSubscribe ||
!this.explorer.visible ||
(supportsAutoRefresh(this.explorer) && !this.explorer.autoRefresh)
) {
if (!this.canSubscribe || !this.view.visible || (supportsAutoRefresh(this.view) && !this.view.autoRefresh)) {
this.unsubscribe();
return;

src/views/repositoriesExplorer.ts → src/views/repositoriesView.ts Näytä tiedosto

@ -1,16 +1,16 @@
'use strict';
import { commands, ConfigurationChangeEvent, Event, EventEmitter } from 'vscode';
import { configuration, ExplorerFilesLayout, ExplorersConfig, RepositoriesExplorerConfig } from '../configuration';
import { configuration, RepositoriesViewConfig, ViewFilesLayout, ViewsConfig } from '../configuration';
import { CommandContext, setCommandContext, WorkspaceState } from '../constants';
import { Container } from '../container';
import { ExplorerBase, RefreshReason } from './explorer';
import { RefreshNodeCommandArgs } from './explorerCommands';
import { RepositoriesNode } from './nodes';
import { ExplorerNode } from './nodes/explorerNode';
import { ViewNode } from './nodes/viewNode';
import { RefreshReason, ViewBase } from './viewBase';
import { RefreshNodeCommandArgs } from './viewCommands';
export class RepositoriesExplorer extends ExplorerBase<RepositoriesNode> {
export class RepositoriesView extends ViewBase<RepositoriesNode> {
constructor() {
super('gitlens.repositoriesExplorer');
super('gitlens.views.repositories');
}
private _onDidChangeAutoRefresh = new EventEmitter<void>();
@ -23,7 +23,7 @@ export class RepositoriesExplorer extends ExplorerBase {
}
protected registerCommands() {
Container.explorerCommands;
Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('fetchAll'), () => this.fetchAll(), this);
commands.registerCommand(this.getQualifiedCommand('pullAll'), () => this.pullAll(), this);
@ -31,33 +31,33 @@ export class RepositoriesExplorer extends ExplorerBase {
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);
commands.registerCommand(
this.getQualifiedCommand('refreshNode'),
(node: ExplorerNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
(node: ViewNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToAuto'),
() => this.setFilesLayout(ExplorerFilesLayout.Auto),
() => this.setFilesLayout(ViewFilesLayout.Auto),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToList'),
() => this.setFilesLayout(ExplorerFilesLayout.List),
() => this.setFilesLayout(ViewFilesLayout.List),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToTree'),
() => this.setFilesLayout(ExplorerFilesLayout.Tree),
() => this.setFilesLayout(ViewFilesLayout.Tree),
this
);
commands.registerCommand(
this.getQualifiedCommand('setAutoRefreshToOn'),
() => this.setAutoRefresh(Container.config.repositoriesExplorer.autoRefresh, true),
() => this.setAutoRefresh(Container.config.views.repositories.autoRefresh, true),
this
);
commands.registerCommand(
this.getQualifiedCommand('setAutoRefreshToOff'),
() => this.setAutoRefresh(Container.config.repositoriesExplorer.autoRefresh, false),
() => this.setAutoRefresh(Container.config.views.repositories.autoRefresh, false),
this
);
}
@ -67,8 +67,8 @@ export class RepositoriesExplorer extends ExplorerBase {
if (
!initializing &&
!configuration.changed(e, configuration.name('repositoriesExplorer').value) &&
!configuration.changed(e, configuration.name('explorers').value) &&
!configuration.changed(e, configuration.name('views')('repositories').value) &&
!configuration.changed(e, configuration.name('views').value) &&
!configuration.changed(e, configuration.name('defaultGravatarsStyle').value)
) {
return;
@ -76,17 +76,17 @@ export class RepositoriesExplorer extends ExplorerBase {
if (
initializing ||
configuration.changed(e, configuration.name('repositoriesExplorer')('enabled').value) ||
configuration.changed(e, configuration.name('repositoriesExplorer')('location').value)
configuration.changed(e, configuration.name('views')('repositories')('enabled').value) ||
configuration.changed(e, configuration.name('views')('repositories')('location').value)
) {
setCommandContext(CommandContext.RepositoriesExplorer, this.config.enabled ? this.config.location : false);
setCommandContext(CommandContext.ViewsRepositories, this.config.enabled ? this.config.location : false);
}
if (configuration.changed(e, configuration.name('repositoriesExplorer')('autoRefresh').value)) {
void this.setAutoRefresh(Container.config.repositoriesExplorer.autoRefresh);
if (configuration.changed(e, configuration.name('views')('repositories')('autoRefresh').value)) {
void this.setAutoRefresh(Container.config.views.repositories.autoRefresh);
}
if (initializing || configuration.changed(e, configuration.name('repositoriesExplorer')('location').value)) {
if (initializing || configuration.changed(e, configuration.name('views')('repositories')('location').value)) {
this.initialize(this.config.location);
}
@ -98,12 +98,12 @@ export class RepositoriesExplorer extends ExplorerBase {
get autoRefresh() {
return (
this.config.autoRefresh &&
Container.context.workspaceState.get<boolean>(WorkspaceState.RepositoriesExplorerAutoRefresh, true)
Container.context.workspaceState.get<boolean>(WorkspaceState.ViewsRepositoriesAutoRefresh, true)
);
}
get config(): ExplorersConfig & RepositoriesExplorerConfig {
return { ...Container.config.explorers, ...Container.config.repositoriesExplorer };
get config(): ViewsConfig & RepositoriesViewConfig {
return { ...Container.config.views, ...Container.config.views.repositories };
}
private fetchAll() {
@ -122,26 +122,26 @@ export class RepositoriesExplorer extends ExplorerBase {
if (enabled) {
if (workspaceEnabled === undefined) {
workspaceEnabled = Container.context.workspaceState.get<boolean>(
WorkspaceState.RepositoriesExplorerAutoRefresh,
WorkspaceState.ViewsRepositoriesAutoRefresh,
true
);
}
else {
await Container.context.workspaceState.update(
WorkspaceState.RepositoriesExplorerAutoRefresh,
WorkspaceState.ViewsRepositoriesAutoRefresh,
workspaceEnabled
);
}
}
setCommandContext(CommandContext.RepositoriesExplorerAutoRefresh, enabled && workspaceEnabled);
setCommandContext(CommandContext.ViewsRepositoriesAutoRefresh, enabled && workspaceEnabled);
this._onDidChangeAutoRefresh.fire();
}
private setFilesLayout(layout: ExplorerFilesLayout) {
private setFilesLayout(layout: ViewFilesLayout) {
return configuration.updateEffective(
configuration.name('repositoriesExplorer')('files')('layout').value,
configuration.name('views')('repositories')('files')('layout').value,
layout
);
}

src/views/resultsExplorer.ts → src/views/resultsView.ts Näytä tiedosto

@ -1,27 +1,27 @@
'use strict';
import { commands, ConfigurationChangeEvent } from 'vscode';
import { configuration, ExplorerFilesLayout, ExplorersConfig, ResultsExplorerConfig } from '../configuration';
import { configuration, ResultsViewConfig, ViewFilesLayout, ViewsConfig } from '../configuration';
import { CommandContext, GlyphChars, setCommandContext, WorkspaceState } from '../constants';
import { Container } from '../container';
import { GitLog, GitLogCommit } from '../git/gitService';
import { Functions, Strings } from '../system';
import { ExplorerBase, RefreshReason } from './explorer';
import { RefreshNodeCommandArgs } from './explorerCommands';
import {
ExplorerNode,
NamedRef,
ResourceType,
ResultsCommitNode,
ResultsCommitsNode,
ResultsComparisonNode,
ResultsNode
ResultsNode,
ViewNode
} from './nodes';
import { RefreshReason, ViewBase } from './viewBase';
import { RefreshNodeCommandArgs } from './viewCommands';
export class ResultsExplorer extends ExplorerBase<ResultsNode> {
export class ResultsView extends ViewBase<ResultsNode> {
constructor() {
super('gitlens.resultsExplorer');
super('gitlens.views.results');
setCommandContext(CommandContext.ResultsExplorerKeepResults, this.keepResults);
setCommandContext(CommandContext.ViewsResultsKeepResults, this.keepResults);
}
getRoot() {
@ -29,32 +29,32 @@ export class ResultsExplorer extends ExplorerBase {
}
protected registerCommands() {
Container.explorerCommands;
Container.viewCommands;
commands.registerCommand(this.getQualifiedCommand('refresh'), () => this.refresh(), this);
commands.registerCommand(
this.getQualifiedCommand('refreshNode'),
(node: ExplorerNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
(node: ViewNode, args?: RefreshNodeCommandArgs) => this.refreshNode(node, args),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToAuto'),
() => this.setFilesLayout(ExplorerFilesLayout.Auto),
() => this.setFilesLayout(ViewFilesLayout.Auto),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToList'),
() => this.setFilesLayout(ExplorerFilesLayout.List),
() => this.setFilesLayout(ViewFilesLayout.List),
this
);
commands.registerCommand(
this.getQualifiedCommand('setFilesLayoutToTree'),
() => this.setFilesLayout(ExplorerFilesLayout.Tree),
() => this.setFilesLayout(ViewFilesLayout.Tree),
this
);
commands.registerCommand(
this.getQualifiedCommand('dismissNode'),
(node: ExplorerNode) => this.dismissNode(node),
(node: ViewNode) => this.dismissNode(node),
this
);
commands.registerCommand(this.getQualifiedCommand('close'), () => this.close(), this);
@ -72,18 +72,18 @@ export class ResultsExplorer extends ExplorerBase {
if (
!initializing &&
!configuration.changed(e, configuration.name('resultsExplorer').value) &&
!configuration.changed(e, configuration.name('explorers').value) &&
!configuration.changed(e, configuration.name('views')('results').value) &&
!configuration.changed(e, configuration.name('views').value) &&
!configuration.changed(e, configuration.name('defaultGravatarsStyle').value)
) {
return;
}
if (initializing || configuration.changed(e, configuration.name('resultsExplorer')('location').value)) {
setCommandContext(CommandContext.ResultsExplorer, this.enabled ? this.config.location : false);
if (initializing || configuration.changed(e, configuration.name('views')('results')('location').value)) {
setCommandContext(CommandContext.ViewsResults, this.enabled ? this.config.location : false);
}
if (initializing || configuration.changed(e, configuration.name('resultsExplorer')('location').value)) {
if (initializing || configuration.changed(e, configuration.name('views')('results')('location').value)) {
this.initialize(this.config.location);
}
@ -92,8 +92,8 @@ export class ResultsExplorer extends ExplorerBase {
}
}
get config(): ExplorersConfig & ResultsExplorerConfig {
return { ...Container.config.explorers, ...Container.config.resultsExplorer };
get config(): ViewsConfig & ResultsViewConfig {
return { ...Container.config.views, ...Container.config.views.results };
}
private _enabled: boolean = false;
@ -102,7 +102,7 @@ export class ResultsExplorer extends ExplorerBase {
}
get keepResults(): boolean {
return Container.context.workspaceState.get<boolean>(WorkspaceState.ResultsExplorerKeepResults, false);
return Container.context.workspaceState.get<boolean>(WorkspaceState.ViewsResultsKeepResults, false);
}
close() {
@ -111,7 +111,7 @@ export class ResultsExplorer extends ExplorerBase {
this._root.clear();
this._enabled = false;
setCommandContext(CommandContext.ResultsExplorer, false);
setCommandContext(CommandContext.ViewsResults, false);
}
addCommit(commit: GitLogCommit) {
@ -189,7 +189,7 @@ export class ResultsExplorer extends ExplorerBase {
);
}
private async addResults(results: ExplorerNode) {
private async addResults(results: ViewNode) {
if (this._root === undefined) {
this._root = this.getRoot();
}
@ -197,27 +197,27 @@ export class ResultsExplorer extends ExplorerBase {
this._root.addOrReplace(results, !this.keepResults);
this._enabled = true;
await setCommandContext(CommandContext.ResultsExplorer, this.config.location);
await setCommandContext(CommandContext.ViewsResults, this.config.location);
setTimeout(() => this._tree!.reveal(results, { select: true }), 250);
}
private dismissNode(node: ExplorerNode) {
private dismissNode(node: ViewNode) {
if (this._root === undefined) return;
this._root.dismiss(node);
}
private setFilesLayout(layout: ExplorerFilesLayout) {
return configuration.updateEffective(configuration.name('resultsExplorer')('files')('layout').value, layout);
private setFilesLayout(layout: ViewFilesLayout) {
return configuration.updateEffective(configuration.name('views')('results')('files')('layout').value, layout);
}
private setKeepResults(enabled: boolean) {
Container.context.workspaceState.update(WorkspaceState.ResultsExplorerKeepResults, enabled);
setCommandContext(CommandContext.ResultsExplorerKeepResults, enabled);
Container.context.workspaceState.update(WorkspaceState.ViewsResultsKeepResults, enabled);
setCommandContext(CommandContext.ViewsResultsKeepResults, enabled);
}
private swapComparision(node: ExplorerNode) {
private swapComparision(node: ViewNode) {
if (!(node instanceof ResultsComparisonNode)) return;
node.swap();

src/views/explorer.ts → src/views/viewBase.ts Näytä tiedosto

@ -13,13 +13,13 @@ import {
import { configuration } from '../configuration';
import { Container } from '../container';
import { Logger } from '../logger';
import { RefreshNodeCommandArgs } from './explorerCommands';
import { FileHistoryExplorer } from './fileHistoryExplorer';
import { LineHistoryExplorer } from './lineHistoryExplorer';
import { ExplorerNode } from './nodes';
import { isPageable } from './nodes/explorerNode';
import { RepositoriesExplorer } from './repositoriesExplorer';
import { ResultsExplorer } from './resultsExplorer';
import { FileHistoryView } from './fileHistoryView';
import { LineHistoryView } from './lineHistoryView';
import { ViewNode } from './nodes';
import { isPageable } from './nodes/viewNode';
import { RepositoriesView } from './repositoriesView';
import { ResultsView } from './resultsView';
import { RefreshNodeCommandArgs } from './viewCommands';
export enum RefreshReason {
Command = 'Command',
@ -27,11 +27,11 @@ export enum RefreshReason {
VisibilityChanged = 'VisibilityChanged'
}
export type Explorer = RepositoriesExplorer | FileHistoryExplorer | LineHistoryExplorer | ResultsExplorer;
export type View = RepositoriesView | FileHistoryView | LineHistoryView | ResultsView;
export abstract class ExplorerBase<TRoot extends ExplorerNode> implements TreeDataProvider<ExplorerNode>, Disposable {
protected _onDidChangeTreeData = new EventEmitter<ExplorerNode>();
public get onDidChangeTreeData(): Event<ExplorerNode> {
export abstract class ViewBase<TRoot extends ViewNode> implements TreeDataProvider<ViewNode>, Disposable {
protected _onDidChangeTreeData = new EventEmitter<ViewNode>();
public get onDidChangeTreeData(): Event<ViewNode> {
return this._onDidChangeTreeData.event;
}
@ -42,7 +42,7 @@ export abstract class ExplorerBase implements TreeDa
protected _disposable: Disposable | undefined;
protected _root: TRoot | undefined;
protected _tree: TreeView<ExplorerNode> | undefined;
protected _tree: TreeView<ViewNode> | undefined;
constructor(
public readonly id: string
@ -68,7 +68,7 @@ export abstract class ExplorerBase implements TreeDa
protected initialize(container?: string) {
if (this._disposable) {
this._disposable.dispose();
this._onDidChangeTreeData = new EventEmitter<ExplorerNode>();
this._onDidChangeTreeData = new EventEmitter<ViewNode>();
}
this._tree = window.createTreeView(`${this.id}${container ? `:${container}` : ''}`, {
@ -80,7 +80,7 @@ export abstract class ExplorerBase implements TreeDa
);
}
getChildren(node?: ExplorerNode): ExplorerNode[] | Promise<ExplorerNode[]> {
getChildren(node?: ViewNode): ViewNode[] | Promise<ViewNode[]> {
if (node !== undefined) return node.getChildren();
if (this._root === undefined) {
@ -90,11 +90,11 @@ export abstract class ExplorerBase implements TreeDa
return this._root.getChildren();
}
getParent(node: ExplorerNode): ExplorerNode | undefined {
getParent(node: ViewNode): ViewNode | undefined {
return node.getParent();
}
getTreeItem(node: ExplorerNode): TreeItem | Promise<TreeItem> {
getTreeItem(node: ViewNode): TreeItem | Promise<TreeItem> {
return node.getTreeItem();
}
@ -102,7 +102,7 @@ export abstract class ExplorerBase implements TreeDa
this._onDidChangeVisibility.fire(e);
}
get selection(): ExplorerNode[] {
get selection(): ViewNode[] {
if (this._tree === undefined || this._root === undefined) return [];
return this._tree.selection;
@ -117,7 +117,7 @@ export abstract class ExplorerBase implements TreeDa
reason = RefreshReason.Command;
}
Logger.log(`Explorer(${this.id}).refresh`, `reason='${reason}'`);
Logger.log(`View(${this.id}).refresh`, `reason='${reason}'`);
if (this._root !== undefined) {
await this._root.refresh(reason);
@ -126,8 +126,8 @@ export abstract class ExplorerBase implements TreeDa
this.triggerNodeUpdate();
}
async refreshNode(node: ExplorerNode, args?: RefreshNodeCommandArgs) {
Logger.log(`Explorer(${this.id}).refreshNode(${(node as { id?: string }).id || ''})`);
async refreshNode(node: ViewNode, args?: RefreshNodeCommandArgs) {
Logger.log(`View(${this.id}).refreshNode(${(node as { id?: string }).id || ''})`);
if (args !== undefined) {
if (isPageable(node)) {
@ -147,7 +147,7 @@ export abstract class ExplorerBase implements TreeDa
}
async reveal(
node: ExplorerNode,
node: ViewNode,
options?: {
select?: boolean | undefined;
focus?: boolean | undefined;
@ -171,7 +171,7 @@ export abstract class ExplorerBase implements TreeDa
return this.reveal(child, { select: false, focus: true });
}
triggerNodeUpdate(node?: ExplorerNode) {
triggerNodeUpdate(node?: ViewNode) {
// Since the root node won't actually refresh, force everything
this._onDidChangeTreeData.fire(node !== undefined && node !== this._root ? node : undefined);
}

src/views/explorerCommands.ts → src/views/viewCommands.ts Näytä tiedosto

@ -21,8 +21,6 @@ import {
BranchNode,
CommitFileNode,
CommitNode,
ExplorerNode,
ExplorerRefNode,
RemoteNode,
RepositoryNode,
ResultsFileNode,
@ -30,7 +28,9 @@ import {
StashNode,
StatusFileNode,
StatusUpstreamNode,
TagNode
TagNode,
ViewNode,
ViewRefNode
} from './nodes';
export interface RefreshNodeCommandArgs {
@ -43,68 +43,64 @@ interface ICompareSelected {
uri?: Uri;
}
export class ExplorerCommands implements Disposable {
export class ViewCommands implements Disposable {
private _disposable: Disposable | undefined;
private _terminal: Terminal | undefined;
private _terminalCwd: string | undefined;
constructor() {
commands.registerCommand('gitlens.explorers.fetch', this.fetch, this);
commands.registerCommand('gitlens.explorers.pull', this.pull, this);
commands.registerCommand('gitlens.explorers.push', this.push, this);
commands.registerCommand('gitlens.explorers.closeRepository', this.closeRepository, this);
commands.registerCommand('gitlens.explorers.exploreRepoRevision', this.exploreRepoRevision, this);
commands.registerCommand('gitlens.explorers.openChanges', this.openChanges, this);
commands.registerCommand('gitlens.explorers.openChangesWithWorking', this.openChangesWithWorking, this);
commands.registerCommand('gitlens.explorers.openFile', this.openFile, this);
commands.registerCommand('gitlens.explorers.openFileRevision', this.openFileRevision, this);
commands.registerCommand('gitlens.explorers.openFileRevisionInRemote', this.openFileRevisionInRemote, this);
commands.registerCommand('gitlens.explorers.openChangedFiles', this.openChangedFiles, this);
commands.registerCommand('gitlens.explorers.openChangedFileChanges', this.openChangedFileChanges, this);
commands.registerCommand('gitlens.views.fetch', this.fetch, this);
commands.registerCommand('gitlens.views.pull', this.pull, this);
commands.registerCommand('gitlens.views.push', this.push, this);
commands.registerCommand('gitlens.views.closeRepository', this.closeRepository, this);
commands.registerCommand('gitlens.views.exploreRepoRevision', this.exploreRepoRevision, this);
commands.registerCommand('gitlens.views.openChanges', this.openChanges, this);
commands.registerCommand('gitlens.views.openChangesWithWorking', this.openChangesWithWorking, this);
commands.registerCommand('gitlens.views.openFile', this.openFile, this);
commands.registerCommand('gitlens.views.openFileRevision', this.openFileRevision, this);
commands.registerCommand('gitlens.views.openFileRevisionInRemote', this.openFileRevisionInRemote, this);
commands.registerCommand('gitlens.views.openChangedFiles', this.openChangedFiles, this);
commands.registerCommand('gitlens.views.openChangedFileChanges', this.openChangedFileChanges, this);
commands.registerCommand(
'gitlens.explorers.openChangedFileChangesWithWorking',
'gitlens.views.openChangedFileChangesWithWorking',
this.openChangedFileChangesWithWorking,
this
);
commands.registerCommand('gitlens.explorers.openChangedFileRevisions', this.openChangedFileRevisions, this);
commands.registerCommand('gitlens.explorers.applyChanges', this.applyChanges, this);
commands.registerCommand('gitlens.explorers.stageFile', this.stageFile, this);
commands.registerCommand('gitlens.explorers.unstageFile', this.unstageFile, this);
commands.registerCommand('gitlens.explorers.compareAncestryWithWorking', this.compareAncestryWithWorking, this);
commands.registerCommand('gitlens.explorers.compareWithHead', this.compareWithHead, this);
commands.registerCommand('gitlens.explorers.compareWithRemote', this.compareWithRemote, this);
commands.registerCommand('gitlens.explorers.compareWithSelected', this.compareWithSelected, this);
commands.registerCommand('gitlens.explorers.compareWithWorking', this.compareWithWorking, this);
commands.registerCommand('gitlens.explorers.selectForCompare', this.selectForCompare, this);
commands.registerCommand('gitlens.explorers.terminalCheckoutBranch', this.terminalCheckoutBranch, this);
commands.registerCommand('gitlens.explorers.terminalCreateBranch', this.terminalCreateBranch, this);
commands.registerCommand('gitlens.explorers.terminalDeleteBranch', this.terminalDeleteBranch, this);
commands.registerCommand('gitlens.explorers.terminalMergeBranch', this.terminalMergeBranch, this);
commands.registerCommand('gitlens.explorers.terminalRebaseBranch', this.terminalRebaseBranch, this);
commands.registerCommand('gitlens.views.openChangedFileRevisions', this.openChangedFileRevisions, this);
commands.registerCommand('gitlens.views.applyChanges', this.applyChanges, this);
commands.registerCommand('gitlens.views.stageFile', this.stageFile, this);
commands.registerCommand('gitlens.views.unstageFile', this.unstageFile, this);
commands.registerCommand('gitlens.views.compareAncestryWithWorking', this.compareAncestryWithWorking, this);
commands.registerCommand('gitlens.views.compareWithHead', this.compareWithHead, this);
commands.registerCommand('gitlens.views.compareWithRemote', this.compareWithRemote, this);
commands.registerCommand('gitlens.views.compareWithSelected', this.compareWithSelected, this);
commands.registerCommand('gitlens.views.compareWithWorking', this.compareWithWorking, this);
commands.registerCommand('gitlens.views.selectForCompare', this.selectForCompare, this);
commands.registerCommand('gitlens.views.terminalCheckoutBranch', this.terminalCheckoutBranch, this);
commands.registerCommand('gitlens.views.terminalCreateBranch', this.terminalCreateBranch, this);
commands.registerCommand('gitlens.views.terminalDeleteBranch', this.terminalDeleteBranch, this);
commands.registerCommand('gitlens.views.terminalMergeBranch', this.terminalMergeBranch, this);
commands.registerCommand('gitlens.views.terminalRebaseBranch', this.terminalRebaseBranch, this);
commands.registerCommand('gitlens.views.terminalRebaseBranchToRemote', this.terminalRebaseBranchToRemote, this);
commands.registerCommand(
'gitlens.explorers.terminalRebaseBranchToRemote',
this.terminalRebaseBranchToRemote,
this
);
commands.registerCommand(
'gitlens.explorers.terminalSquashBranchIntoCommit',
'gitlens.views.terminalSquashBranchIntoCommit',
this.terminalSquashBranchIntoCommit,
this
);
commands.registerCommand('gitlens.explorers.terminalCheckoutCommit', this.terminalCheckoutCommit, this);
commands.registerCommand('gitlens.explorers.terminalCherryPickCommit', this.terminalCherryPickCommit, this);
commands.registerCommand('gitlens.explorers.terminalPushCommit', this.terminalPushCommit, this);
commands.registerCommand('gitlens.explorers.terminalRebaseCommit', this.terminalRebaseCommit, this);
commands.registerCommand('gitlens.explorers.terminalResetCommit', this.terminalResetCommit, this);
commands.registerCommand('gitlens.explorers.terminalRevertCommit', this.terminalRevertCommit, this);
commands.registerCommand('gitlens.explorers.terminalRemoveRemote', this.terminalRemoveRemote, this);
commands.registerCommand('gitlens.explorers.terminalCreateTag', this.terminalCreateTag, this);
commands.registerCommand('gitlens.explorers.terminalDeleteTag', this.terminalDeleteTag, this);
commands.registerCommand('gitlens.views.terminalCheckoutCommit', this.terminalCheckoutCommit, this);
commands.registerCommand('gitlens.views.terminalCherryPickCommit', this.terminalCherryPickCommit, this);
commands.registerCommand('gitlens.views.terminalPushCommit', this.terminalPushCommit, this);
commands.registerCommand('gitlens.views.terminalRebaseCommit', this.terminalRebaseCommit, this);
commands.registerCommand('gitlens.views.terminalResetCommit', this.terminalResetCommit, this);
commands.registerCommand('gitlens.views.terminalRevertCommit', this.terminalRevertCommit, this);
commands.registerCommand('gitlens.views.terminalRemoveRemote', this.terminalRemoveRemote, this);
commands.registerCommand('gitlens.views.terminalCreateTag', this.terminalCreateTag, this);
commands.registerCommand('gitlens.views.terminalDeleteTag', this.terminalDeleteTag, this);
}
dispose() {
@ -143,22 +139,22 @@ export class ExplorerCommands implements Disposable {
node.repo.closed = true;
}
private compareWithHead(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
private compareWithHead(node: ViewNode) {
if (!(node instanceof ViewRefNode)) return;
return Container.resultsExplorer.addComparison(node.repoPath, node.ref, 'HEAD');
return Container.resultsView.addComparison(node.repoPath, node.ref, 'HEAD');
}
private compareWithRemote(node: BranchNode) {
if (!node.branch.tracking) return;
return Container.resultsExplorer.addComparison(node.repoPath, node.branch.tracking, node.ref);
return Container.resultsView.addComparison(node.repoPath, node.branch.tracking, node.ref);
}
private compareWithWorking(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
private compareWithWorking(node: ViewNode) {
if (!(node instanceof ViewRefNode)) return;
return Container.resultsExplorer.addComparison(node.repoPath, node.ref, '');
return Container.resultsView.addComparison(node.repoPath, node.ref, '');
}
private async compareAncestryWithWorking(node: BranchNode) {
@ -168,15 +164,15 @@ export class ExplorerCommands implements Disposable {
const commonAncestor = await Container.git.getMergeBase(node.repoPath, branch.ref, node.ref);
if (commonAncestor === undefined) return;
return Container.resultsExplorer.addComparison(
return Container.resultsView.addComparison(
node.repoPath,
{ ref: commonAncestor, label: `ancestry with ${node.ref} (${GitService.shortenSha(commonAncestor)})` },
''
);
}
private compareWithSelected(node: ExplorerNode) {
if (this._selection === undefined || !(node instanceof ExplorerRefNode)) return;
private compareWithSelected(node: ViewNode) {
if (this._selection === undefined || !(node instanceof ViewRefNode)) return;
if (this._selection.repoPath !== node.repoPath) return;
if (this._selection.uri !== undefined) {
@ -198,24 +194,24 @@ export class ExplorerCommands implements Disposable {
return;
}
return Container.resultsExplorer.addComparison(this._selection.repoPath, this._selection.ref, node.ref);
return Container.resultsView.addComparison(this._selection.repoPath, this._selection.ref, node.ref);
}
private _selection: ICompareSelected | undefined;
private selectForCompare(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
private selectForCompare(node: ViewNode) {
if (!(node instanceof ViewRefNode)) return;
this._selection = {
ref: node.ref,
repoPath: node.repoPath,
uri: node instanceof CommitFileNode ? node.uri : undefined
};
setCommandContext(CommandContext.ExplorersCanCompare, true);
setCommandContext(CommandContext.ViewsCanCompare, true);
}
private exploreRepoRevision(node: ExplorerRefNode, options: { openInNewWindow?: boolean } = {}) {
if (!(node instanceof ExplorerRefNode)) return;
private exploreRepoRevision(node: ViewRefNode, options: { openInNewWindow?: boolean } = {}) {
if (!(node instanceof ViewRefNode)) return;
const uri = toGitLensFSUri(node.ref, node.repoPath);
const gitUri = GitUri.fromRevisionUri(uri);
@ -378,14 +374,14 @@ export class ExplorerCommands implements Disposable {
Container.git.unStageFile(node.repoPath, node.file.fileName);
}
async terminalCheckoutBranch(node: ExplorerNode) {
async terminalCheckoutBranch(node: ViewNode) {
if (!(node instanceof BranchNode)) return;
this.sendTerminalCommand('checkout', `${node.ref}`, node.repoPath);
}
async terminalCreateBranch(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
async terminalCreateBranch(node: ViewNode) {
if (!(node instanceof ViewRefNode)) return;
let remoteBranch = false;
let value = undefined;
@ -404,7 +400,7 @@ export class ExplorerCommands implements Disposable {
this.sendTerminalCommand('branch', `${remoteBranch ? '-t ' : ''}${name} ${node.ref}`, node.repoPath);
}
terminalDeleteBranch(node: ExplorerNode) {
terminalDeleteBranch(node: ViewNode) {
if (!(node instanceof BranchNode)) return;
if (node.branch.remote) {
@ -415,19 +411,19 @@ export class ExplorerCommands implements Disposable {
}
}
terminalMergeBranch(node: ExplorerNode) {
terminalMergeBranch(node: ViewNode) {
if (!(node instanceof BranchNode)) return;
this.sendTerminalCommand('merge', `${node.ref}`, node.repoPath);
}
terminalRebaseBranch(node: ExplorerNode) {
terminalRebaseBranch(node: ViewNode) {
if (!(node instanceof BranchNode)) return;
this.sendTerminalCommand('rebase', `-i ${node.ref}`, node.repoPath);
}
terminalRebaseBranchToRemote(node: ExplorerNode) {
terminalRebaseBranchToRemote(node: ViewNode) {
if (node instanceof BranchNode) {
if (!node.branch.current || !node.branch.tracking) return;
@ -438,25 +434,25 @@ export class ExplorerCommands implements Disposable {
}
}
terminalSquashBranchIntoCommit(node: ExplorerNode) {
terminalSquashBranchIntoCommit(node: ViewNode) {
if (!(node instanceof BranchNode)) return;
this.sendTerminalCommand('merge', `--squash ${node.ref}`, node.repoPath);
}
terminalCheckoutCommit(node: ExplorerNode) {
terminalCheckoutCommit(node: ViewNode) {
if (!(node instanceof CommitNode)) return;
this.sendTerminalCommand('checkout', `${node.ref}`, node.repoPath);
}
terminalCherryPickCommit(node: ExplorerNode) {
terminalCherryPickCommit(node: ViewNode) {
if (!(node instanceof CommitNode)) return;
this.sendTerminalCommand('cherry-pick', `-e ${node.ref}`, node.repoPath);
}
async terminalPushCommit(node: ExplorerNode) {
async terminalPushCommit(node: ViewNode) {
if (!(node instanceof CommitNode)) return;
const branch = node.branch || (await Container.git.getBranch(node.repoPath));
@ -465,32 +461,32 @@ export class ExplorerCommands implements Disposable {
this.sendTerminalCommand('push', `${branch.getRemote()} ${node.ref}:${branch.getName()}`, node.repoPath);
}
terminalRebaseCommit(node: ExplorerNode) {
terminalRebaseCommit(node: ViewNode) {
if (!(node instanceof CommitNode)) return;
this.sendTerminalCommand('rebase', `-i ${node.ref}^`, node.repoPath);
}
terminalResetCommit(node: ExplorerNode) {
terminalResetCommit(node: ViewNode) {
if (!(node instanceof CommitNode)) return;
this.sendTerminalCommand('reset', `--soft ${node.ref}`, node.repoPath);
}
terminalRevertCommit(node: ExplorerNode) {
terminalRevertCommit(node: ViewNode) {
if (!(node instanceof CommitNode)) return;
this.sendTerminalCommand('revert', `-e ${node.ref}`, node.repoPath);
}
terminalRemoveRemote(node: ExplorerNode) {
terminalRemoveRemote(node: ViewNode) {
if (!(node instanceof RemoteNode)) return;
this.sendTerminalCommand('remote', `remove ${node.remote.name}`, node.remote.repoPath);
}
async terminalCreateTag(node: ExplorerNode) {
if (!(node instanceof ExplorerRefNode)) return;
async terminalCreateTag(node: ViewNode) {
if (!(node instanceof ViewRefNode)) return;
const name = await window.showInputBox({
prompt: `Please provide a tag name (Press 'Enter' to confirm or 'Escape' to cancel)`,
@ -508,7 +504,7 @@ export class ExplorerCommands implements Disposable {
this.sendTerminalCommand('tag', args, node.repoPath);
}
terminalDeleteTag(node: ExplorerNode) {
terminalDeleteTag(node: ViewNode) {
if (!(node instanceof TagNode)) return;
this.sendTerminalCommand('tag', `-d ${node.ref}`, node.repoPath);

Ladataan…
Peruuta
Tallenna