Ver código fonte

Adds settings to control commit tooltip formats

main
Eric Amodio 1 ano atrás
pai
commit
d9649ab962
6 arquivos alterados com 39 adições e 23 exclusões
  1. +1
    -0
      CHANGELOG.md
  2. +19
    -5
      package.json
  3. +2
    -0
      src/config.ts
  4. +11
    -15
      src/views/nodes/commitNode.ts
  5. +5
    -2
      src/views/nodes/fileRevisionAsCommitNode.ts
  6. +1
    -1
      src/views/nodes/rebaseStatusNode.ts

+ 1
- 0
CHANGELOG.md Ver arquivo

@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Ensures new worktrees are created from the "main" repo, if already in a worktree
- Adds a new _remote_ command to the _Git Command Palette_ to add, prune, and remove remotes
- Adds a _Create Worktree for Pull Request via GitLens..._ context menu command on pull requests in the _GitHub Pull Requests and Issues_ extension's views
- Adds settings to control the format of commits in the GitLens views
### Changed

+ 19
- 5
package.json Ver arquivo

@ -775,40 +775,54 @@
"scope": "window",
"order": 31
},
"gitlens.views.formats.commits.tooltip": {
"type": "string",
"default": "${link}${' via 'pullRequest}${'  •  'changesDetail}${'    'tips}\n\n${avatar}  __${author}__, ${ago}   _(${date})_ \n\n${message}${\n\n---\n\nfootnotes}",
"markdownDescription": "Specifies the tooltip format (in markdown) of commits in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window",
"order": 32
},
"gitlens.views.formats.commits.tooltipWithStatus": {
"type": "string",
"default": "${link}${' via 'pullRequest}  •  {{slot-status}}${'  •  'changesDetail}${'    'tips}\n\n${avatar}  __${author}__, ${ago}   _(${date})_ \n\n${message}${\n\n---\n\nfootnotes}",
"markdownDescription": "Specifies the tooltip format (in markdown) of \"file\" commits in the views. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window",
"order": 32
},
"gitlens.views.formats.files.label": {
"type": "string",
"default": "${working }${file}",
"markdownDescription": "Specifies the format of a file in the views. See [_File Tokens_](https://github.com/gitkraken/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window",
"order": 32
"order": 40
},
"gitlens.views.formats.files.description": {
"type": "string",
"default": "${directory}${ ← originalPath}",
"markdownDescription": "Specifies the description format of a file in the views. See [_File Tokens_](https://github.com/gitkraken/vscode-gitlens/wiki/Custom-Formatting#file-tokens) in the GitLens docs",
"scope": "window",
"order": 33
"order": 41
},
"gitlens.views.formats.stashes.label": {
"type": "string",
"default": "${message}",
"markdownDescription": "Specifies the format of stashes in the views. See [_Commit Tokens_](https://github.com/gitkraken/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window",
"order": 34
"order": 50
},
"gitlens.views.formats.stashes.description": {
"type": "string",
"default": "${stashOnRef, }${agoOrDate}",
"markdownDescription": "Specifies the description format of stashes in the views. See [_Commit Tokens_](https://github.com/gitkraken/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs",
"scope": "window",
"order": 35
"order": 51
},
"gitlens.views.experimental.multiSelect.enabled": {
"type": "boolean",
"default": false,
"markdownDescription": "Specifies whether to enable experimental multi-select support in the views.\n**NOTE**: Requires a restart to take effect.",
"scope": "window",
"order": 35
"order": 60
},
"gitlens.views.commitFileFormat": {
"deprecationMessage": "Deprecated. Use `gitlens.views.formats.files.label` instead",

+ 2
- 0
src/config.ts Ver arquivo

@ -580,6 +580,8 @@ export interface ViewsCommonConfig {
commits: {
label: string;
description: string;
tooltip: string;
tooltipWithStatus: string;
};
files: {
label: string;

+ 11
- 15
src/views/nodes/commitNode.ts Ver arquivo

@ -269,21 +269,17 @@ export class CommitNode extends ViewRefNode
}
}
const tooltip = await CommitFormatter.fromTemplateAsync(
`\${link}\${' via 'pullRequest}\${'  \u2022  'changesDetail}\${'    'tips}\n\n\${avatar}  __\${author}__, \${ago}   _(\${date})_ \n\n\${message}\${\n\n---\n\nfootnotes}`,
this.commit,
{
autolinkedIssuesOrPullRequests: autolinkedIssuesOrPullRequests,
dateFormat: configuration.get('defaultDateFormat'),
getBranchAndTagTips: this.getBranchAndTagTips,
messageAutolinks: true,
messageIndent: 4,
pullRequestOrRemote: pr,
outputFormat: 'markdown',
remotes: remotes,
unpublished: this.unpublished,
},
);
const tooltip = await CommitFormatter.fromTemplateAsync(this.view.config.formats.commits.tooltip, this.commit, {
autolinkedIssuesOrPullRequests: autolinkedIssuesOrPullRequests,
dateFormat: configuration.get('defaultDateFormat'),
getBranchAndTagTips: this.getBranchAndTagTips,
messageAutolinks: true,
messageIndent: 4,
pullRequestOrRemote: pr,
outputFormat: 'markdown',
remotes: remotes,
unpublished: this.unpublished,
});
const markdown = new MarkdownString(tooltip, true);
markdown.supportHtml = true;

+ 5
- 2
src/views/nodes/fileRevisionAsCommitNode.ts Ver arquivo

@ -229,9 +229,12 @@ export class FileRevisionAsCommitNode extends ViewRefFileNode
}
}
const status = StatusFileFormatter.fromTemplate(`\${status}\${ (originalPath)}`, this.file);
const status = StatusFileFormatter.fromTemplate(
`\${status}\${ (originalPath)}\${'  •  'changesDetail}`,
this.file,
);
const tooltip = await CommitFormatter.fromTemplateAsync(
`\${link}\${' via 'pullRequest} \u2022 ${status}\${ \u2022 changesDetail}\${'   'tips}\n\n\${avatar}  __\${author}__, \${ago}   _(\${date})_ \n\n\${message}\${\n\n---\n\nfootnotes}`,
this.view.config.formats.commits.tooltipWithStatus.replace('{{slot-status}}', status),
this.commit,
{
autolinkedIssuesOrPullRequests: autolinkedIssuesOrPullRequests,

+ 1
- 1
src/views/nodes/rebaseStatusNode.ts Ver arquivo

@ -225,7 +225,7 @@ export class RebaseCommitNode extends ViewRefNode
}
const tooltip = await CommitFormatter.fromTemplateAsync(
`Rebase paused at \${link}\${' via 'pullRequest}\${'  \u2022  'changesDetail}\${'    'tips}\n\n\${avatar}  __\${author}__, \${ago}   _(\${date})_ \n\n\${message}\${\n\n---\n\nfootnotes}`,
`Rebase paused at ${this.view.config.formats.commits.tooltip}`,
this.commit,
{
autolinkedIssuesOrPullRequests: autolinkedIssuesOrPullRequests,

Carregando…
Cancelar
Salvar