Skip to content

Commit

Permalink
src/debugAdapter: address TS2794 warnings
Browse files Browse the repository at this point in the history
TS2794 Expected 1 arguments, but got 0

The code is so convoluted that I am not 100% sure about the logic.
But first, let's address the tslint error.

Change-Id: Iab2e45664698d05c6103d535e7b3c6e170623a2f
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/280696
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
  • Loading branch information
hyangah committed Dec 30, 2020
1 parent 229c425 commit e7a2363
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export class Delve {
public program: string;
public remotePath: string;
public loadConfig: LoadConfig;
public connection: Promise<RPCConnection>;
public connection: Promise<RPCConnection|null>; // null if connection isn't necessary (e.g. noDebug mode)
public onstdout: (str: string) => void;
public onstderr: (str: string) => void;
public onclose: (code: number) => void;
Expand Down Expand Up @@ -587,7 +587,7 @@ export class Delve {
reject(err);
});

resolve();
resolve(null);
return;
}
}
Expand Down Expand Up @@ -950,7 +950,7 @@ export class GoDebugSession extends LoggingDebugSession {
// we should have a timeout in case disconnectRequestHelper hangs.
await Promise.race([
this.disconnectRequestHelper(response, args),
new Promise((resolve) => setTimeout(() => {
new Promise<void>((resolve) => setTimeout(() => {
log('DisconnectRequestHelper timed out after 5s.');
resolve();
}, 5_000))
Expand Down Expand Up @@ -2046,7 +2046,7 @@ export class GoDebugSession extends LoggingDebugSession {

if (this.remoteSourcesAndPackages.initializingRemoteSourceFiles) {
try {
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
this.remoteSourcesAndPackages.on(RemoteSourcesAndPackages.INITIALIZED, () => {
resolve();
});
Expand Down Expand Up @@ -2175,7 +2175,7 @@ export class GoDebugSession extends LoggingDebugSession {
);
}

private async getPackageInfo(debugState: DebuggerState): Promise<string> {
private async getPackageInfo(debugState: DebuggerState): Promise<string|void> {
if (!debugState.currentThread || !debugState.currentThread.file) {
return Promise.resolve(null);
}
Expand Down
6 changes: 3 additions & 3 deletions test/integration/goDebug.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ suite('Go Debug Adapter', function () {
// When the attach request is completed successfully, we should get
// an initialized event.
await Promise.all([
new Promise(async (resolve) => {
new Promise<void>(async (resolve) => {
console.log(`Setting up attach request for ${JSON.stringify(debugConfig)}.`);
const attachResult = await dc.attachRequest(debugConfig as DebugProtocol.AttachRequestArguments);
assert.ok(attachResult.success);
Expand Down Expand Up @@ -1170,7 +1170,7 @@ suite('Go Debug Adapter', function () {

// Calls the helloworld server to get a response.
let response = '';
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
http.get(`http://localhost:${server}`, (res) => {
res.on('data', (data) => response += data);
res.on('end', () => resolve());
Expand All @@ -1180,7 +1180,7 @@ suite('Go Debug Adapter', function () {
await dc.disconnectRequest();
// Checks that after the disconnect, the helloworld server still works.
let secondResponse = '';
await new Promise((resolve) => {
await new Promise<void>((resolve) => {
http.get(`http://localhost:${server}`, (res) => {
res.on('data', (data) => secondResponse += data);
res.on('end', () => resolve());
Expand Down

0 comments on commit e7a2363

Please sign in to comment.