Skip to content

Commit 2b6e288

Browse files
committed
Show both the binary change and the arguments change in the same dialog box
1 parent eeae075 commit 2b6e288

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

lldb/tools/lldb-dap/src-ts/lldb-dap-server.ts

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -123,52 +123,41 @@ export class LLDBDapServer implements vscode.Disposable {
123123
return true;
124124
}
125125

126-
// Check if the server has changed. If so, generate message and detail for user prompt.
127-
const messageAndDetail = (() => {
128-
if (this.serverFileChanged) {
129-
return {
130-
message:
131-
"The lldb-dap binary has changed. Would you like to restart the server?",
132-
detail: `An existing lldb-dap server (${this.serverProcess.pid}) is running with an old binary.
126+
const changeTLDR = [];
127+
const changeDetails = [];
133128

134-
Restarting the server will interrupt any existing debug sessions and start a new server.`,
135-
};
136-
}
137-
138-
const newSpawnInfo = this.getSpawnInfo(dapPath, args, env);
139-
if (!isDeepStrictEqual(this.serverSpawnInfo, newSpawnInfo)) {
140-
return {
141-
message:
142-
"The arguments to lldb-dap have changed. Would you like to restart the server?",
143-
detail: `An existing lldb-dap server (${this.serverProcess.pid}) is running with different arguments.
129+
if (this.serverFileChanged) {
130+
changeTLDR.push("an old binary");
131+
}
144132

133+
const newSpawnInfo = this.getSpawnInfo(dapPath, args, env);
134+
if (!isDeepStrictEqual(this.serverSpawnInfo, newSpawnInfo)) {
135+
changeTLDR.push("different arguments");
136+
changeDetails.push(`
145137
The previous lldb-dap server was started with:
146138
147139
${this.serverSpawnInfo.join(" ")}
148140
149141
The new lldb-dap server will be started with:
150142
151143
${newSpawnInfo.join(" ")}
152-
153-
Restarting the server will interrupt any existing debug sessions and start a new server.`,
154-
};
155-
}
156-
157-
return null;
158-
})();
144+
`
145+
);
146+
}
159147

160148
// If the server hasn't changed, continue startup without killing it.
161-
if (messageAndDetail === null) {
149+
if (changeTLDR.length === 0) {
162150
return true;
163151
}
164152

165153
// The server has changed. Prompt the user to restart it.
166-
const { message, detail } = messageAndDetail;
167154
const userInput = await vscode.window.showInformationMessage(
168-
message,
155+
"The lldb-dap server has changed. Would you like to restart the server?",
169156
{
170157
modal: true,
171-
detail,
158+
detail: `An existing lldb-dap server (${this.serverProcess.pid}) is running with ${changeTLDR.map(s => `*${s}*`).join(" and ")}.
159+
${changeDetails.join("\n")}
160+
Restarting the server will interrupt any existing debug sessions and start a new server.`,
172161
},
173162
"Restart",
174163
"Use Existing",

0 commit comments

Comments
 (0)