浏览代码

Fixes issue linking in hovers

main
Eric Amodio 5 年前
父节点
当前提交
52db3029a9
共有 7 个文件被更改,包括 28 次插入14 次删除
  1. +6
    -0
      CHANGELOG.md
  2. +3
    -1
      src/git/formatters/commitFormatter.ts
  3. +6
    -3
      src/git/remotes/azure-devops.ts
  4. +2
    -2
      src/git/remotes/bitbucket-server.ts
  5. +2
    -2
      src/git/remotes/bitbucket.ts
  6. +3
    -3
      src/git/remotes/github.ts
  7. +6
    -3
      src/git/remotes/gitlab.ts

+ 6
- 0
CHANGELOG.md 查看文件

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- Fixes issues with issue linking in hovers
## [10.0.1] - 2019-09-24
### Added

+ 3
- 1
src/git/formatters/commitFormatter.ts 查看文件

@ -307,6 +307,8 @@ export class CommitFormatter extends Formatter {
return message;
}
message = Strings.escapeMarkdown(message, { quoted: true });
if (this._options.remotes !== undefined) {
for (const r of this._options.remotes) {
if (r.provider === undefined) continue;
@ -316,7 +318,7 @@ export class CommitFormatter extends Formatter {
}
}
return `\n> ${Strings.escapeMarkdown(message, { quoted: true })}`;
return `\n> ${message}`;
}
get sha() {

+ 6
- 3
src/git/remotes/azure-devops.ts 查看文件

@ -2,7 +2,7 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';
const issueEnricherRegex = /(^|\s)(#([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)\\?(#([0-9]+))\b/gi;
const gitRegex = /\/_git\/?/i;
const legacyDefaultCollectionRegex = /^DefaultCollection\//i;
@ -53,8 +53,11 @@ export class AzureDevOpsRemote extends RemoteProvider {
enrichMessage(message: string): string {
// Strip off any `_git` part from the repo url
const baseUrl = this.baseUrl.replace(gitRegex, '/');
// Matches #123
return message.replace(issueEnricherRegex, `$1[$2](${baseUrl}/_workitems/edit/$3 "Open Work Item $2")`);
return (
message
// Matches #123
.replace(issueEnricherRegex, `$1[$2](${baseUrl}/_workitems/edit/$3 "Open Work Item $2")`)
);
}
protected getUrlForBranches(): string {

+ 2
- 2
src/git/remotes/bitbucket-server.ts 查看文件

@ -2,8 +2,8 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';
const issueEnricherRegex = /(^|\s)(issue #([0-9]+))\b/gi;
const prEnricherRegex = /(^|\s)(pull request #([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)(issue \\?#([0-9]+))\b/gi;
const prEnricherRegex = /(^|\s)(pull request \\?#([0-9]+))\b/gi;
export class BitbucketServerRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {

+ 2
- 2
src/git/remotes/bitbucket.ts 查看文件

@ -2,8 +2,8 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';
const issueEnricherRegex = /(^|\s)(issue #([0-9]+))\b/gi;
const prEnricherRegex = /(^|\s)(pull request #([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)(issue \\?#([0-9]+))\b/gi;
const prEnricherRegex = /(^|\s)(pull request \\?#([0-9]+))\b/gi;
export class BitbucketRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {

+ 3
- 3
src/git/remotes/github.ts 查看文件

@ -2,8 +2,8 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';
const issueEnricherRegex = /(^|\s)((?:#|gh-)([0-9]+))\b/gi;
const issueEnricher3rdParyRegex = /\b((\w+-?\w+(?!-)\/\w+-?\w+(?!-))#([0-9]+))\b/g;
const issueEnricherRegex = /(^|\s)((?:\\?#|gh\\?-)([0-9]+))\b/gi;
const issueEnricher3rdParyRegex = /\b(\w+\\?-?\w+(?!\\?-)\/\w+\\?-?\w+(?!\\?-))\\?#([0-9]+)\b/g;
export class GitHubRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {
@ -26,7 +26,7 @@ export class GitHubRemote extends RemoteProvider {
// Matches eamodio/vscode-gitlens#123
.replace(
issueEnricher3rdParyRegex,
`[$1](${this.protocol}://${this.domain}/$2/issues/$3 "Open Issue #$3 from $2")`
`[$&](${this.protocol}://${this.domain}/$1/issues/$2 "Open Issue #$2 from $1")`
)
);
}

+ 6
- 3
src/git/remotes/gitlab.ts 查看文件

@ -2,7 +2,7 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';
const issueEnricherRegex = /(^|\s)(#([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)(\\?#([0-9]+))\b/gi;
export class GitLabRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {
@ -18,8 +18,11 @@ export class GitLabRemote extends RemoteProvider {
}
enrichMessage(message: string): string {
// Matches #123
return message.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`);
return (
message
// Matches #123
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
);
}
protected getUrlForBranches(): string {

正在加载...
取消
保存