Skip to content

Commit

Permalink
move chat to /edit fixes (#235248)
Browse files Browse the repository at this point in the history
* disable items that cannot be check/unchecked

fixes microsoft/vscode-copilot#10935

* fix microsoft/vscode-copilot#10937
  • Loading branch information
jrieken authored Dec 4, 2024
1 parent 092158e commit d8f18c7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,9 @@ export function registerChatTitleActions() {
return await new Promise<IChatRequestModel[]>(_resolve => {

const resolve = (value: IChatRequestModel[]) => {
qp.hide();
store.dispose();
_resolve(value);
qp.hide();
};

const store = new DisposableStore();
Expand All @@ -577,9 +577,26 @@ export function registerChatTitleActions() {
ignore = true;
try {
const [first] = e;
const idx = first ? customPicks.indexOf(first) : -1;
const selected = idx >= 0 ? customPicks.slice(idx) : [];

const selected: typeof customPicks = [];
let disabled = false;

for (let i = 0; i < customPicks.length; i++) {
const oldItem = customPicks[i];
customPicks[i] = {
...oldItem,
disabled,
};

disabled = disabled || oldItem === first;

if (disabled) {
selected.push(customPicks[i]);
}
}
qp.items = customPicks;
qp.selectedItems = selected;

} finally {
ignore = false;
}
Expand Down

0 comments on commit d8f18c7

Please sign in to comment.