Extract snippet from file `refactor.extract` CodeAction
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 234
- Forks
- 92
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
The LSP defines some CodeActionKinds that have special meanings in some Language Clients. One of those is the RefactorExtract action kind.
We could probably offer a RefactorExtract action when you highlight a large range of text inside a section|template|snippet.
When executed, we could do something like this:
- For range Y in input file X:
- Find all non-global variables in Y
- Create a file
snippets/Z.liquidwith the contents of Y - Replace Y in X by the following:
{% render '#{Z}', #{all_the_non_global_variables_as_arguments} %}
To be answered:
- Can we prompt for a filename during that process?
Resources
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proposed behavior in this issue and read the linked LSP CodeAction specification. Identify the language-server entry point for CodeActions and determine how range variables, snippet creation, replacement text, and filename prompting should work. Done means a RefactorExtract action can perform the described extraction with a clear filename flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100