Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better code action filtering #5288

Open
davidosomething opened this issue Mar 22, 2025 · 4 comments
Open

Better code action filtering #5288

davidosomething opened this issue Mar 22, 2025 · 4 comments

Comments

@davidosomething
Copy link
Contributor

davidosomething commented Mar 22, 2025

Is your feature request related to a problem? Please describe.

I might want to filter some code actions out, but not sure what kind it is

Describe the solution you'd like

In the code action menu (showMenuPicker), always show the kind after the name, i.e.

Image

should say Move to file [refactor]
or whatever the kind is

@davidosomething
Copy link
Contributor Author

Actually I would specifically like to filter out those two show refactor kinds, but NOT ALL refactor kinds (e.g. keep Extract to type alias https://github.com/neoclide/coc-tsserver/blob/938682f1825b1b35de550c72db525eab6d96830e/src/server/features/refactor.ts#L318 )

I think what I really need is a way to filter code action by source (coc-tsserver) and name (Move to file)

Instead of only in getCodeAction

public async getCodeActions(doc: Document, range?: Range, only?: CodeActionKind[]): Promise<CodeAction[]> {

maybe have filter fn ? or some config

{
  exclude: [
    { source: 'tsserver', name: 'Move to file' },
    { source: 'tsserver', name: 'Move to a new file' },
  ]
}

@davidosomething davidosomething changed the title Show the CodeActionKind in the Choose action menu Better code action filtering Mar 22, 2025
@davidosomething
Copy link
Contributor Author

Related to #5278 (which is for sorting codeactions, not filtering)

@chemzqm
Copy link
Member

chemzqm commented Mar 22, 2025

The coc-tsserver shows unnecessary selection for refactor, I've fixed the issue on coc-tsserver to make it useful

@Lmills71
Copy link

Lmills71 commented Mar 22, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants