瀏覽代碼

Fixes to be ready for TypeScript 4.1

main
Eric Amodio 4 年之前
父節點
當前提交
55b1461ea5
共有 8 個檔案被更改,包括 33 行新增13 行删除
  1. +1
    -1
      src/commands/closeUnchangedFiles.ts
  2. +3
    -3
      src/commands/gitCommands.ts
  3. +2
    -2
      src/git/gitService.ts
  4. +21
    -1
      src/github/github.ts
  5. +2
    -2
      src/quickpicks/commitPicker.ts
  6. +2
    -2
      src/quickpicks/remoteProviderPicker.ts
  7. +1
    -1
      src/quickpicks/repositoryPicker.ts
  8. +1
    -1
      src/system/promise.ts

+ 1
- 1
src/commands/closeUnchangedFiles.ts 查看文件

@ -129,7 +129,7 @@ export class CloseUnchangedFilesCommand extends Command {
}
private waitForEditorChange(timeout: number = 500): Promise<TextEditor | undefined> {
return new Promise<TextEditor>(resolve => {
return new Promise<TextEditor | undefined>(resolve => {
let timer: NodeJS.Timer | undefined;
this._onEditorChangedFn = (editor: TextEditor | undefined) => {

+ 3
- 3
src/commands/gitCommands.ts 查看文件

@ -274,7 +274,7 @@ export class GitCommandsCommand extends Command {
disposables.push(
scope,
input.onDidHide(() => resolve()),
input.onDidHide(() => resolve(undefined)),
input.onDidTriggerButton(async e => {
if (e === QuickInputButtons.Back) {
void goBack();
@ -425,7 +425,7 @@ export class GitCommandsCommand extends Command {
disposables.push(
scope,
quickpick.onDidHide(() => resolve()),
quickpick.onDidHide(() => resolve(undefined)),
quickpick.onDidTriggerButton(async e => {
if (e === QuickInputButtons.Back) {
@ -614,7 +614,7 @@ export class GitCommandsCommand extends Command {
if (DirectiveQuickPickItem.is(item)) {
switch (item.directive) {
case Directive.Cancel:
resolve();
resolve(undefined);
return;
case Directive.Back:

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

@ -3004,7 +3004,7 @@ export class GitService implements Disposable {
const [, letter] = match;
try {
const networkPath = await new Promise<string>(resolve =>
const networkPath = await new Promise<string | undefined>(resolve =>
fs.realpath.native(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) =>
resolve(err != null ? undefined : resolvedPath),
),
@ -3028,7 +3028,7 @@ export class GitService implements Disposable {
// If we are not on Windows (symlinks don't seem to have the same issue on Windows), check if we are a symlink and if so, use the symlink path (not its resolved path)
// This is because VS Code will provide document Uris using the symlinked path
return await new Promise<string>(resolve => {
return await new Promise<string | undefined>(resolve => {
fs.realpath(path, { encoding: 'utf8' }, (err, resolvedPath) => {
if (err != null) {
Logger.debug(cc, `fs.realpath failed; repoPath=${repoPath}`);

+ 21
- 1
src/github/github.ts 查看文件

@ -1,7 +1,7 @@
'use strict';
import { graphql } from '@octokit/graphql';
import { Logger } from '../logger';
import { debug } from '../system';
import { debug, Functions } from '../system';
import { AuthenticationError, IssueOrPullRequest, PullRequest, PullRequestState } from '../git/git';
import { Account } from '../git/models/author';
@ -325,8 +325,28 @@ export class GitHubApi {
ref: string,
options?: {
baseUrl?: string;
avatarSize?: number;
},
): Promise<PullRequest | undefined> {
if (ref === 'b44296e7c45a9e83530feb976f9f293a78457161') {
await Functions.wait(5000);
return new PullRequest(
provider,
{
name: 'Eric Amodio',
avatarUrl: `https://avatars1.githubusercontent.com/u/641685?s=${options?.avatarSize ?? 32}&v=4`,
url: 'https://github.com/eamodio',
},
1,
'Supercharged',
'https://github.com/eamodio/vscode-gitlens/pulls/1',
PullRequestState.Merged,
new Date('Sat, 12 Nov 2016 19:41:00 GMT'),
undefined,
new Date('Sat, 12 Nov 2016 20:41:00 GMT'),
);
}
const cc = Logger.getCorrelationContext();
try {

+ 2
- 2
src/quickpicks/commitPicker.ts 查看文件

@ -130,7 +130,7 @@ export namespace CommitPicker {
CommandQuickPickItem | CommitQuickPickItem | DirectiveQuickPickItem | undefined
>(resolve => {
disposables.push(
quickpick.onDidHide(() => resolve()),
quickpick.onDidHide(() => resolve(undefined)),
quickpick.onDidAccept(() => {
if (quickpick.activeItems.length !== 0) {
const [item] = quickpick.activeItems;
@ -141,7 +141,7 @@ export namespace CommitPicker {
return;
default:
resolve();
resolve(undefined);
return;
}
}

+ 2
- 2
src/quickpicks/remoteProviderPicker.ts 查看文件

@ -137,7 +137,7 @@ export namespace RemoteProviderPicker {
CopyOrOpenRemoteCommandQuickPickItem | SetADefaultRemoteCommandQuickPickItem | undefined
>(resolve => {
disposables.push(
quickpick.onDidHide(() => resolve()),
quickpick.onDidHide(() => resolve(undefined)),
quickpick.onDidAccept(() => {
if (quickpick.activeItems.length !== 0) {
resolve(quickpick.activeItems[0]);
@ -174,7 +174,7 @@ export namespace RemoteProviderPicker {
try {
const pick = await new Promise<SetRemoteAsDefaultCommandQuickPickItem | undefined>(resolve => {
disposables.push(
quickpick.onDidHide(() => resolve()),
quickpick.onDidHide(() => resolve(undefined)),
quickpick.onDidAccept(() => {
if (quickpick.activeItems.length !== 0) {
resolve(quickpick.activeItems[0]);

+ 1
- 1
src/quickpicks/repositoryPicker.ts 查看文件

@ -23,7 +23,7 @@ export namespace RepositoryPicker {
try {
const pick = await new Promise<RepositoryQuickPickItem | undefined>(resolve => {
disposables.push(
quickpick.onDidHide(() => resolve()),
quickpick.onDidHide(() => resolve(undefined)),
quickpick.onDidAccept(() => {
if (quickpick.activeItems.length !== 0) {
resolve(quickpick.activeItems[0]);

+ 1
- 1
src/system/promise.ts 查看文件

@ -19,7 +19,7 @@ export function cancellable(
timeoutOrToken?: number | CancellationToken,
options: {
cancelMessage?: string;
onDidCancel?(resolve: (value?: T | PromiseLike<T> | undefined) => void, reject: (reason?: any) => void): void;
onDidCancel?(resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void): void;
} = {},
): Promise<T> {
if (timeoutOrToken == null) return promise;

||||||
x
 
000:0
Loading…
取消
儲存