mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 15:35:20 +01:00
Fix debug widget dropdown is changed unnecessarily when continuing/stepping
fixes #16761
This commit is contained in:
@@ -705,7 +705,7 @@ export class SelectActionItem extends BaseActionItem {
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
public setOptions(options: string[], selected: number): void {
|
||||
public setOptions(options: string[], selected?: number): void {
|
||||
this.selectBox.setOptions(options, selected);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
|
||||
export class SelectBox extends Widget {
|
||||
|
||||
@@ -40,13 +41,15 @@ export class SelectBox extends Widget {
|
||||
return this._onDidSelect.event;
|
||||
}
|
||||
|
||||
public setOptions(options: string[], selected: number): void {
|
||||
this.options = options;
|
||||
public setOptions(options: string[], selected?: number): void {
|
||||
if (!arrays.equals(this.options, options)) {
|
||||
this.options = options;
|
||||
|
||||
this.selectElement.options.length = 0;
|
||||
this.options.forEach((option) => {
|
||||
this.selectElement.add(this.createOption(option));
|
||||
});
|
||||
this.selectElement.options.length = 0;
|
||||
this.options.forEach((option) => {
|
||||
this.selectElement.add(this.createOption(option));
|
||||
});
|
||||
}
|
||||
this.select(selected);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,14 @@ export class FocusProcessActionItem extends SelectActionItem {
|
||||
|
||||
this.debugService.getViewModel().onDidFocusStackFrame(() => {
|
||||
const process = this.debugService.getViewModel().focusedProcess;
|
||||
const names = this.debugService.getModel().getProcesses().map(p => p.name);
|
||||
this.setOptions(names, process ? names.indexOf(process.name) : 0);
|
||||
if (process) {
|
||||
const names = this.debugService.getModel().getProcesses().map(p => p.name);
|
||||
this.select(names.indexOf(process.name));
|
||||
}
|
||||
});
|
||||
|
||||
this.debugService.getModel().onDidChangeCallStack(() => {
|
||||
this.setOptions(this.debugService.getModel().getProcesses().map(p => p.name));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user