Skip to content

feat(code-action): add quickfix to remove empty inherit#787

Closed
takeokunn wants to merge 1 commit intomainfrom
feature/add-code-action-16
Closed

feat(code-action): add quickfix to remove empty inherit#787
takeokunn wants to merge 1 commit intomainfrom
feature/add-code-action-16

Conversation

@takeokunn
Copy link
Copy Markdown
Collaborator

Summary

Add a quickfix code action that removes empty inherit; statements from Nix code.

Before After
{ inherit; } { }

Changes

  • nixd/lib/Controller/CodeAction.cpp: Mark DK_EmptyInherit as isPreferred in the code action handler, so the existing diagnostic fix surfaces as a preferred quickfix in LSP clients.

Behavior

The DK_EmptyInherit diagnostic and its associated fix (removing both the inherit keyword and its ; semicolon) already exist in libnixf. This PR wires it into the LSP code action response with isPreferred: true, matching the pattern used by DK_UnusedDefLet.

Test Plan

  • Added nixd/tools/nixd/test/code-action/empty-inherit/empty-inherit.md — lit test verifying the quickfix removes inherit; and returns the expected edit range with isPreferred: true.

Related

Mark DK_EmptyInherit diagnostic as isPreferred in the code action
handler so that editors surface the existing "remove `inherit` keyword"
fix as a preferred quickfix.

Closes part of #466.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request nixd:controller

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant