-
Notifications
You must be signed in to change notification settings - Fork 24
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
Automatic renaming of snippet and assets on file rename #541
Conversation
2cfba99
to
48f9255
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩 complete (we already discussed about the limitations on auto-saving after renaming files on Node)
minor comments, but nothing blocking
|
||
it('returns a needConfirmation: false workspace edit for renaming an asset', async () => { | ||
await handler.onDidRenameFiles({ | ||
files: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't tophat this, but could we also attempt to rename two files at once in both handler's test cases? From the code, it appears as if that's possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh, I put that in to satisfy typescript. You'd get an array when you rename folders, but if you did then the condition isSnippet() for both the old and new uri would never be true.
I'm not 100% sure how else you could get multiple snippet renames in one UI operation.
packages/theme-language-server-common/src/renamed/handlers/SnippetRenameHandler.spec.ts
Outdated
Show resolved
Hide resolved
packages/theme-language-server-common/src/renamed/handlers/AssetRenameHandler.ts
Outdated
Show resolved
Hide resolved
} | ||
}); | ||
|
||
it('handles .js.liquid files', async (ext) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('handles .js.liquid files', async (ext) => { | |
it('handles when asset file is renamed and has added a `.liquid` extension to it', async (ext) => { |
} | ||
}); | ||
|
||
it('handles .css.liquid files', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('handles .css.liquid files', async () => { | |
it('handles when asset file with `.liquid` extension is renamed', async () => { |
- {{ 'oldName.js' | asset_url }} -> {{ 'newName.js' | asset_url }} - {{ 'oldName.css' | asset_url }} -> {{ 'newName.css' | asset_url }} - {% echo 'oldName.css' | asset_url %} -> {% echo 'newName.css' | asset_url %} - etc.
23f980e
to
70cb630
Compare
What are you adding in this PR?
automatic-rename-refactor.mp4
snippets/*.liquid
files are renamed, we ask the client to do the following:{% render 'oldName' %}
calls to{% render 'newName' %}
assets/*(.liquid)?
files are renamed, we ask the client to do the following:{{ 'oldName.ext' | asset_url }}
calls to{{ 'newName.ext' | asset_url }}
preload
method to theDocumentManager
version
ofundefined
DocumentManager#theme
includeFilesFromDisk
will make it so the theme method returns all the files in the themeHow it works
workspace/didRenameFiles
notifications from the language clientTextDocumentEdit
we need to apply to modify the themeworkspace/applyEdit
request to the clientWhat's next? Any followup issues?
Before you deploy
changeset