Skip to content

Commit d0c510b

Browse files
authored
api - warn when using isCloseAffordance multiple times (fix #200504) (#200521)
1 parent 513adf5 commit d0c510b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/vs/workbench/api/common/extHostMessageService.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class ExtHostMessageService {
5050
}
5151

5252
const commands: { title: string; isCloseAffordance: boolean; handle: number }[] = [];
53+
let hasCloseAffordance = false;
5354

5455
for (let handle = 0; handle < items.length; handle++) {
5556
const command = items[handle];
@@ -58,8 +59,15 @@ export class ExtHostMessageService {
5859
} else if (typeof command === 'object') {
5960
const { title, isCloseAffordance } = command;
6061
commands.push({ title, isCloseAffordance: !!isCloseAffordance, handle });
62+
if (isCloseAffordance) {
63+
if (hasCloseAffordance) {
64+
this._logService.warn(`[${extension.identifier}] Only one message item can have 'isCloseAffordance':`, command);
65+
} else {
66+
hasCloseAffordance = true;
67+
}
68+
}
6169
} else {
62-
this._logService.warn('Invalid message item:', command);
70+
this._logService.warn(`[${extension.identifier}] Invalid message item:`, command);
6371
}
6472
}
6573

0 commit comments

Comments
 (0)