Skip to content

Adding refactor code actions #1525

@ziyeqf

Description

@ziyeqf

Language Server Version

v0.32.4

Problem Statement

want to add some code actions to the language server.

Attempted Solutions

No response

Proposal

terraform-ls only supports source.formatAll.terraform action for now.

I'm planing to adding some code actions ( mainly about refactor.extract.xxx ) to it.

To help improve the editing experience. And also for our project which help editing(refactoring) terraform configuration files by those not familar with terraform. We have a basic (rough) list of actions we want to implement and want to discuss about them, some might not fit to be in the language server, I have marked them with ❓.

action list

  1. ❓delete a block
  2. ❓create a block (provider/output/variable), acts like a snippet
  3. ❓show all unused parameters of a resource, ( to help users find which parameter they want to use in an editing)
  4. remove unused parameters of a resource
  5. extract a property to a variable block
  6. extract a property to an output block
  7. ❓extract a property to reference another property in another resource

Any response would be appericiated.

Related LSP methods

  • textDocument/codeActions

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions