Przeglądaj źródła

Overhauls configuration

main
Eric Amodio 7 lat temu
rodzic
commit
ad2bc4eb3b
28 zmienionych plików z 615 dodań i 724 usunięć
  1. +3
    -3
      README.md
  2. +250
    -328
      package.json
  3. +23
    -42
      src/annotations/annotationController.ts
  4. +2
    -2
      src/annotations/annotations.ts
  5. +3
    -6
      src/annotations/blameAnnotationProvider.ts
  6. +9
    -9
      src/annotations/gutterBlameAnnotationProvider.ts
  7. +2
    -0
      src/annotations/heatmapBlameAnnotationProvider.ts
  8. +51
    -51
      src/annotations/hoverBlameAnnotationProvider.ts
  9. +14
    -11
      src/annotations/recentChangesAnnotationProvider.ts
  10. +2
    -2
      src/commands/showFileBlame.ts
  11. +3
    -12
      src/commands/showLineBlame.ts
  12. +2
    -2
      src/commands/toggleFileBlame.ts
  13. +2
    -11
      src/commands/toggleLineBlame.ts
  14. +93
    -114
      src/config.ts
  15. +17
    -0
      src/configuration.ts
  16. +31
    -46
      src/currentLineController.ts
  17. +55
    -36
      src/extension.ts
  18. +26
    -26
      src/gitCodeLensProvider.ts
  19. +3
    -2
      src/views/branchNode.ts
  20. +3
    -2
      src/views/branchesNode.ts
  21. +1
    -1
      src/views/commitNode.ts
  22. +1
    -1
      src/views/fileHistoryNode.ts
  23. +6
    -6
      src/views/folderNode.ts
  24. +3
    -3
      src/views/gitExplorer.ts
  25. +3
    -2
      src/views/remoteNode.ts
  26. +3
    -2
      src/views/remotesNode.ts
  27. +3
    -3
      src/views/resultsExplorer.ts
  28. +1
    -1
      src/views/statusFileCommitsNode.ts

+ 3
- 3
README.md Wyświetl plik

@ -450,9 +450,9 @@ GitLens is highly customizable and provides many configuration settings to allow
|`gitlens.codeLens.recentChange.command`|Specifies the command to be executed when the `recent change` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.codeLens.authors.enabled`|Specifies whether or not to show an `authors` code lens showing number of authors of the file or code block and the most prominent author (if there is more than one)
|`gitlens.codeLens.authors.command`|Specifies the command to be executed when the `authors` code lens is clicked<br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick
|`gitlens.codeLens.locations`|Specifies where Git code lens will be shown in the document<br />`document` - adds code lens at the top of the document<br />`containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)<br />`blocks` - adds code lens at the start of block-like symbols (functions, methods, etc) lines
|`gitlens.codeLens.customLocationSymbols`|Specifies a set of document symbols where Git code lens will or will not be shown in the document<br />Prefix with `!` to not show Git code lens for the symbol<br />Must be a member of `SymbolKind`
|`gitlens.codeLens.perLanguageLocations`|Specifies where Git code lens will be shown in the document for the specified languages
|`gitlens.codeLens.scopes`|Specifies where Git code lens will be shown in the document<br />`document` - adds code lens at the top of the document<br />`containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)<br />`blocks` - adds code lens at the start of block-like symbols (functions, methods, etc) lines
|`gitlens.codeLens.scopesByLanguage`|Specifies where Git code lens will be shown in the document for the specified languages
|`gitlens.codeLens.symbolScopes`|Specifies a set of document symbols where Git code lens will or will not be shown in the document<br />Prefix with `!` to not show Git code lens for the symbol<br />Must be a member of `SymbolKind`
### GitLens View Settings

+ 250
- 328
package.json Wyświetl plik

@ -50,71 +50,37 @@
"type": "object",
"title": "GitLens configuration",
"properties": {
"gitlens.debug": {
"gitlens.blame.avatars": {
"type": "boolean",
"default": false,
"description": "Specifies debug mode",
"default": true,
"description": "Specifies whether or not to show avatar images in the gutter blame annotations",
"scope": "window"
},
"gitlens.insiders": {
"gitlens.blame.compact": {
"type": "boolean",
"default": false,
"description": "Specifies whether or not to enable new experimental features (expect there to be issues)",
"scope": "window"
},
"gitlens.keymap": {
"type": "string",
"default": "standard",
"enum": [
"standard",
"chorded",
"none"
],
"description": "Specifies the keymap to use for GitLens shortcut keys\n `standard` - adds a standard set of shortcut keys\n `chorded` - adds a chorded set of shortcut keys that all start with `Ctrl+Alt+G` (`??G` on macOS)\n `none` - no shortcut keys will be added",
"scope": "window"
},
"gitlens.outputLevel": {
"type": "string",
"default": "silent",
"enum": [
"silent",
"errors",
"verbose"
],
"description": "Specifies how much (if any) output will be sent to the GitLens output channel",
"scope": "window"
},
"gitlens.annotations.file.gutter.format": {
"type": "string",
"default": "${message|40?} ${ago|14-}",
"description": "Specifies the format of the gutter blame annotations\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.annotations.file.gutter.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"default": true,
"description": "Specifies whether or not to compact (deduplicate) matching adjacent gutter blame annotations",
"scope": "window"
},
"gitlens.annotations.file.gutter.dateFormat": {
"gitlens.blame.dateFormat": {
"type": "string",
"default": null,
"description": "Specifies how to format absolute dates (using the `${date}` token) in gutter blame annotations\nSee https://momentjs.com/docs/#/displaying/format/ for valid formats",
"scope": "window"
},
"gitlens.annotations.file.gutter.compact": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to compact (deduplicate) matching adjacent gutter blame annotations",
"scope": "window"
},
"gitlens.annotations.file.gutter.gravatars": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show gravatar images in the gutter blame annotations",
"gitlens.blame.format": {
"type": "string",
"default": "${message|40?} ${ago|14-}",
"description": "Specifies the format of the gutter blame annotations\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.blame.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.annotations.file.gutter.heatmap.enabled": {
"gitlens.blame.heatmap.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a heatmap indicator in the gutter blame annotations",
"scope": "window"
},
"gitlens.annotations.file.gutter.heatmap.location": {
"gitlens.blame.heatmap.location": {
"type": "string",
"default": "right",
"enum": [
@ -124,125 +90,13 @@
"description": "Specifies where the heatmap indicators will be shown in the gutter blame annotations\n `left` - adds a heatmap indicator on the left edge of the gutter blame annotations\n `right` - adds a heatmap indicator on the right edge of the gutter blame annotations",
"scope": "window"
},
"gitlens.annotations.file.gutter.hover.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover annotation over the gutter blame annotations",
"scope": "window"
},
"gitlens.annotations.file.gutter.hover.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover annotation over the gutter blame annotations",
"scope": "window"
},
"gitlens.annotations.file.gutter.hover.wholeLine": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to trigger hover annotations over the whole line",
"scope": "window"
},
"gitlens.annotations.file.gutter.separateLines": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not gutter blame annotations will be separated by a small gap",
"scope": "window"
},
"gitlens.annotations.file.hover.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover annotation over each line",
"scope": "window"
},
"gitlens.annotations.file.hover.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover annotation over each line",
"scope": "window"
},
"gitlens.annotations.file.hover.heatmap.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide heatmap indicators on the left edge of each line",
"scope": "window"
},
"gitlens.annotations.file.recentChanges.hover.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover annotation",
"scope": "window"
},
"gitlens.annotations.file.recentChanges.hover.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover annotation",
"scope": "window"
},
"gitlens.annotations.line.hover.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover annotation for the current line",
"scope": "window"
},
"gitlens.annotations.line.hover.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover annotation for the current line",
"scope": "window"
},
"gitlens.annotations.line.trailing.format": {
"type": "string",
"default": "${authorAgo} \u2022 ${message}",
"description": "Specifies the format of the trailing blame annotations\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.annotations.line.trailing.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.annotations.line.trailing.dateFormat": {
"type": "string",
"default": null,
"description": "Specifies how to format absolute dates (using the `${date}` token) in trailing blame annotations\nSee https://momentjs.com/docs/#/displaying/format/ for valid formats",
"scope": "window"
},
"gitlens.annotations.line.trailing.hover.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover annotation over the trailing blame annotations",
"scope": "window"
},
"gitlens.annotations.line.trailing.hover.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover annotation over the trailing blame annotations",
"scope": "window"
},
"gitlens.annotations.line.trailing.hover.wholeLine": {
"type": "boolean",
"default": false,
"description": "Specifies whether or not to trigger hover annotations over the whole line",
"scope": "window"
},
"gitlens.blame.ignoreWhitespace": {
"type": "boolean",
"default": false,
"description": "Specifies whether or not to ignore whitespace when comparing revisions during blame operations",
"scope": "resource"
},
"gitlens.blame.file.annotationType": {
"type": "string",
"default": "gutter",
"enum": [
"gutter",
"hover"
],
"description": "Specifies the type of blame annotations that will be shown for the current file\n `gutter` - adds an annotation to the beginning of each line\n `hover` - shows annotations when hovering over each line",
"scope": "window"
},
"gitlens.blame.file.lineHighlight.enabled": {
"gitlens.blame.highlight.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to highlight lines associated with the current line",
"scope": "window"
},
"gitlens.blame.file.lineHighlight.locations": {
"gitlens.blame.highlight.locations": {
"type": "array",
"default": [
"gutter",
@ -263,53 +117,48 @@
"description": "Specifies where the associated line highlights will be shown\n `gutter` - adds a gutter glyph\n `line` - adds a full-line highlight background color\n `overviewRuler` - adds a decoration to the overviewRuler (scroll bar)",
"scope": "window"
},
"gitlens.blame.line.enabled": {
"gitlens.blame.ignoreWhitespace": {
"type": "boolean",
"default": false,
"description": "Specifies whether or not to ignore whitespace when comparing revisions during blame operations",
"scope": "resource"
},
"gitlens.blame.separateLines": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a blame annotation for the current line, by default\nUse the `Toggle Line Blame Annotations` command (`gitlens.toggleLineBlame`) to toggle the annotations on and off for the current session",
"description": "Specifies whether or not gutter blame annotations will be separated by a small gap",
"scope": "window"
},
"gitlens.blame.line.annotationType": {
"gitlens.codeLens.authors.command": {
"type": "string",
"default": "trailing",
"default": "gitlens.toggleFileBlame",
"enum": [
"trailing",
"hover"
"gitlens.toggleFileBlame",
"gitlens.diffWithPrevious",
"gitlens.showQuickCommitDetails",
"gitlens.showQuickCommitFileDetails",
"gitlens.showQuickFileHistory",
"gitlens.showQuickRepoHistory"
],
"description": "Specifies the type of blame annotations that will be shown for the current line\n `trailing` - adds an annotation to the end of the current line\n `hover` - shows annotations when hovering over the current line",
"description": "Specifies the command to be executed when the `authors` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick",
"scope": "window"
},
"gitlens.recentChanges.file.lineHighlight.locations": {
"type": "array",
"default": [
"gutter",
"line",
"overviewRuler"
],
"items": {
"type": "string",
"enum": [
"gutter",
"line",
"overviewRuler"
]
},
"minItems": 1,
"maxItems": 3,
"uniqueItems": true,
"description": "Specifies where the highlights of the recently changed lines will be shown\n `gutter` - adds a gutter glyph\n `line` - adds a full-line highlight background color\n `overviewRuler` - adds a decoration to the overviewRuler (scroll bar)",
"gitlens.codeLens.authors.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show an `authors` code lens showing number of authors of the file or code block and the most prominent author (if there is more than one)",
"scope": "window"
},
"gitlens.codeLens.enabled": {
"gitlens.codeLens.debug": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide any Git code lens, by default\nUse the `Toggle Git Code Lens` command (`gitlens.toggleCodeLens`) to toggle the Git code lens on and off for the current session",
"default": false,
"description": "Specifies whether or not to show debug information in code lens",
"scope": "window"
},
"gitlens.codeLens.recentChange.enabled": {
"gitlens.codeLens.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show a `recent change` code lens showing the author and date of the most recent commit for the file or code block",
"description": "Specifies whether or not to provide any Git code lens, by default\nUse the `Toggle Git Code Lens` command (`gitlens.toggleCodeLens`) to toggle the Git code lens on and off for the current session",
"scope": "window"
},
"gitlens.codeLens.recentChange.command": {
@ -326,27 +175,13 @@
"description": "Specifies the command to be executed when the `recent change` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick",
"scope": "window"
},
"gitlens.codeLens.authors.enabled": {
"gitlens.codeLens.recentChange.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show an `authors` code lens showing number of authors of the file or code block and the most prominent author (if there is more than one)",
"scope": "window"
},
"gitlens.codeLens.authors.command": {
"type": "string",
"default": "gitlens.toggleFileBlame",
"enum": [
"gitlens.toggleFileBlame",
"gitlens.diffWithPrevious",
"gitlens.showQuickCommitDetails",
"gitlens.showQuickCommitFileDetails",
"gitlens.showQuickFileHistory",
"gitlens.showQuickRepoHistory"
],
"description": "Specifies the command to be executed when the `authors` code lens is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current committed file with the previous commit\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick",
"description": "Specifies whether or not to show a `recent change` code lens showing the author and date of the most recent commit for the file or code block",
"scope": "window"
},
"gitlens.codeLens.locations": {
"gitlens.codeLens.scopes": {
"type": "array",
"default": [
"document",
@ -366,63 +201,54 @@
"description": "Specifies where Git code lens will be shown in the document\n `document` - adds code lens at the top of the document\n `containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)\n `blocks` - adds code lens at the start of block-like symbols (functions, methods, etc) lines",
"scope": "resource"
},
"gitlens.codeLens.customLocationSymbols": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Specifies a set of document symbols where Git code lens will or will not be shown in the document\nPrefix with `!` to not show Git code lens for the symbol\nMust be a member of `SymbolKind`",
"scope": "resource"
},
"gitlens.codeLens.perLanguageLocations": {
"gitlens.codeLens.scopesByLanguage": {
"type": "array",
"default": [
{
"language": "css",
"locations": [
"scopes": [
"document"
]
},
{
"language": "html",
"locations": [
"scopes": [
"document"
]
},
{
"language": "json",
"locations": [
"scopes": [
"document"
]
},
{
"language": "jsonc",
"locations": [
"scopes": [
"document"
]
},
{
"language": "less",
"locations": [
"scopes": [
"document"
]
},
{
"language": "scss",
"locations": [
"scopes": [
"document"
]
},
{
"language": "vue",
"locations": [
"scopes": [
"document"
]
},
{
"language": "stylus",
"locations": [
"scopes": [
"document"
]
}
@ -431,14 +257,14 @@
"type": "object",
"required": [
"language",
"locations"
"scopes"
],
"properties": {
"language": {
"type": "string",
"description": "Specifies the language to which this code lens override applies"
},
"locations": {
"scopes": {
"type": "array",
"default": [
"document",
@ -472,10 +298,37 @@
"description": "Specifies where Git code lens will be shown in the document for the specified languages",
"scope": "resource"
},
"gitlens.codeLens.debug": {
"gitlens.codeLens.symbolScopes": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true,
"description": "Specifies a set of document symbols where Git code lens will or will not be shown in the document\nPrefix with `!` to not show Git code lens for the symbol\nMust be a member of `SymbolKind`",
"scope": "resource"
},
"gitlens.currentLine.dateFormat": {
"type": "string",
"default": null,
"description": "Specifies how to format absolute dates (using the `${date}` token) for the current line blame annotation\nSee https://momentjs.com/docs/#/displaying/format/ for valid formats",
"scope": "window"
},
"gitlens.currentLine.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a blame annotation for the current line, by default\nUse the `Toggle Line Blame Annotations` command (`gitlens.toggleLineBlame`) to toggle the annotations on and off for the current window",
"scope": "window"
},
"gitlens.currentLine.format": {
"type": "string",
"default": "${authorAgo} \u2022 ${message}",
"description": "Specifies the format of the current line blame annotation\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.annotations.line.trailing.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.debug": {
"type": "boolean",
"default": false,
"description": "Specifies whether or not to show debug information in code lens",
"description": "Specifies debug mode",
"scope": "window"
},
"gitlens.defaultDateFormat": {
@ -508,22 +361,46 @@
"description": "Specifies the style of the gravatar default (fallback) images\n `identicon` - a geometric pattern\n `mm` - (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)\n `monsterid` - a monster with different colors, faces, etc\n `retro` - 8-bit arcade-style pixelated faces\n `robohash` - a robot with different colors, faces, etc\n `wavatar` - faces with differing features and backgrounds",
"scope": "window"
},
"gitlens.gitExplorer.autoRefresh": {
"gitlens.explorers.avatars": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to automatically refresh the `GitLens` view when the repository or the file system changes",
"description": "Specifies whether or not to show avatar images instead of commit (or status) icons in the `GitLens` and `GitLens Results` views",
"scope": "window"
},
"gitlens.gitExplorer.commitFormat": {
"gitlens.explorers.commitFileFormat": {
"type": "string",
"default": "${filePath}",
"description": "Specifies the format of a committed file in the `GitLens` and `GitLens Results` views\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path",
"scope": "window"
},
"gitlens.explorers.commitFormat": {
"type": "string",
"default": "${message} \u00a0\u2022\u00a0 ${authorAgo} \u00a0 (${id})",
"description": "Specifies the format of committed changes in the `GitLens` view\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"description": "Specifies the format of committed changes in the `GitLens` and `GitLens Results` views\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.gitExplorer.commitFileFormat": {
"gitlens.explorers.stashFileFormat": {
"type": "string",
"default": "${filePath}",
"description": "Specifies the format of a committed file in the `GitLens` view\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path",
"description": "Specifies the format of a stashed file in the `GitLens` and `GitLens Results` views\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path",
"scope": "window"
},
"gitlens.explorers.stashFormat": {
"type": "string",
"default": "${message}",
"description": "Specifies the format of stashed changes in the `GitLens` and `GitLens Results` views\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.explorers.statusFileFormat": {
"type": "string",
"default": "${working}${filePath}",
"description": "Specifies the format of the status of a working or committed file in the `GitLens` and `GitLens Results` views\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path\n ${working} - optional indicator if the file is uncommitted",
"scope": "window"
},
"gitlens.gitExplorer.autoRefresh": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to automatically refresh the `GitLens` view when the repository or the file system changes",
"scope": "window"
},
"gitlens.gitExplorer.enabled": {
@ -532,6 +409,12 @@
"description": "Specifies whether or not to show the `GitLens` view",
"scope": "window"
},
"gitlens.gitExplorer.files.compact": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to compact (flatten) unnecessary file nesting in the `GitLens` view\nOnly applies when displaying files as a `tree` or `auto`",
"scope": "window"
},
"gitlens.gitExplorer.files.layout": {
"type": "string",
"default": "auto",
@ -543,24 +426,12 @@
"description": "Specifies how the `GitLens` view will display files\n `auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.gitExplorer.files.threshold` setting and the number of files at each nesting level\n `list` - displays files as a list\n `tree` - displays files as a tree",
"scope": "window"
},
"gitlens.gitExplorer.files.compact": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to compact (flatten) unnecessary file nesting in the `GitLens` view\nOnly applies when displaying files as a `tree` or `auto`",
"scope": "window"
},
"gitlens.gitExplorer.files.threshold": {
"type": "number",
"default": 5,
"description": "Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the `GitLens` view\nOnly applies when displaying files as `auto`",
"scope": "window"
},
"gitlens.gitExplorer.gravatars": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show gravatar images instead of commit (or status) icons in the `GitLens` view",
"scope": "window"
},
"gitlens.gitExplorer.includeWorkingTree": {
"type": "boolean",
"default": true,
@ -573,33 +444,126 @@
"description": "Specifies whether or not to show the tracking branch when displaying local branches in the `GitLens` view",
"scope": "window"
},
"gitlens.gitExplorer.stashFormat": {
"gitlens.gitExplorer.view": {
"type": "string",
"default": "${message}",
"description": "Specifies the format of stashed changes in the `GitLens` view\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"default": "auto",
"enum": [
"auto",
"history",
"repository"
],
"description": "Specifies the starting view (mode) of the `GitLens` view\n `auto` - shows the last selected view, defaults to `repository`\n `history` - shows the commit history of the active file\n `repository` - shows a repository explorer",
"scope": "window"
},
"gitlens.hovers.annotations.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover for all lines when showing blame annotations",
"scope": "window"
},
"gitlens.hovers.annotations.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover for all lines when showing blame annotations",
"scope": "window"
},
"gitlens.hovers.annotations.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide any hovers when showing blame annotations",
"scope": "window"
},
"gitlens.gitExplorer.stashFileFormat": {
"gitlens.hovers.annotations.over": {
"type": "string",
"default": "${filePath}",
"description": "Specifies the format of a stashed file in the `GitLens` view\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path",
"default": "line",
"enum": [
"annotation",
"line"
],
"description": "Specifies when to trigger hovers when showing blame annotations\n `annotation` - only shown when hovering over the line annotation\n `line` - shown when hovering anywhere over the line",
"scope": "window"
},
"gitlens.hovers.currentLine.changes": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a changes (diff) hover for the current line",
"scope": "window"
},
"gitlens.hovers.currentLine.details": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide a commit details hover for the current line",
"scope": "window"
},
"gitlens.hovers.currentLine.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide any hovers for the current line",
"scope": "window"
},
"gitlens.gitExplorer.statusFileFormat": {
"gitlens.hovers.currentLine.over": {
"type": "string",
"default": "${working}${filePath}",
"description": "Specifies the format of the status of a working or committed file in the `GitLens` view\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path\n ${working} - optional indicator if the file is uncommitted",
"default": "annotation",
"enum": [
"annotation",
"line"
],
"description": "Specifies when to trigger hovers for the current line\n `annotation` - only shown when hovering over the line annotation\n `line` - shown when hovering anywhere over the line",
"scope": "window"
},
"gitlens.gitExplorer.view": {
"gitlens.hovers.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide any hovers",
"scope": "window"
},
"gitlens.insiders": {
"type": "boolean",
"default": false,
"description": "Specifies whether or not to enable new experimental features (expect there to be issues)",
"scope": "window"
},
"gitlens.keymap": {
"type": "string",
"default": "auto",
"default": "standard",
"enum": [
"auto",
"history",
"repository"
"standard",
"chorded",
"none"
],
"description": "Specifies the starting view (mode) of the `GitLens` view\n `auto` - shows the last selected view, defaults to `repository`\n `history` - shows the commit history of the active file\n `repository` - shows a repository explorer",
"description": "Specifies the keymap to use for GitLens shortcut keys\n `standard` - adds a standard set of shortcut keys\n `chorded` - adds a chorded set of shortcut keys that all start with `Ctrl+Alt+G` (`??G` on macOS)\n `none` - no shortcut keys will be added",
"scope": "window"
},
"gitlens.outputLevel": {
"type": "string",
"default": "silent",
"enum": [
"silent",
"errors",
"verbose"
],
"description": "Specifies how much (if any) output will be sent to the GitLens output channel",
"scope": "window"
},
"gitlens.recentChanges.highlight.locations": {
"type": "array",
"default": [
"gutter",
"line",
"overviewRuler"
],
"items": {
"type": "string",
"enum": [
"gutter",
"line",
"overviewRuler"
]
},
"minItems": 1,
"maxItems": 3,
"uniqueItems": true,
"description": "Specifies where the highlights of the recently changed lines will be shown\n `gutter` - adds a gutter glyph\n `line` - adds a full-line highlight background color\n `overviewRuler` - adds a decoration to the overviewRuler (scroll bar)",
"scope": "window"
},
"gitlens.remotes": {
@ -695,16 +659,10 @@
"description": "Specifies user-defined remote (code-hosting) services or custom domains for built-in remote services",
"scope": "resource"
},
"gitlens.resultsExplorer.commitFormat": {
"type": "string",
"default": "${message} \u00a0\u2022\u00a0 ${authorAgo} \u00a0 (${id})",
"description": "Specifies the format of committed changes in the `GitLens Results` view\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.resultsExplorer.commitFileFormat": {
"type": "string",
"default": "${filePath}",
"description": "Specifies the format of a committed file in the `GitLens Results` view\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path",
"gitlens.resultsExplorer.files.compact": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to compact (flatten) unnecessary file nesting in the `GitLens Results` view\nOnly applies when displaying files as a `tree` or `auto`",
"scope": "window"
},
"gitlens.resultsExplorer.files.layout": {
@ -718,54 +676,12 @@
"description": "Specifies how the `GitLens Results` view will display files\n `auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.gitExplorer.files.threshold` setting and the number of files at each nesting level\n `list` - displays files as a list\n `tree` - displays files as a tree",
"scope": "window"
},
"gitlens.resultsExplorer.files.compact": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to compact (flatten) unnecessary file nesting in the `GitLens Results` view\nOnly applies when displaying files as a `tree` or `auto`",
"scope": "window"
},
"gitlens.resultsExplorer.files.threshold": {
"type": "number",
"default": 5,
"description": "Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the `GitLens Results` view\nOnly applies when displaying files as `auto`",
"scope": "window"
},
"gitlens.resultsExplorer.gravatars": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show gravatar images instead of commit (or status) icons in the `GitLens Results` view",
"scope": "window"
},
"gitlens.resultsExplorer.showTrackingBranch": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to show the tracking branch when displaying local branches in the `GitLens Results` view",
"scope": "window"
},
"gitlens.resultsExplorer.stashFormat": {
"type": "string",
"default": "${message}",
"description": "Specifies the format of stashed changes in the `GitLens Results` view\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.resultsExplorer.stashFileFormat": {
"type": "string",
"default": "${filePath}",
"description": "Specifies the format of a stashed file in the `GitLens Results` view\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path",
"scope": "window"
},
"gitlens.resultsExplorer.statusFileFormat": {
"type": "string",
"default": "${working}${filePath}",
"description": "Specifies the format of the status of a working or committed file in the `GitLens Results` view\nAvailable tokens\n ${directory} - directory name\n ${file} - file name\n ${filePath} - formatted file name and path\n ${path} - full file path\n ${working} - optional indicator if the file is uncommitted",
"scope": "window"
},
"gitlens.statusBar.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide blame information on the status bar",
"scope": "window"
},
"gitlens.statusBar.alignment": {
"type": "string",
"default": "right",
@ -792,18 +708,24 @@
"description": "Specifies the command to be executed when the blame status bar item is clicked\n `gitlens.toggleFileBlame` - toggles file blame annotations\n `gitlens.diffWithPrevious` - compares the current line commit with the previous\n `gitlens.diffWithWorking` - compares the current line commit with the working tree\n `gitlens.toggleCodeLens` - toggles Git code lens\n `gitlens.showQuickCommitDetails` - shows a commit details quick pick\n `gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick\n `gitlens.showQuickFileHistory` - shows a file history quick pick\n `gitlens.showQuickRepoHistory` - shows a branch history quick pick",
"scope": "window"
},
"gitlens.statusBar.format": {
"type": "string",
"default": "${authorAgo}",
"description": "Specifies the format of the status bar blame information\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.statusBar.dateFormat": {
"type": "string",
"default": null,
"description": "Specifies the date format of absolute dates shown in the blame information on the status bar. See https://momentjs.com/docs/#/displaying/format/ for valid formats",
"scope": "window"
},
"gitlens.statusBar.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to provide blame information on the status bar",
"scope": "window"
},
"gitlens.statusBar.format": {
"type": "string",
"default": "${authorAgo}",
"description": "Specifies the format of the status bar blame information\nAvailable tokens\n ${id} - commit id\n ${author} - commit author\n ${message} - commit message\n ${ago} - relative commit date (e.g. 1 day ago)\n ${date} - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)\n ${authorAgo} - commit author, relative commit date\nSee https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting",
"scope": "window"
},
"gitlens.strings.codeLens.unsavedChanges.recentChangeAndAuthors": {
"type": "string",
"default": "Unsaved changes (cannot determine recent change or authors)",
@ -822,12 +744,6 @@
"description": "Specifies the string to be shown in place of the `authors` code lens when there are unsaved changes",
"scope": "window"
},
"gitlens.advanced.caching.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether git output will be cached -- changing the default is not recommended",
"scope": "window"
},
"gitlens.advanced.blame.delayAfterEdit": {
"type": "number",
"default": 5000,
@ -840,6 +756,12 @@
"description": "Specifies the maximum document size (in lines) allowed to be re-blamed after an edit while still unsaved. Use 0 to specify no maximum",
"scope": "window"
},
"gitlens.advanced.caching.enabled": {
"type": "boolean",
"default": true,
"description": "Specifies whether git output will be cached -- changing the default is not recommended",
"scope": "window"
},
"gitlens.advanced.git": {
"type": "string",
"default": null,

+ 23
- 42
src/annotations/annotationController.ts Wyświetl plik

@ -2,13 +2,12 @@
import { Functions, Iterables } from '../system';
import { ConfigurationChangeEvent, DecorationRangeBehavior, DecorationRenderOptions, Disposable, Event, EventEmitter, OverviewRulerLane, Progress, ProgressLocation, TextDocument, TextEditor, TextEditorDecorationType, TextEditorViewColumnChangeEvent, ThemeColor, window, workspace } from 'vscode';
import { AnnotationProviderBase, AnnotationStatus, TextEditorCorrelationKey } from './annotationProvider';
import { configuration, FileAnnotationType, IConfig, LineHighlightLocations } from '../configuration';
import { configuration, FileAnnotationType, HighlightLocations } from '../configuration';
import { CommandContext, isTextEditor, setCommandContext } from '../constants';
import { Container } from '../container';
import { DocumentBlameStateChangeEvent, DocumentDirtyStateChangeEvent, GitDocumentState } from '../trackers/documentTracker';
import { GutterBlameAnnotationProvider } from './gutterBlameAnnotationProvider';
import { HeatmapBlameAnnotationProvider } from './heatmapBlameAnnotationProvider';
import { HoverBlameAnnotationProvider } from './hoverBlameAnnotationProvider';
import { KeyboardScope, KeyCommand, Keys } from '../keyboard';
import { Logger } from '../logger';
import { RecentChangesAnnotationProvider } from './recentChangesAnnotationProvider';
@ -69,34 +68,31 @@ export class AnnotationController extends Disposable {
private onConfigurationChanged(e: ConfigurationChangeEvent) {
const initializing = configuration.initializing(e);
let cfg: IConfig | undefined;
const cfg = Container.config;
if (initializing ||
configuration.changed(e, configuration.name('blame')('file')('lineHighlight').value)) {
if (initializing || configuration.changed(e, configuration.name('blame')('highlight').value)) {
Decorations.blameHighlight && Decorations.blameHighlight.dispose();
cfg = configuration.get<IConfig>();
const cfgHighlight = cfg.blame.file.lineHighlight;
const cfgHighlight = cfg.blame.highlight;
if (cfgHighlight.enabled) {
Decorations.blameHighlight = window.createTextEditorDecorationType({
gutterIconSize: 'contain',
isWholeLine: true,
overviewRulerLane: OverviewRulerLane.Right,
backgroundColor: cfgHighlight.locations.includes(LineHighlightLocations.Line)
backgroundColor: cfgHighlight.locations.includes(HighlightLocations.Line)
? new ThemeColor('gitlens.lineHighlightBackgroundColor')
: undefined,
overviewRulerColor: cfgHighlight.locations.includes(LineHighlightLocations.OverviewRuler)
overviewRulerColor: cfgHighlight.locations.includes(HighlightLocations.OverviewRuler)
? new ThemeColor('gitlens.lineHighlightOverviewRulerColor')
: undefined,
dark: {
gutterIconPath: cfgHighlight.locations.includes(LineHighlightLocations.Gutter)
gutterIconPath: cfgHighlight.locations.includes(HighlightLocations.Gutter)
? Container.context.asAbsolutePath('images/dark/highlight-gutter.svg')
: undefined
},
light: {
gutterIconPath: cfgHighlight.locations.includes(LineHighlightLocations.Gutter)
gutterIconPath: cfgHighlight.locations.includes(HighlightLocations.Gutter)
? Container.context.asAbsolutePath('images/light/highlight-gutter.svg')
: undefined
}
@ -107,32 +103,28 @@ export class AnnotationController extends Disposable {
}
}
if (initializing ||
configuration.changed(e, configuration.name('recentChanges')('file')('lineHighlight').value)) {
if (initializing || configuration.changed(e, configuration.name('recentChanges')('highlight').value)) {
Decorations.recentChangesHighlight && Decorations.recentChangesHighlight.dispose();
if (cfg === undefined) {
cfg = configuration.get<IConfig>();
}
const cfgHighlight = cfg.recentChanges.file.lineHighlight;
const cfgHighlight = cfg.recentChanges.highlight;
Decorations.recentChangesHighlight = window.createTextEditorDecorationType({
gutterIconSize: 'contain',
isWholeLine: true,
overviewRulerLane: OverviewRulerLane.Right,
backgroundColor: cfgHighlight.locations.includes(LineHighlightLocations.Line)
backgroundColor: cfgHighlight.locations.includes(HighlightLocations.Line)
? new ThemeColor('gitlens.lineHighlightBackgroundColor')
: undefined,
overviewRulerColor: cfgHighlight.locations.includes(LineHighlightLocations.OverviewRuler)
overviewRulerColor: cfgHighlight.locations.includes(HighlightLocations.OverviewRuler)
? new ThemeColor('gitlens.lineHighlightOverviewRulerColor')
: undefined,
dark: {
gutterIconPath: cfgHighlight.locations.includes(LineHighlightLocations.Gutter)
gutterIconPath: cfgHighlight.locations.includes(HighlightLocations.Gutter)
? Container.context.asAbsolutePath('images/dark/highlight-gutter.svg')
: undefined
},
light: {
gutterIconPath: cfgHighlight.locations.includes(LineHighlightLocations.Gutter)
gutterIconPath: cfgHighlight.locations.includes(HighlightLocations.Gutter)
? Container.context.asAbsolutePath('images/light/highlight-gutter.svg')
: undefined
}
@ -141,13 +133,9 @@ export class AnnotationController extends Disposable {
if (initializing) return;
if (configuration.changed(e, configuration.name('blame')('file').value) ||
configuration.changed(e, configuration.name('recentChanges')('file').value) ||
configuration.changed(e, configuration.name('annotations')('file').value)) {
if (cfg === undefined) {
cfg = configuration.get<IConfig>();
}
if (configuration.changed(e, configuration.name('blame').value) ||
configuration.changed(e, configuration.name('recentChanges').value) ||
configuration.changed(e, configuration.name('hovers').value)) {
// Since the configuration has changed -- reset any visible annotations
for (const provider of this._annotationProviders.values()) {
if (provider === undefined) continue;
@ -155,13 +143,11 @@ export class AnnotationController extends Disposable {
if (provider.annotationType === FileAnnotationType.RecentChanges) {
provider.reset({ decoration: Decorations.recentChangesAnnotation, highlightDecoration: Decorations.recentChangesHighlight });
}
else if (provider.annotationType === FileAnnotationType.Blame) {
provider.reset({ decoration: Decorations.blameAnnotation, highlightDecoration: Decorations.blameHighlight });
}
else {
if (provider.annotationType === cfg.blame.file.annotationType) {
provider.reset({ decoration: Decorations.blameAnnotation, highlightDecoration: Decorations.blameHighlight });
}
else {
this.showAnnotations(provider.editor, cfg.blame.file.annotationType);
}
this.showAnnotations(provider.editor, FileAnnotationType.Heatmap);
}
}
}
@ -355,8 +341,7 @@ export class AnnotationController extends Disposable {
if (progress !== undefined) {
let annotationsLabel = 'annotations';
switch (type) {
case FileAnnotationType.Gutter:
case FileAnnotationType.Hover:
case FileAnnotationType.Blame:
annotationsLabel = 'blame annotations';
break;
@ -379,7 +364,7 @@ export class AnnotationController extends Disposable {
let provider: AnnotationProviderBase | undefined = undefined;
switch (type) {
case FileAnnotationType.Gutter:
case FileAnnotationType.Blame:
provider = new GutterBlameAnnotationProvider(editor, trackedDocument, Decorations.blameAnnotation, Decorations.blameHighlight);
break;
@ -387,10 +372,6 @@ export class AnnotationController extends Disposable {
provider = new HeatmapBlameAnnotationProvider(editor, trackedDocument, Decorations.blameAnnotation, undefined);
break;
case FileAnnotationType.Hover:
provider = new HoverBlameAnnotationProvider(editor, trackedDocument, Decorations.blameAnnotation, Decorations.blameHighlight);
break;
case FileAnnotationType.RecentChanges:
provider = new RecentChangesAnnotationProvider(editor, trackedDocument, undefined, Decorations.recentChangesHighlight!);
break;

+ 2
- 2
src/annotations/annotations.ts Wyświetl plik

@ -46,13 +46,13 @@ export class Annotations {
if (commit.previousSha !== undefined) {
if (annotationType === FileAnnotationType.RecentChanges) {
annotationType = FileAnnotationType.Gutter;
annotationType = FileAnnotationType.Blame;
}
const uri = GitUri.toRevisionUri(commit.previousSha, commit.previousUri.fsPath, commit.repoPath);
const line = window.activeTextEditor!.selection.active.line;
commandBar += `[\`${GlyphChars.SquareWithTopShadow}\`](${OpenFileRevisionCommand.getMarkdownCommandArgs(uri, annotationType || FileAnnotationType.Gutter, line)} "Blame Previous Revision") `;
commandBar += `[\`${GlyphChars.SquareWithTopShadow}\`](${OpenFileRevisionCommand.getMarkdownCommandArgs(uri, annotationType || FileAnnotationType.Blame, line)} "Blame Previous Revision") `;
}
if (hasRemote) {

+ 3
- 6
src/annotations/blameAnnotationProvider.ts Wyświetl plik

@ -3,7 +3,6 @@ import { Arrays, Iterables } from '../system';
import { CancellationToken, Disposable, Hover, HoverProvider, languages, Position, Range, TextDocument, TextEditor, TextEditorDecorationType } from 'vscode';
import { AnnotationProviderBase } from './annotationProvider';
import { Annotations } from './annotations';
import { FileAnnotationType } from './../configuration';
import { RangeEndOfLineIndex } from '../constants';
import { Container } from '../container';
import { GitDocumentState, TrackedDocument } from '../trackers/documentTracker';
@ -94,7 +93,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
}
registerHoverProviders(providers: { details: boolean, changes: boolean }) {
if (!providers.details && !providers.changes) return;
if (!Container.config.hovers.enabled || !Container.config.hovers.annotations.enabled || (!providers.details && !providers.changes)) return;
const subscriptions: Disposable[] = [];
if (providers.changes) {
@ -122,7 +121,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
}
}
const message = Annotations.getHoverMessage(logCommit || commit, Container.config.defaultDateFormat, await Container.git.hasRemote(commit.repoPath), Container.config.blame.file.annotationType);
const message = Annotations.getHoverMessage(logCommit || commit, Container.config.defaultDateFormat, await Container.git.hasRemote(commit.repoPath), this.annotationType);
return new Hover(message, document.validateRange(new Range(position.line, 0, position.line, RangeEndOfLineIndex)));
}
@ -135,9 +134,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
}
private async getCommitForHover(position: Position): Promise<GitCommit | undefined> {
const annotationType = Container.config.blame.file.annotationType;
const wholeLine = annotationType === FileAnnotationType.Hover || (annotationType === FileAnnotationType.Gutter && Container.config.annotations.file.gutter.hover.wholeLine);
if (!wholeLine && position.character !== 0) return undefined;
if (Container.config.hovers.annotations.over !== 'line' && position.character !== 0) return undefined;
const blame = await this.getBlame();
if (blame === undefined) return undefined;

+ 9
- 9
src/annotations/gutterBlameAnnotationProvider.ts Wyświetl plik

@ -12,14 +12,14 @@ import { Logger } from '../logger';
export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
async onProvideAnnotation(shaOrLine?: string | number, type?: FileAnnotationType): Promise<boolean> {
this.annotationType = FileAnnotationType.Gutter;
this.annotationType = FileAnnotationType.Blame;
const blame = await this.getBlame();
if (blame === undefined) return false;
const start = process.hrtime();
const cfg = Container.config.annotations.file.gutter;
const cfg = Container.config.blame;
// Precalculate the formatting options so we don't need to do it on each iteration
const tokenOptions = Strings.getTokensFromTemplate(cfg.format)
@ -34,14 +34,14 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
};
const now = Date.now();
const gravatars = cfg.gravatars;
const avatars = cfg.avatars;
const gravatarDefault = Container.config.defaultGravatarsStyle;
const separateLines = cfg.separateLines;
const renderOptions = Annotations.gutterRenderOptions(separateLines, cfg.heatmap, cfg.format, options);
this.decorations = [];
const decorationsMap: { [sha: string]: DecorationOptions | undefined } = Object.create(null);
const avatarDecorationsMap: { [email: string]: { decoration: TextEditorDecorationType, ranges: Range[] } } | undefined = gravatars ? Object.create(null) : undefined;
const avatarDecorationsMap: { [email: string]: { decoration: TextEditorDecorationType, ranges: Range[] } } | undefined = avatars ? Object.create(null) : undefined;
let commit: GitBlameCommit | undefined;
let compacted = false;
@ -75,7 +75,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
this.decorations.push(gutter);
if (gravatars && !cfg.compact && commit !== undefined && commit.email !== undefined) {
if (avatars && !cfg.compact && commit !== undefined && commit.email !== undefined) {
this.addOrUpdateGravatarDecoration(commit, gutter.range, gravatarDefault, avatarDecorationsMap!);
}
@ -97,7 +97,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
this.decorations.push(gutter);
if (gravatars && commit.email !== undefined) {
if (avatars && commit.email !== undefined) {
this.addOrUpdateGravatarDecoration(commit, gutter.range, gravatarDefault, avatarDecorationsMap!);
}
@ -114,7 +114,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
this.decorations.push(gutter);
if (gravatars && commit.email !== undefined) {
if (avatars && commit.email !== undefined) {
this.addOrUpdateGravatarDecoration(commit, gutter.range, gravatarDefault, avatarDecorationsMap!);
}
@ -124,7 +124,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
if (this.decorations.length) {
this.editor.setDecorations(this.decoration!, this.decorations);
if (gravatars) {
if (avatars) {
this.additionalDecorations = [];
for (const d of Objects.values(avatarDecorationsMap!)) {
this.additionalDecorations.push(d);
@ -136,7 +136,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
const duration = process.hrtime(start);
Logger.log(`${(duration[0] * 1000) + Math.floor(duration[1] / 1000000)} ms to compute gutter blame annotations`);
this.registerHoverProviders(cfg.hover);
this.registerHoverProviders(Containerclass="p">.config.hovers.annotations);
this.selection(shaOrLine, blame);
return true;
}

+ 2
- 0
src/annotations/heatmapBlameAnnotationProvider.ts Wyświetl plik

@ -3,6 +3,7 @@ import { DecorationOptions, Range } from 'vscode';
import { Annotations } from './annotations';
import { BlameAnnotationProviderBase } from './blameAnnotationProvider';
import { FileAnnotationType } from './../configuration';
import { Container } from '../container';
import { GitBlameCommit } from '../gitService';
import { Logger } from '../logger';
@ -57,6 +58,7 @@ export class HeatmapBlameAnnotationProvider extends BlameAnnotationProviderBase
const duration = process.hrtime(start);
Logger.log(`${(duration[0] * 1000) + Math.floor(duration[1] / 1000000)} ms to compute heatmap annotations`);
this.registerHoverProviders(Container.config.hovers.annotations);
this.selection(shaOrLine, blame);
return true;
}

+ 51
- 51
src/annotations/hoverBlameAnnotationProvider.ts Wyświetl plik

@ -1,71 +1,71 @@
'use strict';
import { DecorationOptions, Range } from 'vscode';
import { Annotations } from './annotations';
import { BlameAnnotationProviderBase } from './blameAnnotationProvider';
import { FileAnnotationType } from './../configuration';
import { Container } from '../container';
import { GitBlameCommit } from '../gitService';
import { Logger } from '../logger';
// 'use strict';
// import { DecorationOptions, Range } from 'vscode';
// import { Annotations } from './annotations';
// import { BlameAnnotationProviderBase } from './blameAnnotationProvider';
// import { FileAnnotationType } from './../configuration';
// import { Container } from '../container';
// import { GitBlameCommit } from '../gitService';
// import { Logger } from '../logger';
export class HoverBlameAnnotationProvider extends BlameAnnotationProviderBase {
// export class HoverBlameAnnotationProvider extends BlameAnnotationProviderBase {
async onProvideAnnotation(shaOrLine?: string | number): Promise<boolean> {
this.annotationType = FileAnnotationType.Hover;
// async onProvideAnnotation(shaOrLine?: string | number): Promise<boolean> {
// this.annotationType = FileAnnotationType.Hover;
const cfg = Container.config.annotations.file.hover;
// const cfg = Container.config.annotations.file.hover;
const blame = await this.getBlame();
if (blame === undefined) return false;
// const blame = await this.getBlame();
// if (blame === undefined) return false;
if (cfg.heatmap.enabled) {
const start = process.hrtime();
// if (cfg.heatmap.enabled) {
// const start = process.hrtime();
const now = Date.now();
const renderOptions = Annotations.hoverRenderOptions(cfg.heatmap);
// const now = Date.now();
// const renderOptions = Annotations.hoverRenderOptions(cfg.heatmap);
this.decorations = [];
const decorationsMap: { [sha: string]: DecorationOptions } = Object.create(null);
// this.decorations = [];
// const decorationsMap: { [sha: string]: DecorationOptions } = Object.create(null);
let commit: GitBlameCommit | undefined;
let hover: DecorationOptions | undefined;
// let commit: GitBlameCommit | undefined;
// let hover: DecorationOptions | undefined;
for (const l of blame.lines) {
class="kr">const line ="o">= lass="nx">l.line;
// for (const l of blame.lines) {
// const line = l.line;
hover = decorationsMap[l.sha];
// hover = decorationsMap[l.sha];
if (hover !== undefined) {
class="nx">hover ="o">= {
...hover,
class="nx">range : new Range(line, 0, class="nx">line, 0)
} ass="kr">as DecorationOptions;
// if (hover !== undefined) {
// hover = {
// ...hover,
// range: new Range(line, 0, line, 0)
// } as DecorationOptions;
this.decorations.push(hover);
// this.decorations.push(hover);
continue;
}
// continue;
// }
commit = blame.commits.get(l.sha);
if (commit === undefined) continue;
// commit = blame.commits.get(l.sha);
// if (commit === undefined) continue;
hover = Annotations.hover(commit, renderOptions, now);
hover.range ="o">= new Range(line, 0, line, 0);
// hover = Annotations.hover(commit, renderOptions, now);
// hover.range = new Range(line, 0, line, 0);
this.decorations.push(hover);
decorationsMap[l.sha] = hover;
// this.decorations.push(hover);
// decorationsMap[l.sha] = hover;
}
// }
if (this.decorations.length) {
this.editor.setDecorations(this.decoration!, this.decorations);
}
// if (this.decorations.length) {
// this.editor.setDecorations(this.decoration!, this.decorations);
// }
const duration = process.hrtime(start);
Logger.log(`${(duration[0] * 1000) + Math.floor(duration[1] / 1000000)} ms to compute hover blame annotations`);
}
// const duration = process.hrtime(start);
// Logger.log(`${(duration[0] * 1000) + Math.floor(duration[1] / 1000000)} ms to compute hover blame annotations`);
// }
this.registerHoverProviders(cfg);
this.selection(shaOrLine, blame);
return true;
}
}
// this.registerHoverProviders(cfg);
// this.selection(shaOrLine, blame);
// return true;
// }
// }

+ 14
- 11
src/annotations/recentChangesAnnotationProvider.ts Wyświetl plik

@ -35,8 +35,8 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
const start = process.hrtime();
const cfg = Container.config.annotations.file.recentChanges;
const dateFormat = Containerclass="p">.config.defaultDateFormat;
const cfg = Container.config;
const dateFormat = cfg.defaultDateFormat;
this.decorations = [];
@ -51,16 +51,19 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
const range = this.editor.document.validateRange(new Range(new Position(count, 0), new Position(count, RangeEndOfLineIndex)));
if (cfg.hover.details) {
this.decorations.push({
hoverMessage: Annotations.getHoverMessage(commit, dateFormat, await Container.git.hasRemote(commit.repoPath), Container.config.blame.file.annotationType),
range: range
} as DecorationOptions);
}
let message: MarkdownString | undefined = undefined;
if (cfg.hover.changes) {
message = Annotations.getHoverDiffMessage(commit, this._uri, line);
if (cfg.hovers.enabled && cfg.hovers.annotations.enabled) {
if (cfg.hovers.annotations.details) {
this.decorations.push({
hoverMessage: Annotations.getHoverMessage(commit, dateFormat, await Container.git.hasRemote(commit.repoPath), this.annotationType),
range: range
} as DecorationOptions);
}
if (cfg.hovers.annotations.changes) {
message = Annotations.getHoverDiffMessage(commit, this._uri, line);
}
}
this.decorations.push({

+ 2
- 2
src/commands/showFileBlame.ts Wyświetl plik

@ -1,7 +1,7 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand } from './common';
import { configuration, FileAnnotationType } from '../configuration';
import { FileAnnotationType } from '../configuration';
import { Container } from '../container';
import { Logger } from '../logger';
@ -21,7 +21,7 @@ export class ShowFileBlameCommand extends EditorCommand {
try {
if (args.type === undefined) {
args = { ...args, type: configuration.get<FileAnnotationType>(configuration.name('blame')('file')('annotationType').value) };
args = { ...args, type: FileAnnotationType.Blame };
}
return Container.annotations.showAnnotations(editor, args.type!, args.sha !== undefined ? args.sha : editor.selection.active.line);

+ 3
- 12
src/commands/showLineBlame.ts Wyświetl plik

@ -1,29 +1,20 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { TextEditor, TextEditorEdit, window } from 'vscode';
import { Commands, EditorCommand } from './common';
import { Container } from '../container';
import { configuration, LineAnnotationType } from '../configuration';
import { Logger } from '../logger';
export interface ShowLineBlameCommandArgs {
type?: LineAnnotationType;
}
export class ShowLineBlameCommand extends EditorCommand {
constructor() {
super(Commands.ShowLineBlame);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ShowLineBlameCommandArgs = {}): Promise<any> {
async execute(editor: TextEditor, edit: TextEditorEdit): Promise<any> {
if (editor === undefined) return undefined;
try {
if (args.type === undefined) {
args = { ...args, type: configuration.get<LineAnnotationType>(configuration.name('blame')('line')('annotationType').value) };
}
return Container.lineAnnotations.showAnnotations(editor, args.type!);
return Container.lineAnnotations.showAnnotations(editor);
}
catch (ex) {
Logger.error(ex, 'ShowLineBlameCommand');

+ 2
- 2
src/commands/toggleFileBlame.ts Wyświetl plik

@ -2,7 +2,7 @@
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand } from './common';
import { UriComparer } from '../comparers';
import { configuration, FileAnnotationType } from '../configuration';
import { FileAnnotationType } from '../configuration';
import { Container } from '../container';
import { Logger } from '../logger';
@ -30,7 +30,7 @@ export class ToggleFileBlameCommand extends EditorCommand {
try {
if (args.type === undefined) {
args = { ...args, type: configuration.get<FileAnnotationType>(configuration.name('blame')('file')('annotationType').value) };
args = { ...args, type: FileAnnotationType.Blame };
}
return Container.annotations.toggleAnnotations(editor, args.type!, args.sha !== undefined ? args.sha : editor.selection.active.line);

+ 2
- 11
src/commands/toggleLineBlame.ts Wyświetl plik

@ -1,29 +1,20 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand } from './common';
import { configuration, LineAnnotationType } from '../configuration';
import { Container } from '../container';
import { Logger } from '../logger';
export interface ToggleLineBlameCommandArgs {
type?: LineAnnotationType;
}
export class ToggleLineBlameCommand extends EditorCommand {
constructor() {
super(Commands.ToggleLineBlame);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ToggleLineBlameCommandArgs = {}): Promise<any> {
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri): Promise<any> {
if (editor === undefined) return undefined;
try {
if (args.type === undefined) {
args = { ...args, type: configuration.get<LineAnnotationType>(configuration.name('blame')('line')('annotationType').value) };
}
return Container.lineAnnotations.toggleAnnotations(editor, args.type!);
return Container.lineAnnotations.toggleAnnotations(editor);
}
catch (ex) {
Logger.error(ex, 'ToggleLineBlameCommand');

+ 93
- 114
src/config.ts Wyświetl plik

@ -9,7 +9,13 @@ export enum CodeLensCommand {
ToggleFileBlame = 'gitlens.toggleFileBlame'
}
export enum CodeLensLocations {
export interface CodeLensLanguageScope {
language: string | undefined;
scopes: CodeLensScopes[];
symbolScopes?: string[];
}
export enum CodeLensScopes {
Document = 'document',
Containers = 'containers',
Blocks = 'blocks'
@ -35,9 +41,8 @@ export enum ExplorerFilesLayout {
}
export enum FileAnnotationType {
Gutter = 'gutter',
Blame = 'blame',
Heatmap = 'heatmap',
Hover = 'hover',
RecentChanges = 'recentChanges'
}
@ -56,23 +61,18 @@ export enum GravatarDefaultStyle {
Robot = 'robohash'
}
export enum HighlightLocations {
Gutter = 'gutter',
Line = 'line',
OverviewRuler = 'overviewRuler'
}
export enum KeyMap {
Standard = 'standard',
Chorded = 'chorded',
None = 'none'
}
export enum LineAnnotationType {
Trailing = 'trailing',
Hover = 'hover'
}
export enum LineHighlightLocations {
Gutter = 'gutter',
Line = 'line',
OverviewRuler = 'overviewRuler'
}
export enum OutputLevel {
Silent = 'silent',
Errors = 'errors',
@ -95,11 +95,14 @@ export interface IAdvancedConfig {
delayAfterEdit: number;
sizeThresholdAfterEdit: number;
};
caching: {
enabled: boolean;
};
git: string;
maxListItems: number;
menus: {
explorerContext: {
fileDiff: boolean;
@ -128,6 +131,7 @@ export interface IAdvancedConfig {
remote: boolean;
};
};
messages: {
suppressCommitHasNoPreviousCommitWarning: boolean,
suppressCommitNotFoundWarning: boolean,
@ -139,68 +143,73 @@ export interface IAdvancedConfig {
suppressUpdateNotice: boolean,
suppressWelcomeNotice: boolean
};
quickPick: {
closeOnFocusOut: boolean;
};
repositorySearchDepth: number;
telemetry: {
enabled: boolean;
};
}
export interface ICodeLensConfig {
enabled: boolean;
recentChange: {
authors: {
enabled: boolean;
command: CodeLensCommand;
};
authors: {
debug: boolean;
enabled: boolean;
recentChange: {
enabled: boolean;
command: CodeLensCommand;
};
locations: CodeLensLocations[];
customLocationSymbols: string[];
perLanguageLocations: ICodeLensLanguageLocation[];
debug: boolean;
}
export interface ICodeLensLanguageLocation {
language: string | undefined;
locations: CodeLensLocations[];
customSymbols?: string[];
scopes: CodeLensScopes[];
scopesByLanguage: CodeLensLanguageScope[];
symbolScopes: string[];
}
export interface IExplorerConfig {
files: {
layout: ExplorerFilesLayout;
compact: boolean;
threshold: number;
};
commitFormat: string;
export interface IExplorersConfig {
avatars: boolean;
commitFileFormat: string;
commitFormat: string;
// dateFormat: string | null;
gravatars: boolean;
showTrackingBranch: boolean;
stashFormat: string;
stashFileFormat: string;
stashFormat: string;
statusFileFormat: string;
}
export interface IGitExplorerConfig extends IExplorerConfig {
enabled: boolean;
export interface IExplorersFilesConfig {
compact: boolean;
layout: ExplorerFilesLayout;
threshold: number;
}
export interface IGitExplorerConfig {
autoRefresh: boolean;
enabled: boolean;
files: IExplorersFilesConfig;
includeWorkingTree: boolean;
showTrackingBranch: boolean;
view: GitExplorerView;
}
export interface IResultsExplorerConfig extends IExplorerConfig { }
export interface IResultsExplorerConfig {
files: IExplorersFilesConfig;
}
export interface IRemotesConfig {
type: CustomRemoteType;
domain: string;
name?: string;
protocol?: string;
type: CustomRemoteType;
urls?: IRemotesUrlsConfig;
}
@ -217,93 +226,67 @@ export interface IRemotesUrlsConfig {
}
export interface IConfig {
annotations: {
file: {
gutter: {
format: string;
dateFormat: string | null;
compact: boolean;
gravatars: boolean;
heatmap: {
enabled: boolean;
location: 'left' | 'right';
};
hover: {
details: boolean;
changes: boolean;
wholeLine: boolean;
};
separateLines: boolean;
};
hover: {
details: boolean;
changes: boolean;
heatmap: {
enabled: boolean;
};
};
recentChanges: {
hover: {
details: boolean;
changes: boolean;
};
};
};
line: {
hover: {
details: boolean;
changes: boolean;
};
trailing: {
format: string;
dateFormat: string | null;
hover: {
details: boolean;
changes: boolean;
wholeLine: boolean;
};
};
};
};
blame: {
ignoreWhitespace: boolean;
file: {
annotationType: FileAnnotationType;
lineHighlight: {
enabled: boolean;
locations: LineHighlightLocations[];
};
avatars: boolean;
compact: boolean;
dateFormat: string | null;
format: string;
heatmap: {
enabled: boolean;
location: 'left' | 'right';
};
line: {
highlight: {
enabled: boolean;
annotationType: LineAnnotationType;
locations: HighlightLocations[];
};
ignoreWhitespace: boolean;
separateLines: boolean;
};
recentChanges: {
file: {
lineHighlight: {
locations: LineHighlightLocations[];
};
}
currentLine: {
dateFormat: string | null;
enabled: boolean;
format: string;
};
codeLens: ICodeLensConfig;
debug: boolean;
defaultDateFormat: string | null;
defaultDateStyle: DateStyle;
defaultGravatarsStyle: GravatarDefaultStyle;
explorers: IExplorersConfig;
gitExplorer: IGitExplorerConfig;
hovers: {
annotations: {
changes: boolean;
details: boolean;
enabled: boolean;
over: 'line' | 'annotation'
};
currentLine: {
changes: boolean;
details: boolean;
enabled: boolean;
over: 'line' | 'annotation'
};
enabled: boolean;
};
insiders: boolean;
keymap: KeyMap;
outputLevel: OutputLevel;
recentChanges: {
highlight: {
locations: HighlightLocations[];
};
};
remotes: IRemotesConfig[];
@ -327,9 +310,5 @@ export interface IConfig {
};
};
debug: boolean;
insiders: boolean;
outputLevel: OutputLevel;
advanced: IAdvancedConfig;
}

+ 17
- 0
src/configuration.ts Wyświetl plik

@ -65,6 +65,23 @@ export class Configuration {
return workspace.getConfiguration(section === undefined ? undefined : ExtensionKey, resource!).inspect(section === undefined ? ExtensionKey : section);
}
async migrate<TFrom, TTo>(from: string, to: string, migrationFn?: (value: TFrom) => TTo) {
const inspection = configuration.inspect(from);
if (inspection === undefined) return;
if (inspection.globalValue !== undefined) {
await this.update(to, migrationFn ? migrationFn(inspection.globalValue as TFrom) : inspection.globalValue, ConfigurationTarget.Global);
}
if (inspection.workspaceValue !== undefined) {
await this.update(to, migrationFn ? migrationFn(inspection.workspaceValue as TFrom) : inspection.workspaceValue, ConfigurationTarget.Workspace);
}
if (inspection.workspaceFolderValue !== undefined) {
await this.update(to, migrationFn ? migrationFn(inspection.workspaceFolderValue as TFrom) : inspection.workspaceFolderValue, ConfigurationTarget.WorkspaceFolder);
}
}
name<K extends keyof IConfig>(name: K) {
return Functions.propOf(emptyConfig as IConfig, name);
}

+ 31
- 46
src/currentLineController.ts Wyświetl plik

@ -3,7 +3,7 @@ import { Functions, IDeferrable } from './system';
import { CancellationToken, ConfigurationChangeEvent, debug, DecorationRangeBehavior, DecorationRenderOptions, Disposable, Hover, HoverProvider, languages, Position, Range, StatusBarAlignment, StatusBarItem, TextDocument, TextEditor, TextEditorDecorationType, window } from 'vscode';
import { Annotations } from './annotations/annotations';
import { Commands } from './commands';
import { configuration, FileAnnotationType, IConfig, LineAnnotationType, StatusBarCommand } from './configuration';
import { configuration, IConfig, StatusBarCommand } from './configuration';
import { isTextEditor, RangeEndOfLineIndex } from './constants';
import { Container } from './container';
import { DocumentBlameStateChangeEvent, DocumentDirtyIdleTriggerEvent, DocumentDirtyStateChangeEvent, GitDocumentState, TrackedDocument } from './trackers/documentTracker';
@ -20,11 +20,7 @@ const annotationDecoration: TextEditorDecorationType = window.createTextEditorDe
class AnnotationState {
constructor(private _enabled: boolean, private _annotationType: LineAnnotationType) { }
get annotationType(): LineAnnotationType {
return this._annotationType;
}
constructor(private _enabled: boolean) { }
get enabled(): boolean {
return this.suspended ? false : this._enabled;
@ -35,13 +31,12 @@ class AnnotationState {
return this._suspendReason !== undefined;
}
reset(enabled: boolean, annotationType: LineAnnotationType): boolean {
reset(enabled: boolean): boolean {
// returns whether or not a refresh is required
if (this._enabled === enabled && this._annotationType === annotationType && !this.suspended) return false;
if (this._enabled === enabled && !this.suspended) return false;
this._enabled = enabled;
this._annotationType = annotationType;
this._suspendReason = undefined;
return true;
@ -109,14 +104,12 @@ export class CurrentLineController extends Disposable {
let changed = false;
if (initializing || configuration.changed(e, configuration.name('blame')('line').value)) {
if (initializing || configuration.changed(e, configuration.name('currentLine').value)) {
changed = true;
this._blameAnnotationState = undefined;
}
if (initializing ||
configuration.changed(e, configuration.name('annotations')('line')('trailing').value) ||
configuration.changed(e, configuration.name('annotations')('line')('hover').value)) {
if (initializing || configuration.changed(e, configuration.name('hovers').value)) {
changed = true;
this.unregisterHoverProviders();
}
@ -142,7 +135,7 @@ export class CurrentLineController extends Disposable {
if (!changed) return;
const trackCurrentLine = cfg.statusBar.enabled || cfg.blame.line.enabled ||
const trackCurrentLine = cfg.currentLine.enabled || cfg.statusBar.enabled || (cfg.hovers.enabled && cfg.hovers.currentLine.enabled) ||
(this._blameAnnotationState !== undefined && this._blameAnnotationState.enabled);
if (trackCurrentLine) {
@ -240,16 +233,11 @@ export class CurrentLineController extends Disposable {
const commit = this._lineTracker.state !== undefined ? this._lineTracker.state.commit : undefined;
if (commit === undefined) return undefined;
const fileAnnotations = await Container.annotations.getAnnotationType(this._editor);
// Avoid double annotations if we are showing the whole-file hover blame annotations
if ((fileAnnotations === FileAnnotationType.Gutter && Container.config.annotations.file.gutter.hover.details) ||
(fileAnnotations === FileAnnotationType.Hover && Container.config.annotations.file.hover.details)) {
return undefined;
}
const fileAnnotations = await Container.annotations.getAnnotationType(this._editor);
if (fileAnnotations !== undefined && Container.config.hovers.annotations.details) return undefined;
const state = this.getBlameAnnotationState();
const wholeLine = state.annotationType === LineAnnotationType.Hover || (state.annotationType === LineAnnotationType.Trailing && Container.config.annotations.line.trailing.hover.wholeLine) ||
fileAnnotations === FileAnnotationType.Hover || (fileAnnotations === FileAnnotationType.Gutter && Container.config.annotations.file.gutter.hover.wholeLine);
const wholeLine = Container.config.hovers.currentLine.over === 'line';
const range = document.validateRange(new Range(position.line, wholeLine ? 0 : RangeEndOfLineIndex, position.line, RangeEndOfLineIndex));
if (!wholeLine && range.start.character !== position.character) return undefined;
@ -272,7 +260,7 @@ export class CurrentLineController extends Disposable {
const trackedDocument = await Container.tracker.get(document);
if (trackedDocument === undefined) return undefined;
const message = Annotations.getHoverMessage(logCommit || commit, Container.config.defaultDateFormat, trackedDocument.hasRemotes, Container.config.blame.file.annotationType);
const message = Annotations.getHoverMessage(logCommit || commit, Container.config.defaultDateFormat, trackedDocument.hasRemotes, fileAnnotations);
return new Hover(message, range);
}
@ -283,16 +271,13 @@ export class CurrentLineController extends Disposable {
const commit = this._lineTracker.state !== undefined ? this._lineTracker.state.commit : undefined;
if (commit === undefined) return undefined;
const fileAnnotations = await Container.annotations.getAnnotationType(this._editor);
// Avoid double annotations if we are showing the whole-file hover blame annotations
if ((fileAnnotations === FileAnnotationType.Gutter && Container.config.annotations.file.gutter.hover.changes) ||
(fileAnnotations === FileAnnotationType.Hover && Container.config.annotations.file.hover.changes)) {
return undefined;
if (Container.config.hovers.annotations.changes) {
const fileAnnotations = await Container.annotations.getAnnotationType(this._editor);
if (fileAnnotations !== undefined) return undefined;
}
const state = this.getBlameAnnotationState();
const wholeLine = state.annotationType === LineAnnotationType.Hover || (state.annotationType === LineAnnotationType.Trailing && Container.config.annotations.line.trailing.hover.wholeLine) ||
fileAnnotations === FileAnnotationType.Hover || (fileAnnotations === FileAnnotationType.Gutter && Container.config.annotations.file.gutter.hover.wholeLine);
const wholeLine = Container.config.hovers.currentLine.over === 'line';
const range = document.validateRange(new Range(position.line, wholeLine ? 0 : RangeEndOfLineIndex, position.line, RangeEndOfLineIndex));
if (!wholeLine && range.start.character !== position.character) return undefined;
@ -321,15 +306,15 @@ export class CurrentLineController extends Disposable {
this.updateTrailingAnnotation(commit, blameLine, editor, line);
}
async showAnnotations(editor: TextEditor | undefined, type: LineAnnotationType) {
this.setBlameAnnotationState(true, type, editor);
async showAnnotations(editor: TextEditor | undefined) {
this.setBlameAnnotationState(true, editor);
}
async toggleAnnotations(editor: TextEditor | undefined, type: LineAnnotationType) {
async toggleAnnotations(editor: TextEditor | undefined) {
if (editor === undefined) return;
const state = this.getBlameAnnotationState();
this.setBlameAnnotationState(!state.enabled, type, editor);
this.setBlameAnnotationState(!state.enabled, editor);
}
private async resumeBlameAnnotations(reason: 'debugging' | 'dirty', editor: TextEditor | undefined, options: { force?: boolean } = {}) {
@ -352,7 +337,7 @@ export class CurrentLineController extends Disposable {
if (this._blameAnnotationState === undefined && !state.enabled) return false;
if (this._blameAnnotationState === undefined) {
this._blameAnnotationState = new AnnotationState(state.enabled, state.annotationType);
this._blameAnnotationState = new AnnotationState(state.enabled);
}
const refresh = this._blameAnnotationState.suspend(reason);
@ -362,13 +347,13 @@ export class CurrentLineController extends Disposable {
return true;
}
private async setBlameAnnotationState(enabled: boolean, type: LineAnnotationType, editor: TextEditor | undefined) {
private async setBlameAnnotationState(enabled: boolean, editor: TextEditor | undefined) {
let refresh = true;
if (this._blameAnnotationState === undefined) {
this._blameAnnotationState = new AnnotationState(enabled, type);
this._blameAnnotationState = new AnnotationState(enabled);
}
else {
refresh = this._blameAnnotationState.reset(enabled, type);
refresh = this._blameAnnotationState.reset(enabled);
}
if (editor === undefined || !refresh) return;
@ -385,9 +370,9 @@ export class CurrentLineController extends Disposable {
private getBlameAnnotationState() {
if (this._blameAnnotationState !== undefined) return this._blameAnnotationState;
const cfg = Container.config;
return {
enabled: Container.config.blame.line.enabled || Container.config.statusBar.enabled,
annotationType: Container.config.blame.line.annotationType
enabled: cfg.currentLine.enabled || cfg.statusBar.enabled || (cfg.hovers.enabled && cfg.hovers.currentLine.enabled)
};
}
@ -419,8 +404,9 @@ export class CurrentLineController extends Disposable {
}
if (options.trackedDocument.isBlameable) {
if (state.enabled && (options.full || this._hoverProviderDisposable === undefined)) {
this.registerHoverProviders(editor, state.annotationType === LineAnnotationType.Trailing ? Container.config.annotations.line.trailing.hover : Container.config.annotations.line.hover);
if (state.enabled && Container.config.hovers.enabled && Container.config.hovers.currentLine.enabled &&
(options.full || this._hoverProviderDisposable === undefined)) {
this.registerHoverProviders(editor, Container.config.hovers.currentLine);
}
if (this._updateBlameDebounced === undefined) {
@ -536,13 +522,12 @@ export class CurrentLineController extends Disposable {
}
private async updateTrailingAnnotation(commit: GitCommit, blameLine: GitCommitLine, editor: TextEditor, line?: number) {
const cfg = Container.config.blame.line;
if (!cfg.enabled || cfg.annotationType !== LineAnnotationType.Trailing || !isTextEditor(editor)) return;
const cfg = Container.config.currentLine;
if (!cfg.enabled || !isTextEditor(editor)) return;
line = line === undefined ? blameLine.line : line;
const cfgTrailing = Container.config.annotations.line.trailing;
const decoration = Annotations.trailing(commit, cfgTrailing.format, cfgTrailing.dateFormat === null ? Container.config.defaultDateFormat : cfgTrailing.dateFormat);
const decoration = Annotations.trailing(commit, cfg.format, cfg.dateFormat === null ? Container.config.defaultDateFormat : cfg.dateFormat);
decoration.range = editor.document.validateRange(new Range(line, RangeEndOfLineIndex, line, RangeEndOfLineIndex));
editor.setDecorations(annotationDecoration, [decoration]);

+ 55
- 36
src/extension.ts Wyświetl plik

@ -1,7 +1,7 @@
'use strict';
import { Objects, Versions } from './system';
import { ConfigurationTarget, ExtensionContext, extensions, window, workspace } from 'vscode';
import { configuration, Configuration, IConfig } from './configuration';
import { CodeLensLanguageScope, CodeLensScopes, configuration, Configuration, IConfig } from './configuration';
import { CommandContext, ExtensionKey, GlobalState, QualifiedExtensionId, setCommandContext } from './constants';
import { configureCommands } from './commands';
import { Container } from './container';
@ -29,6 +29,9 @@ export async function activate(context: ExtensionContext) {
Configuration.configure(context);
const previousVersion = context.globalState.get<string>(GlobalState.GitLensVersion);
await migrateSettings(context, previousVersion);
const cfg = configuration.get<IConfig>();
try {
@ -52,9 +55,6 @@ export async function activate(context: ExtensionContext) {
// telemetryContext['git.version'] = gitVersion;
// Telemetry.setContext(telemetryContext);
const previousVersion = context.globalState.get<string>(GlobalState.GitLensVersion);
await migrateSettings(context, previousVersion);
notifyOnUnsupportedGitVersion(context, gitVersion);
notifyOnNewGitLensVersion(context, gitlensVersion, previousVersion);
@ -109,45 +109,64 @@ async function migrateSettings(context: ExtensionContext, previousVersion: strin
if (Versions.compare(previous, Versions.from(7, 1, 0)) !== 1) {
// https://github.com/eamodio/vscode-gitlens/issues/239
const section = configuration.name('advanced')('quickPick')('closeOnFocusOut').value;
const inspection = configuration.inspect(section);
if (inspection !== undefined) {
if (inspection.globalValue !== undefined) {
await configuration.update(section, !inspection.globalValue, ConfigurationTarget.Global);
}
else if (inspection.workspaceFolderValue !== undefined) {
await configuration.update(section, !inspection.workspaceFolderValue, ConfigurationTarget.WorkspaceFolder);
}
}
await configuration.migrate<boolean, boolean>(section, section, v => !v);
}
if (Versions.compare(previous, Versions.from(7, 3, 0, 'beta2')) !== 1) {
const oldSection = 'advanced.maxQuickHistory';
const inspection = configuration.inspect(oldSection);
if (inspection !== undefined) {
const section = configuration.name('advanced')('maxListItems').value;
if (inspection.globalValue !== undefined) {
await configuration.update(section, inspection.globalValue, ConfigurationTarget.Global);
}
else if (inspection.workspaceFolderValue !== undefined) {
await configuration.update(section, inspection.workspaceFolderValue, ConfigurationTarget.WorkspaceFolder);
}
}
await configuration.migrate('advanced.maxQuickHistory', configuration.name('advanced')('maxListItems').value);
}
if (Versions.compare(previous, Versions.from(7, 3, 0, 'beta4')) !== 1) {
const oldSection = 'gitExplorer.gravatarsDefault';
const inspection = configuration.inspect(oldSection);
if (inspection !== undefined) {
const section = configuration.name('defaultGravatarsStyle').value;
await configuration.migrate('gitExplorer.gravatarsDefault', configuration.name('defaultGravatarsStyle').value);
}
if (inspection.globalValue !== undefined) {
await configuration.update(section, inspection.globalValue, ConfigurationTarget.Global);
}
else if (inspection.workspaceFolderValue !== undefined) {
await configuration.update(section, inspection.workspaceFolderValue, ConfigurationTarget.WorkspaceFolder);
}
}
if (Versions.compare(previous, Versions.from(8, 0, 0, 'beta')) !== 1) {
await configuration.migrate('annotations.file.gutter.gravatars', configuration.name('blame')('avatars').value);
await configuration.migrate('annotations.file.gutter.compact', configuration.name('blame')('compact').value);
await configuration.migrate('annotations.file.gutter.dateFormat', configuration.name('blame')('dateFormat').value);
await configuration.migrate('annotations.file.gutter.format', configuration.name('blame')('format').value);
await configuration.migrate('annotations.file.gutter.heatmap.enabled', configuration.name('blame')('heatmap')('enabled').value);
await configuration.migrate('annotations.file.gutter.heatmap.location', configuration.name('blame')('heatmap')('location').value);
await configuration.migrate('annotations.file.gutter.lineHighlight.enabled', configuration.name('blame')('highlight')('enabled').value);
await configuration.migrate('annotations.file.gutter.lineHighlight.locations', configuration.name('blame')('highlight')('locations').value);
await configuration.migrate('annotations.file.gutter.separateLines', configuration.name('blame')('separateLines').value);
await configuration.migrate('codeLens.locations', configuration.name('codeLens')('scopes').value);
await configuration.migrate<{ customSymbols?: string[], language: string | undefined, locations: CodeLensScopes[] }[], CodeLensLanguageScope[]>('codeLens.perLanguageLocations', configuration.name('codeLens')('scopesByLanguage').value,
v => {
const scopes = v.map(ls => {
return {
language: ls.language,
scopes: ls.locations,
symbolScopes: ls.customSymbols
};
});
return scopes;
});
await configuration.migrate('codeLens.customLocationSymbols', configuration.name('codeLens')('symbolScopes').value);
await configuration.migrate('annotations.line.trailing.dateFormat', configuration.name('currentLine')('dateFormat').value);
await configuration.migrate('blame.line.enabled', configuration.name('currentLine')('enabled').value);
await configuration.migrate('annotations.line.trailing.format', configuration.name('currentLine')('format').value);
await configuration.migrate('annotations.file.gutter.hover.changes', configuration.name('hovers')('annotations')('changes').value);
await configuration.migrate('annotations.file.gutter.hover.details', configuration.name('hovers')('annotations')('details').value);
await configuration.migrate('annotations.file.gutter.hover.details', configuration.name('hovers')('annotations')('enabled').value);
await configuration.migrate<boolean, 'line' | 'annotation'>('annotations.file.gutter.hover.wholeLine', configuration.name('hovers')('annotations')('over').value, v => v ? 'line' : 'annotation');
await configuration.migrate('annotations.line.trailing.hover.changes', configuration.name('hovers')('currentLine')('changes').value);
await configuration.migrate('annotations.line.trailing.hover.details', configuration.name('hovers')('currentLine')('details').value);
await configuration.migrate('blame.line.enabled', configuration.name('hovers')('currentLine')('enabled').value);
await configuration.migrate<boolean, 'line' | 'annotation'>('annotations.line.trailing.hover.wholeLine', configuration.name('hovers')('currentLine')('over').value, v => v ? 'line' : 'annotation');
await configuration.migrate('gitExplorer.gravatars', configuration.name('explorers')('avatars').value);
await configuration.migrate('gitExplorer.commitFileFormat', configuration.name('explorers')('commitFileFormat').value);
await configuration.migrate('gitExplorer.commitFormat', configuration.name('explorers')('commitFormat').value);
await configuration.migrate('gitExplorer.stashFileFormat', configuration.name('explorers')('stashFileFormat').value);
await configuration.migrate('gitExplorer.stashFormat', configuration.name('explorers')('stashFormat').value);
await configuration.migrate('gitExplorer.statusFileFormat', configuration.name('explorers')('statusFileFormat').value);
await configuration.migrate('recentChanges.file.lineHighlight.locations', configuration.name('recentChanges')('highlight')('locations').value);
}
}
catch (ex) {

+ 26
- 26
src/gitCodeLensProvider.ts Wyświetl plik

@ -2,7 +2,7 @@
import { Functions, Iterables } from './system';
import { CancellationToken, CodeLens, CodeLensProvider, Command, commands, DocumentSelector, Event, EventEmitter, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri } from 'vscode';
import { Commands, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from './commands';
import { CodeLensCommand, CodeLensLocations, configuration, ICodeLensConfig, ICodeLensLanguageLocation } from './configuration';
import { CodeLensCommand, CodeLensLanguageScope, CodeLensScopes, configuration, ICodeLensConfig } from './configuration';
import { BuiltInCommands, DocumentSchemes } from './constants';
import { DocumentTracker, GitDocumentState } from './trackers/documentTracker';
import { GitBlame, GitBlameCommit, GitBlameLines, GitService, GitUri } from './gitService';
@ -89,17 +89,17 @@ export class GitCodeLensProvider implements CodeLensProvider {
const cfg = configuration.get<ICodeLensConfig>(configuration.name('codeLens').value, document.uri);
this._debug = cfg.debug;
let languageLocations = cfg.perLanguageLocations && cfg.perLanguageLocations.find(ll => ll.language !== undefined && ll.language.toLowerCase() === document.languageId);
if (languageLocations == null) {
languageLocations = {
let languageScope = cfg.scopesByLanguage && cfg.scopesByLanguage.find(ll => ll.language !== undefined && ll.language.toLowerCase() === document.languageId);
if (languageScope == null) {
languageScope = {
language: undefined,
locations: cfg.locations,
customSymbols: cfg.customLocationSymbols
} as ICodeLensLanguageLocation;
scopes: cfg.scopes,
symbolScopes: cfg.symbolScopes
} as CodeLensLanguageScope;
}
languageLocations.customSymbols = languageLocations.customSymbols != null
? languageLocations.customSymbols = languageLocations.customSymbols.map(s => s.toLowerCase())
languageScope.symbolScopes = languageScope.symbolScopes != null
? languageScope.symbolScopes = languageScope.symbolScopes.map(s => s.toLowerCase())
: [];
const lenses: CodeLens[] = [];
@ -111,7 +111,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
if (!dirty) {
if (token.isCancellationRequested) return lenses;
if (languageLocations.locations.length === 1 && languageLocations.locations.includes(CodeLensLocations.Document)) {
if (languageScope.scopes.length === 1 && languageScope.scopes.includes(CodeLensScopes.Document)) {
blame = document.isDirty
? await this._git.getBlameForFileContents(gitUri, document.getText())
: await this._git.getBlameForFile(gitUri);
@ -128,7 +128,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
if (blame === undefined || blame.lines.length === 0) return lenses;
}
else {
if (languageLocations.locations.length !== 1 || !languageLocations.locations.includes(CodeLensLocations.Document)) {
if (languageScope.scopes.length !== 1 || !languageScope.scopes.includes(CodeLensScopes.Document)) {
symbols = await commands.executeCommand(BuiltInCommands.ExecuteDocumentSymbolProvider, document.uri) as SymbolInformation[];
}
}
@ -142,10 +142,10 @@ export class GitCodeLensProvider implements CodeLensProvider {
if (symbols !== undefined) {
Logger.log('GitCodeLensProvider.provideCodeLenses:', `${symbols.length} symbol(s) found`);
symbols.forEach(sym => this.provideCodeLens(lenses, document, sym, languageLocations!, documentRangeFn, blame, gitUri, cfg, dirty, dirtyCommand));
symbols.forEach(sym => this.provideCodeLens(lenses, document, sym, languageScope!, documentRangeFn, blame, gitUri, cfg, dirty, dirtyCommand));
}
if ((languageLocations.locations.includes(CodeLensLocations.Document) || languageLocations.customSymbols.includes('file')) && !languageLocations.customSymbols.includes('!file')) {
if ((languageScope.scopes.includes(CodeLensScopes.Document) || languageScope.symbolScopes.includes('file')) && !languageScope.symbolScopes.includes('!file')) {
// Check if we have a lens for the whole document -- if not add one
if (!lenses.find(l => l.range.start.line === 0 && l.range.end.line === 0)) {
const blameRange = documentRangeFn();
@ -186,15 +186,15 @@ export class GitCodeLensProvider implements CodeLensProvider {
return lenses;
}
private validateSymbolAndGetBlameRange(symbol: SymbolInformation, languageLocation: ICodeLensLanguageLocation, documentRangeFn: () => Range): Range | undefined {
private validateSymbolAndGetBlameRange(symbol: SymbolInformation, languageScope: CodeLensLanguageScope, documentRangeFn: () => Range): Range | undefined {
let valid = false;
let range: Range | undefined;
const symbolName = SymbolKind[symbol.kind].toLowerCase();
switch (symbol.kind) {
case SymbolKind.File:
if (languageLocation.locations.includes(CodeLensLocations.Containers) || languageLocation.customSymbols!.includes(symbolName)) {
valid = !languageLocation.customSymbols!.includes(`!${symbolName}`);
if (languageScope.scopes.includes(CodeLensScopes.Containers) || languageScope.symbolScopes!.includes(symbolName)) {
valid = !languageScope.symbolScopes!.includes(`!${symbolName}`);
}
if (valid) {
@ -204,8 +204,8 @@ export class GitCodeLensProvider implements CodeLensProvider {
break;
case SymbolKind.Package:
if (languageLocation.locations.includes(CodeLensLocations.Containers) || languageLocation.customSymbols!.includes(symbolName)) {
valid = !languageLocation.customSymbols!.includes(`!${symbolName}`);
if (languageScope.scopes.includes(CodeLensScopes.Containers) || languageScope.symbolScopes!.includes(symbolName)) {
valid = !languageScope.symbolScopes!.includes(`!${symbolName}`);
}
if (valid) {
@ -221,8 +221,8 @@ export class GitCodeLensProvider implements CodeLensProvider {
case SymbolKind.Module:
case SymbolKind.Namespace:
case SymbolKind.Struct:
if (languageLocation.locations.includes(CodeLensLocations.Containers) || languageLocation.customSymbols!.includes(symbolName)) {
valid = !languageLocation.customSymbols!.includes(`!${symbolName}`);
if (languageScope.scopes.includes(CodeLensScopes.Containers) || languageScope.symbolScopes!.includes(symbolName)) {
valid = !languageScope.symbolScopes!.includes(`!${symbolName}`);
}
break;
@ -230,14 +230,14 @@ export class GitCodeLensProvider implements CodeLensProvider {
case SymbolKind.Enum:
case SymbolKind.Function:
case SymbolKind.Method:
if (languageLocation.locations.includes(CodeLensLocations.Blocks) || languageLocation.customSymbols!.includes(symbolName)) {
valid = !languageLocation.customSymbols!.includes(`!${symbolName}`);
if (languageScope.scopes.includes(CodeLensScopes.Blocks) || languageScope.symbolScopes!.includes(symbolName)) {
valid = !languageScope.symbolScopes!.includes(`!${symbolName}`);
}
break;
default:
if (languageLocation.customSymbols!.includes(symbolName)) {
valid = !languageLocation.customSymbols!.includes(`!${symbolName}`);
if (languageScope.symbolScopes!.includes(symbolName)) {
valid = !languageScope.symbolScopes!.includes(`!${symbolName}`);
}
break;
}
@ -245,8 +245,8 @@ export class GitCodeLensProvider implements CodeLensProvider {
return valid ? range || symbol.location.range : undefined;
}
private provideCodeLens(lenses: CodeLens[], document: TextDocument, symbol: SymbolInformation, languageLocation: ICodeLensLanguageLocation, documentRangeFn: () => Range, blame: GitBlame | undefined, gitUri: GitUri | undefined, cfg: ICodeLensConfig, dirty: boolean, dirtyCommand: Command | undefined): void {
const blameRange = this.validateSymbolAndGetBlameRange(symbol, languageLocation, documentRangeFn);
private provideCodeLens(lenses: CodeLens[], document: TextDocument, symbol: SymbolInformation, languageScope: CodeLensLanguageScope, documentRangeFn: () => Range, blame: GitBlame | undefined, gitUri: GitUri | undefined, cfg: ICodeLensConfig, dirty: boolean, dirtyCommand: Command | undefined): void {
const blameRange = this.validateSymbolAndGetBlameRange(symbol, languageScope, documentRangeFn);
if (blameRange === undefined) return;
const line = document.lineAt(symbol.location.range.start);

+ 3
- 2
src/views/branchNode.ts Wyświetl plik

@ -4,7 +4,8 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitNode } from './commitNode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Explorer, ExplorerNode, ExplorerRefNode, MessageNode, ResourceType, ShowAllNode } from './explorerNode';
import { ExplorerNode, ExplorerRefNode, MessageNode, ResourceType, ShowAllNode } from './explorerNode';
import { GitExplorer } from './gitExplorer';
import { GitBranch, GitUri } from '../gitService';
export class BranchNode extends ExplorerRefNode {
@ -14,7 +15,7 @@ export class BranchNode extends ExplorerRefNode {
constructor(
public readonly branch: GitBranch,
uri: GitUri,
private readonly explorer: Explorer
private readonly explorer: GitExplorer
) {
super(uri);
}

+ 3
- 2
src/views/branchesNode.ts Wyświetl plik

@ -3,7 +3,8 @@ import { Iterables } from '../system';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { BranchNode } from './branchNode';
import { Container } from '../container';
import { Explorer, ExplorerNode, ResourceType } from './explorerNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitExplorer } from './gitExplorer';
import { GitUri, Repository } from '../gitService';
export class BranchesNode extends ExplorerNode {
@ -11,7 +12,7 @@ export class BranchesNode extends ExplorerNode {
constructor(
uri: GitUri,
private readonly repo: Repository,
private readonly explorer: Explorer,
private readonly explorer: GitExplorer,
private readonly active: boolean = false
) {
super(uri);

+ 1
- 1
src/views/commitNode.ts Wyświetl plik

@ -53,7 +53,7 @@ export class CommitNode extends ExplorerRefNode {
? ResourceType.CommitOnCurrentBranch
: ResourceType.Commit;
if (this.explorer.config.gravatars) {
if (this.explorer.config.avatars) {
item.iconPath = this.commit.getGravatarUri(Container.config.defaultGravatarsStyle);
} else {
item.iconPath = {

+ 1
- 1
src/views/fileHistoryNode.ts Wyświetl plik

@ -23,7 +23,7 @@ export class FileHistoryNode extends ExplorerNode {
const children: ExplorerNode[] = [];
const displayAs = CommitFileNodeDisplayAs.CommitLabel | (this.explorer.config.gravatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.StatusIcon);
const displayAs = CommitFileNodeDisplayAs.CommitLabel | (this.explorer.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.workTreeStatus !== undefined)) {

+ 6
- 6
src/views/folderNode.ts Wyświetl plik

@ -1,7 +1,7 @@
'use strict';
import { Arrays, Objects } from '../system';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExplorerFilesLayout, IExplorerConfig } from '../configuration';
import { ExplorerFilesLayout, IExplorersFilesConfig } from '../configuration';
import { Explorer, ExplorerNode, ResourceType } from './explorerNode';
import { GitUri } from '../gitService';
@ -32,7 +32,7 @@ export class FolderNode extends ExplorerNode {
let children: (FolderNode | IFileExplorerNode)[];
const nesting = FolderNode.getFileNesting(this.explorer.config, this.root.descendants, this.relativePath === undefined);
const nesting = FolderNode.getFileNesting(this.explorer.config.files, this.root.descendants, this.relativePath === undefined);
if (nesting !== ExplorerFilesLayout.List) {
children = [];
for (const folder of Objects.values(this.root.children)) {
@ -70,11 +70,11 @@ export class FolderNode extends ExplorerNode {
return this.folderName;
}
static getFileNesting<T extends IFileExplorerNode>(config: IExplorerConfig, children: T[], isRoot: boolean): ExplorerFilesLayout {
const nesting = config.files.layout || ExplorerFilesLayout.Auto;
static getFileNesting<T extends IFileExplorerNode>(config: IExplorersFilesConfig, children: T[], isRoot: boolean): ExplorerFilesLayout {
const nesting = config.layout || ExplorerFilesLayout.Auto;
if (nesting === ExplorerFilesLayout.Auto) {
if (isRoot || config.files.compact) {
const nestingThreshold = config.files.threshold || 5;
if (isRoot || config.compact) {
const nestingThreshold = config.threshold || 5;
if (children.length <= nestingThreshold) return ExplorerFilesLayout.List;
}
return ExplorerFilesLayout.Tree;

+ 3
- 3
src/views/gitExplorer.ts Wyświetl plik

@ -2,7 +2,7 @@
import { Functions } from '../system';
import { commands, ConfigurationChangeEvent, ConfigurationTarget, Disposable, Event, EventEmitter, TextDocumentShowOptions, TextEditor, TreeDataProvider, TreeItem, Uri, window } from 'vscode';
import { UriComparer } from '../comparers';
import { configuration, ExplorerFilesLayout, GitExplorerView, IGitExplorerConfig } from '../configuration';
import { configuration, ExplorerFilesLayout, GitExplorerView, IExplorersConfig, IGitExplorerConfig } from '../configuration';
import { CommandContext, GlyphChars, setCommandContext, WorkspaceState } from '../constants';
import { Container } from '../container';
import { RefreshNodeCommandArgs } from './explorerCommands';
@ -128,8 +128,8 @@ export class GitExplorer extends Disposable implements TreeDataProvider
Container.context.workspaceState.get<boolean>(WorkspaceState.GitExplorerAutoRefresh, true);
}
get config(): IGitExplorerConfig {
return Container.config.gitExplorer;
get config(): IExplorersConfig & IGitExplorerConfig {
return { ...Container.config.explorers, ...Container.config.gitExplorer };
}
private _loading: Promise<void> | undefined;

+ 3
- 2
src/views/remoteNode.ts Wyświetl plik

@ -3,7 +3,8 @@ import { Iterables } from '../system';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { BranchNode } from './branchNode';
import { GlyphChars } from '../constants';
import { Explorer, ExplorerNode, ResourceType } from './explorerNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitExplorer } from './gitExplorer';
import { GitRemote, GitRemoteType, GitUri, Repository } from '../gitService';
export class RemoteNode extends ExplorerNode {
@ -12,7 +13,7 @@ export class RemoteNode extends ExplorerNode {
public readonly remote: GitRemote,
uri: GitUri,
private readonly repo: Repository,
private readonly explorer: Explorer
private readonly explorer: GitExplorer
) {
super(uri);
}

+ 3
- 2
src/views/remotesNode.ts Wyświetl plik

@ -2,7 +2,8 @@
import { Iterables } from '../system';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Container } from '../container';
import { Explorer, ExplorerNode, MessageNode, ResourceType } from './explorerNode';
import { ExplorerNode, MessageNode, ResourceType } from './explorerNode';
import { GitExplorer } from './gitExplorer';
import { GitUri, Repository } from '../gitService';
import { RemoteNode } from './remoteNode';
@ -11,7 +12,7 @@ export class RemotesNode extends ExplorerNode {
constructor(
uri: GitUri,
private readonly repo: Repository,
private readonly explorer: Explorer
private readonly explorer: GitExplorer
) {
super(uri);
}

+ 3
- 3
src/views/resultsExplorer.ts Wyświetl plik

@ -1,7 +1,7 @@
'use strict';
import { Functions, Strings } from '../system';
import { commands, ConfigurationChangeEvent, ConfigurationTarget, Disposable, Event, EventEmitter, TreeDataProvider, TreeItem, window } from 'vscode';
import { configuration, ExplorerFilesLayout, IExplorerConfig } from '../configuration';
import { configuration, ExplorerFilesLayout, IExplorersConfig, IResultsExplorerConfig } from '../configuration';
import { CommandContext, GlyphChars, setCommandContext, WorkspaceState } from '../constants';
import { Container } from '../container';
import { RefreshNodeCommandArgs } from './explorerCommands';
@ -65,8 +65,8 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
}
}
get config(): IExplorerConfig {
return Container.config.resultsExplorer;
get config(): IExplorersConfig & IResultsExplorerConfig {
return { ...Container.config.explorers, ...Container.config.resultsExplorer };
}
get keepResults(): boolean {

+ 1
- 1
src/views/statusFileCommitsNode.ts Wyświetl plik

@ -19,7 +19,7 @@ export class StatusFileCommitsNode extends ExplorerNode {
}
async getChildren(): Promise<ExplorerNode[]> {
return this.commits.map(c => new CommitFileNode(this.status, c, this.explorer, CommitFileNodeDisplayAs.CommitLabel | (this.explorer.config.gravatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.CommitIcon)));
return this.commits.map(c => new CommitFileNode(this.status, c, this.explorer, CommitFileNodeDisplayAs.CommitLabel | (this.explorer.config.avatars ? CommitFileNodeDisplayAs.Gravatar : CommitFileNodeDisplayAs.CommitIcon)));
}
async getTreeItem(): Promise<TreeItem> {

Ładowanie…
Anuluj
Zapisz