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

Test improved code actions API #42333

Closed
2 tasks done
jrieken opened this issue Jan 29, 2018 · 2 comments
Closed
2 tasks done

Test improved code actions API #42333

jrieken opened this issue Jan 29, 2018 · 2 comments

Comments

@jrieken
Copy link
Member

jrieken commented Jan 29, 2018

Test for #34664

Complexity: 3

OS

@jrieken
Copy link
Member Author

jrieken commented Jan 29, 2018

FYI - to test against the latest API do the following:

  • open your extensions package.json file
  • change the engine.vscode property to *
  • run npm run postinstall (assuming you have the vscode module as dev-dependency)
  • undo the engine-version change from step 2

@mjbvz
Copy link
Collaborator

mjbvz commented Jan 29, 2018

Overview

#34664 introduces a new type, CodeAction, which provides additional metadata and functionality code actions.

Core Testing

  1. With an extension that is using the proposed API as jrieken documents above

  2. Create a simple code action provider that returns vscode.CodeAction instead of vscode.Command

    • ✅ Your new code actions show up in the lightbulb menu. Confirm that they have the proper title and apply the proper command when selected
  3. Update the code action to use a workspace edits instead of a command

    • ✅ Edit is applied as expected
    • ✅ If you set both a command and an edit, that they are both applied (edit first then command)
    • ✅ Multiple code actions apply edits in order
  4. Now set a kind on the code actions, such as vscode.CodeActionKind.QuickFix

    • ✅ These actions still show up in the normal light bulb menu
    • ✅ Actions of kind QuickFix does not show up in the refactor menu (triggered by running the refactor command)
  5. Add some diagnostics to the CodeAction

    • ✅ In the lightbulb menu, code actions for the same diagnostic should be grouped together
    • ✅ In the lightbulb menu, code actions should be sorted by diagnostic severity

Other cases to try

  • ✅ A single provider can return both commands and code actions
  • ✅ Command based provider still function as expected
  • ✅ The vscode.d.ts documentation of the new CodeAction and CodeAction types makes sense

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

No branches or pull requests

4 participants