Skip to content

Commit 49b2904

Browse files
committed
Formatted according to eslint rules
1 parent 27d736c commit 49b2904

File tree

1 file changed

+50
-32
lines changed

1 file changed

+50
-32
lines changed

src/debugAdapter/goDebug.ts

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,12 +1575,12 @@ export class GoDebugSession extends LoggingDebugSession {
15751575
log('EvaluateRequest');
15761576
const re = new RegExp(/\w+(?=\(.*\))/, 'g');
15771577
if (re.test(args.expression)) {
1578-
this.evaluateCallImpl(args).then(out => {
1578+
this.evaluateCallImpl(args).then((out) => {
15791579
const state = this.delve.isApiV1 ? <DebuggerState>out : (<CommandOut>out).State;
15801580
response.body = this.convertDebugVariableToProtocolVariable(state.currentThread.ReturnValues[0]);
15811581
this.sendResponse(response);
15821582
log('EvaluateCallResponse');
1583-
}, err => {
1583+
}, (err) => {
15841584
this.sendErrorResponse(response, 2009, 'Unable to complete call: "{e}"', { e: err.toString() });
15851585
});
15861586
} else {
@@ -1602,36 +1602,6 @@ export class GoDebugSession extends LoggingDebugSession {
16021602
}
16031603
}
16041604

1605-
private evaluateCallImpl(args: DebugProtocol.EvaluateArguments): Thenable<DebuggerState | CommandOut> {
1606-
// default to the topmost stack frame of the current goroutine
1607-
let goroutineId = -1;
1608-
let frameId = 0;
1609-
// args.frameId won't be specified when evaluating global vars
1610-
if (args.frameId) {
1611-
[goroutineId, frameId] = this.stackFrameHandles.get(args.frameId);
1612-
}
1613-
const scope = {
1614-
goroutineID: goroutineId,
1615-
frame: frameId
1616-
};
1617-
const evalSymbolArgs = this.delve.isApiV1 ? {
1618-
symbol: args.expression,
1619-
scope
1620-
} : {
1621-
Expr: args.expression,
1622-
Scope: scope,
1623-
Cfg: this.delve.loadConfig,
1624-
Unsafe: true
1625-
};
1626-
const returnValue = this.delve.callPromise<DebuggerState | CommandOut>('Command',
1627-
[{ name: 'call', returnInfoLoadConfig: this.delve.loadConfig, expr: evalSymbolArgs.Expr, unsafe: false, goroutineID: scope.goroutineID }]).then(val => val,
1628-
err => {
1629-
logError('Failed to call function: ', JSON.stringify(evalSymbolArgs.Expr, null, ' '), '\n\rCall error:', err.toString());
1630-
return Promise.reject(err);
1631-
});
1632-
return returnValue;
1633-
}
1634-
16351605
protected setVariableRequest(
16361606
response: DebugProtocol.SetVariableResponse,
16371607
args: DebugProtocol.SetVariableArguments
@@ -2099,6 +2069,54 @@ export class GoDebugSession extends LoggingDebugSession {
20992069
return this.delve.callPromise('Command', [{ name: 'continue' }]).then(callback, errorCallback);
21002070
}
21012071

2072+
private evaluateCallImpl(args: DebugProtocol.EvaluateArguments): Thenable<DebuggerState | CommandOut> {
2073+
// default to the topmost stack frame of the current goroutine
2074+
let goroutineId = -1;
2075+
let frameId = 0;
2076+
// args.frameId won't be specified when evaluating global vars
2077+
if (args.frameId) {
2078+
[goroutineId, frameId] = this.stackFrameHandles.get(args.frameId);
2079+
}
2080+
const scope = {
2081+
goroutineID: goroutineId,
2082+
frame: frameId
2083+
};
2084+
const evalSymbolArgs = this.delve.isApiV1
2085+
? {
2086+
symbol: args.expression,
2087+
scope
2088+
}
2089+
: {
2090+
Expr: args.expression,
2091+
Scope: scope,
2092+
Cfg: this.delve.loadConfig,
2093+
Unsafe: true
2094+
};
2095+
const returnValue = this.delve
2096+
.callPromise<DebuggerState | CommandOut>('Command', [
2097+
{
2098+
name: 'call',
2099+
returnInfoLoadConfig: this.delve.loadConfig,
2100+
expr: evalSymbolArgs.Expr,
2101+
unsafe: false,
2102+
goroutineID: scope.goroutineID
2103+
}
2104+
])
2105+
.then(
2106+
(val) => val,
2107+
(err) => {
2108+
logError(
2109+
'Failed to call function: ',
2110+
JSON.stringify(evalSymbolArgs.Expr, null, ' '),
2111+
'\n\rCall error:',
2112+
err.toString()
2113+
);
2114+
return Promise.reject(err);
2115+
}
2116+
);
2117+
return returnValue;
2118+
}
2119+
21022120
private evaluateRequestImpl(args: DebugProtocol.EvaluateArguments): Thenable<EvalOut | DebugVariable> {
21032121
// default to the topmost stack frame of the current goroutine
21042122
let goroutineId = -1;

0 commit comments

Comments
 (0)