mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
directly resolving the code action when it is an ai code action
This commit is contained in:
parent
4d4bcb9b34
commit
ee8bb3475b
|
@ -260,6 +260,7 @@ export class CodeActionController extends Disposable implements IEditorContribut
|
|||
return;
|
||||
}
|
||||
|
||||
// place into the lightBulbWidget file, will need to define the icon there
|
||||
console.log('actionsToShow : ', actionsToShow);
|
||||
let lightbulbMode = LightBulbMenuIconMode.Standard;
|
||||
actionsToShow.forEach(action => {
|
||||
|
@ -272,6 +273,13 @@ export class CodeActionController extends Disposable implements IEditorContribut
|
|||
});
|
||||
console.log('lightbulbMode : ', lightbulbMode);
|
||||
this._lightBulbWidget.rawValue?.updateLightBulbTitleAndIcon(lightbulbMode);
|
||||
//
|
||||
|
||||
if (actionsToShow.length === 1 && actionsToShow[0].action.isAI) {
|
||||
// There is exactly one code action and it is an AI code action, then automatically trigger it
|
||||
actionsToShow[0].resolve(CancellationToken.None);
|
||||
return;
|
||||
}
|
||||
|
||||
const anchor = Position.isIPosition(at) ? this.toCoords(at) : at;
|
||||
|
||||
|
|
|
@ -213,6 +213,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
|
|||
this.updateLightBulbTitleAndIcon();
|
||||
}
|
||||
|
||||
// make private once again, because we can find the actions directly from this file, do not need to trigger this method from someplace else
|
||||
public updateLightBulbTitleAndIcon(iconMode: LightBulbMenuIconMode = LightBulbMenuIconMode.Standard): void {
|
||||
|
||||
if (iconMode !== LightBulbMenuIconMode.Standard) {
|
||||
|
|
Loading…
Reference in a new issue