Skip to content

Commit 42bf69c

Browse files
committed
Replaces deprecated functions
1 parent 1bdedb3 commit 42bf69c

29 files changed

+73
-73
lines changed

scripts/generateLicenses.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ async function generateThirdpartyNotices(packages) {
5252

5353
const index = key.lastIndexOf('@');
5454
if (index !== -1) {
55-
name = key.substr(0, index);
56-
version = key.substr(index + 1);
55+
name = key.substring(0, index);
56+
version = key.substring(index + 1);
5757
} else {
5858
name = key;
5959
}

src/commands/git/coauthors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class CoAuthorsGitCommand extends QuickCommand<State> {
6464

6565
const index = message.indexOf('Co-authored-by: ');
6666
if (index !== -1) {
67-
message = message.substring(0, index - 1).trimRight();
67+
message = message.substring(0, index - 1).trimEnd();
6868
}
6969

7070
if (state.contributors != null && !Array.isArray(state.contributors)) {

src/env/browser/md5.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ function hexToBinary(hex: string) {
203203
const length = hex.length;
204204

205205
for (let x = 0; x < length - 1; x += 2) {
206-
bytes.push(parseInt(hex.substr(x, 2), 16));
206+
bytes.push(parseInt(hex.substring(x, x + 2), 16));
207207
}
208208

209209
return String.fromCharCode.apply(String, bytes);

src/env/node/git/git.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ export class Git {
16761676

16771677
try {
16781678
const data = await this.symbolic_ref(repoPath, 'refs/remotes/origin/HEAD');
1679-
if (data != null) return [data.trim().substr('origin/'.length), undefined];
1679+
if (data != null) return [data.trim().substring('origin/'.length), undefined];
16801680
} catch (ex) {
16811681
if (/is not a symbolic ref/.test(ex.stderr)) {
16821682
try {
@@ -1685,7 +1685,7 @@ export class Git {
16851685
const match = /ref:\s(\S+)\s+HEAD/m.exec(data);
16861686
if (match != null) {
16871687
const [, branch] = match;
1688-
return [branch.substr('refs/heads/'.length), undefined];
1688+
return [branch.substring('refs/heads/'.length), undefined];
16891689
}
16901690
}
16911691
} catch {}

src/env/node/git/localGitProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3010,7 +3010,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
30103010

30113011
[, key, value] = match;
30123012
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
3013-
user[key as 'name' | 'email'] = ` ${value}`.substr(1);
3013+
user[key as 'name' | 'email'] = ` ${value}`.substring(1);
30143014
} while (true);
30153015
} else {
30163016
user.name =
@@ -3151,7 +3151,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
31513151
if (match == null) return undefined;
31523152

31533153
const [, branch] = match;
3154-
return `${remote}/${branch.substr('refs/heads/'.length)}`;
3154+
return `${remote}/${branch.substring('refs/heads/'.length)}`;
31553155
} catch {}
31563156
}
31573157

@@ -4281,7 +4281,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
42814281
}
42824282

42834283
if (branch.startsWith('refs/heads/')) {
4284-
branch = branch.substr(11).trim();
4284+
branch = branch.substring(11).trim();
42854285
}
42864286

42874287
const [branchTipsResult, tagTipsResult] = await Promise.allSettled([

src/git/models/reference.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ export function shortenRevision(
119119
const [, rev, suffix] = match;
120120

121121
if (suffix != null) {
122-
return `${rev.substr(0, len)}${suffix}`;
122+
return `${rev.substring(0, len)}${suffix}`;
123123
}
124124
}
125125

126-
return ref.substr(0, len);
126+
return ref.substring(0, len);
127127
}
128128

129129
export interface GitBranchReference {
@@ -395,7 +395,7 @@ export function getReferenceLabel(
395395
if (options.expand && ref.message) {
396396
message = `${ref.number != null ? `#${ref.number}: ` : ''}${
397397
ref.message.length > 20
398-
? `${ref.message.substring(0, 20).trimRight()}${GlyphChars.Ellipsis}`
398+
? `${ref.message.substring(0, 20).trimEnd()}${GlyphChars.Ellipsis}`
399399
: ref.message
400400
}`;
401401
}
@@ -412,13 +412,13 @@ export function getReferenceLabel(
412412
if (options.expand && ref.message) {
413413
message =
414414
ref.message.length > 20
415-
? ` (${ref.message.substring(0, 20).trimRight()}${GlyphChars.Ellipsis})`
415+
? ` (${ref.message.substring(0, 20).trimEnd()}${GlyphChars.Ellipsis})`
416416
: ` (${ref.message})`;
417417
}
418418

419419
let prefix;
420420
if (options.expand && options.label && isShaParent(ref.ref)) {
421-
refName = ref.name.endsWith('^') ? ref.name.substr(0, ref.name.length - 1) : ref.name;
421+
refName = ref.name.endsWith('^') ? ref.name.substring(0, ref.name.length - 1) : ref.name;
422422
if (options?.quoted) {
423423
refName = `'${refName}'`;
424424
}

src/git/models/reflog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ export class GitReflogRecord {
4747
if (this._selector == null || this._selector.length === 0) return '';
4848

4949
if (this._selector.startsWith('refs/heads')) {
50-
return this._selector.substr(11);
50+
return this._selector.substring(11);
5151
}
5252

5353
if (this._selector.startsWith('refs/remotes')) {
54-
return this._selector.substr(13);
54+
return this._selector.substring(13);
5555
}
5656

5757
return this._selector;

src/git/parsers/branchParser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export function parseGitBranches(container: Container, data: string, repoPath: s
4444

4545
if (name.startsWith('refs/remotes/')) {
4646
// Strip off refs/remotes/
47-
name = name.substr(13);
47+
name = name.substring(13);
4848
if (name.endsWith('/HEAD')) continue;
4949

5050
remote = true;
5151
} else {
5252
// Strip off refs/heads/
53-
name = name.substr(11);
53+
name = name.substring(11);
5454
remote = false;
5555
}
5656

@@ -63,11 +63,11 @@ export function parseGitBranches(container: Container, data: string, repoPath: s
6363
current.charCodeAt(0) === 42, // '*',
6464
date ? new Date(date) : undefined,
6565
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
66-
ref == null || ref.length === 0 ? undefined : ` ${ref}`.substr(1),
66+
ref == null || ref.length === 0 ? undefined : ` ${ref}`.substring(1),
6767
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
6868
upstream == null || upstream.length === 0
6969
? undefined
70-
: { name: ` ${upstream}`.substr(1), missing: Boolean(missing) },
70+
: { name: ` ${upstream}`.substring(1), missing: Boolean(missing) },
7171
Number(ahead) || 0,
7272
Number(behind) || 0,
7373
),

src/git/parsers/logParser.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -839,17 +839,17 @@ export function parseGitLogSimple(
839839
[, ref, diffFile, diffRenamed, status, file, renamed] = match;
840840

841841
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
842-
file = ` ${diffRenamed || diffFile || renamed || file}`.substr(1);
842+
file = ` ${diffRenamed || diffFile || renamed || file}`.substring(1);
843843
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
844-
status = status == null || status.length === 0 ? undefined : ` ${status}`.substr(1);
844+
status = status == null || status.length === 0 ? undefined : ` ${status}`.substring(1);
845845
} while (skip >= 0);
846846

847847
// Ensure the regex state is reset
848848
logFileSimpleRegex.lastIndex = 0;
849849

850850
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
851851
return [
852-
ref == null || ref.length === 0 ? undefined : ` ${ref}`.substr(1),
852+
ref == null || ref.length === 0 ? undefined : ` ${ref}`.substring(1),
853853
file,
854854
status as GitFileIndexStatus | undefined,
855855
];
@@ -885,9 +885,9 @@ export function parseGitLogSimpleRenamed(
885885
}
886886

887887
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
888-
file = ` ${renamed || file}`.substr(1);
888+
file = ` ${renamed || file}`.substring(1);
889889
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
890-
status = status == null || status.length === 0 ? undefined : ` ${status}`.substr(1);
890+
status = status == null || status.length === 0 ? undefined : ` ${status}`.substring(1);
891891

892892
break;
893893
} while (true);
@@ -897,7 +897,7 @@ export function parseGitLogSimpleRenamed(
897897

898898
return [
899899
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
900-
ref == null || ref.length === 0 || file == null ? undefined : ` ${ref}`.substr(1),
900+
ref == null || ref.length === 0 || file == null ? undefined : ` ${ref}`.substring(1),
901901
file,
902902
status as GitFileIndexStatus | undefined,
903903
];

src/git/parsers/reflogParser.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ export function parseGitRefLog(
9696
record = new GitReflogRecord(
9797
repoPath,
9898
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
99-
` ${sha}`.substr(1),
99+
` ${sha}`.substring(1),
100100
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
101-
` ${selector}`.substr(1),
101+
` ${selector}`.substring(1),
102102
new Date(date),
103103
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
104-
` ${command}`.substr(1),
104+
` ${command}`.substring(1),
105105
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
106-
commandArgs == null || commandArgs.length === 0 ? undefined : commandArgs.substr(1),
106+
commandArgs == null || commandArgs.length === 0 ? undefined : commandArgs.substring(1),
107107
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
108-
details == null || details.length === 0 ? undefined : details.substr(1),
108+
details == null || details.length === 0 ? undefined : details.substring(1),
109109
);
110110
recordDate = date;
111111
}

0 commit comments

Comments
 (0)