+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_analyze): extend ActionCategory to allow expressing more code action kinds #3627

Merged
merged 3 commits into from
Nov 15, 2022

Conversation

leops
Copy link
Contributor

@leops leops commented Nov 9, 2022

Summary

This PR adds new variants and sub-enums to the ActionCategory enum in rome_analyze to allow creating code actions with other "root kinds" than quickfix and refactor (such as source), as well as express sub-types for refactor and source actions (such as extract, inline and rewrite for refactors).

In addition to this, code action kinds are now suffixed with .rome.<rule group>.<rule name>: this allows user to specify they want the "Fix All" action exposed by Rome instead of any fix-all action to be applied automatically on save using "editor.codeActionsOnSave": { "source.fixAll.rome": true }, or to explicitly request that code actions emitted by a given rule are applied automatically (again by adding entries such as quickfix.rome.correctness.useWhile to codeActionsOnSave)

Test Plan

I've extended the test cases for pulling diagnostics, quickfixes and refactors from the LSP and added a new test for pulling the "fix all" action.

@leops leops added A-Linter Area: linter A-LSP Area: language server protocol E-VScode Editors: VSCode labels Nov 9, 2022
@leops leops added this to the 11.0.0 milestone Nov 9, 2022
@netlify
Copy link

netlify bot commented Nov 9, 2022

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit 9cbd0d0
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63726821da76d60008727941

@leops leops temporarily deployed to netlify-playground November 9, 2022 17:03 Inactive
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

@leops leops force-pushed the feature/action-category branch from 9f4ef6b to efc1a9d Compare November 14, 2022 13:33
@leops leops requested a review from a team November 14, 2022 13:33
@ematipico
Copy link
Contributor

@leops would it be possible to have a code action specifically for rule suppression via editors? Having a category for them would make things way easier on the long run.

@leops
Copy link
Contributor Author

leops commented Nov 14, 2022

would it be possible to have a code action specifically for rule suppression via editors? Having a category for them would make things way easier on the long run.

This is what the Other(_) variants are intended for, it would be possible to define the category of the "Suppress rule" action as ActionCategory::Other(Cow::Borrowed("quickfix.rome.suppressRule")) for instance

@leops leops merged commit 33b5ce6 into main Nov 15, 2022
@leops leops deleted the feature/action-category branch November 15, 2022 08:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter A-LSP Area: language server protocol E-VScode Editors: VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载