Skip to content

Add trigger type to CodeActionContext #34595

@mjbvz

Description

@mjbvz

Part of #33555

Problems
Extensions currently do not know how a code actions request was triggered. Code actions may be requested automatically by vscode or when the user requests them

Proposal
Add a trigger type to CodeActionContext:

export interface CodeActionContext {
    readonly diagnostics: Diagnostic[];
    readonly trigger: 'auto' | 'manual';
}
  • auto: Code actions requested by VS Code automatically
  • manual: Code actions requested by user / command

Extensions could use this to determine which code actions they want to compute / show. For example, an extension may decide to only compute refactorings when a user requests them

// @jrieken

Metadata

Metadata

Assignees

Labels

apieditor-code-actionsEditor inplace actions (Ctrl + .)feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions