Quellcode durchsuchen

Renames *RegEx to *Regex for consistency

main
Eric Amodio vor 6 Jahren
Ursprung
Commit
ce8abd6410
7 geänderte Dateien mit 20 neuen und 20 gelöschten Zeilen
  1. +2
    -2
      src/annotations/annotations.ts
  2. +4
    -4
      src/git/remotes/bitbucket-server.ts
  3. +4
    -4
      src/git/remotes/bitbucket.ts
  4. +4
    -4
      src/git/remotes/github.ts
  5. +2
    -2
      src/git/remotes/gitlab.ts
  6. +2
    -2
      src/system/string.ts
  7. +2
    -2
      src/ui/shared/colors.ts

+ 2
- 2
src/annotations/annotations.ts Datei anzeigen

@ -49,7 +49,7 @@ interface IRenderOptions extends DecorationInstanceRenderOptions, ThemableDecora
const defaultHeatmapHotColor = '#f66a0a';
const defaultHeatmapColdColor = '#0a60f6';
const escapeMarkdownRegEx = /[`\>\#\*\_\-\+\.]/g;
const escapeMarkdownRegex = /[`\>\#\*\_\-\+\.]/g;
// const sampleMarkdown = '## message `not code` *not important* _no underline_ \n> don\'t quote me \n- don\'t list me \n+ don\'t list me \n1. don\'t list me \nnot h1 \n=== \nnot h2 \n---\n***\n---\n___';
const markdownHeaderReplacement = `${GlyphChars.ZeroWidthSpace}===`;
@ -153,7 +153,7 @@ export class Annotations {
message
// Escape markdown
.replace(escapeMarkdownRegEx, '\\$&')
.replace(escapeMarkdownRegex, '\\$&')
// Escape markdown header (since the above regex won't match it)
.replace(/^===/gm, markdownHeaderReplacement)
// Keep under the same block-quote

+ 4
- 4
src/git/remotes/bitbucket-server.ts Datei anzeigen

@ -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) {
@ -27,9 +27,9 @@ export class BitbucketServerRemote extends RemoteProvider {
return (
message
// Matches issue #123
.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
// Matches pull request #123
.replace(prEnricherRegEx, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
.replace(prEnricherRegex, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
);
}

+ 4
- 4
src/git/remotes/bitbucket.ts Datei anzeigen

@ -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) {
@ -22,9 +22,9 @@ export class BitbucketRemote extends RemoteProvider {
return (
message
// Matches issue #123
.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
// Matches pull request #123
.replace(prEnricherRegEx, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
.replace(prEnricherRegex, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
);
}

+ 4
- 4
src/git/remotes/github.ts Datei anzeigen

@ -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) {
@ -22,10 +22,10 @@ export class GitHubRemote extends RemoteProvider {
return (
message
// Matches #123 or gh-123 or GH-123
.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
// Matches eamodio/vscode-gitlens#123
.replace(
issueEnricher3rdParyRegEx,
issueEnricher3rdParyRegex,
`[$1](${this.protocol}://${this.domain}/$2/issues/$3 "Open Issue #$3 from $2")`
)
);

+ 2
- 2
src/git/remotes/gitlab.ts Datei anzeigen

@ -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) {
@ -19,7 +19,7 @@ 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.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`);
}
protected getUrlForBranches(): string {

+ 2
- 2
src/system/string.ts Datei anzeigen

@ -154,11 +154,11 @@ export namespace Strings {
}
// Removes \ / : * ? " < > | and C0 and C1 control codes
const illegalCharsForFSRegEx = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g;
const illegalCharsForFSRegex = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g;
export function sanitizeForFileSystem(s: string, replacement: string = '_') {
if (!s) return s;
return s.replace(illegalCharsForFSRegEx, replacement);
return s.replace(illegalCharsForFSRegex, replacement);
}
export function sha1(s: string, encoding: HexBase64Latin1Encoding = 'base64'): string {

+ 2
- 2
src/ui/shared/colors.ts Datei anzeigen

@ -1,4 +1,4 @@
const cssColorRegEx = /^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d\.]+%?)?\))$/i;
const cssColorRegex = /^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d\.]+%?)?\))$/i;
function adjustLight(color: number, amount: number) {
const cc = color + amount;
@ -31,7 +31,7 @@ export function opacity(color: string, percentage: number) {
export function toRgba(color: string) {
color = color.trim();
const result = cssColorRegEx.exec(color);
const result = cssColorRegex.exec(color);
if (result == null) return null;
if (result[1] === '#') {

Laden…
Abbrechen
Speichern