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

Add support for upstream textDocument/rename lsp support for terraform-ls #300

Open
teddylear opened this issue Aug 9, 2023 · 2 comments

Comments

@teddylear
Copy link

A follow up to this issue on terraform-ls, wanted to make this here per @radeksimko suggestion to discuss design of implementing supporting functionality to this repo to be used by terraform-ls to perform renames on resoures/data sources/etc. This would hopefully help support an lsp rename operation on all hcl based configuration. I can start taking a look into this repo to see what functionality would have be added/missing, but very high level plan would be the following:

  • Go to definition of an object
  • Get all references of said object
  • then perform rename operation on all references of object where relevant

If there's anything that should change in this approach or I'm missing please let me know. Also if possible would love to implement this.

@jchillin
Copy link

Randomly stumbled across this as well while encountering these limitations myself. Super curious about this as well and open to helping if needed

@teddylear
Copy link
Author

@ansgarm Tagging you because I'm not sure of the best person/group to tag for this repo to follow up on issues (if there is a better way please let me know).

Having time to look into this more, I'm assuming for implementation it would be a combination of ReferenceTargetsForOriginAtPos to go to the origin and ReferenceOriginsTargetingPos to get the references of the hcl object. Then combining both of these list should give all positions that need to be renamed by the upstream lsp. These functions may not be used in full pieces may just be copied over to this new rename definition, but I wanted to confirm this approach at a high level makes sense before getting deep into implementation. If there is another approach I should use to accomplish this or if I am way off the mark please let me know.

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

2 participants