You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[html] can't "rename symbol" within <script> tags #85411
feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitieshtmlHTML support issuesinsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded
Problem
In an HTML file with <script> tags, the "rename symbol" command is unavailable.
VSCode 1.40.1
Workaround
"find and replace," but that's always a bit scarier, because it requires vigilance to avoid renaming the wrong thing.
Example <p>catalog</p> <script> let cat = 'hiss'; cat = 'purr'; </script>
Desired behavior:
select cat --> rename symbol to "feline" --> should just replace the variable cat with feline, leaving "catalog" alone.
But, this option is unavailable.
So, the alternative is to find-and-replace all --> "cat" to "feline" --> "felinealog".
Or need to go one-by-one and check, which can be tricky in a long file.
Of course, you can be clever searching for " cat " with spaces, but this is just a simple example.
Possible solutions
In an HTML file, the rename could either affect all so-named symbols in all <script> tags in the file, or local to the current <script> tag.
Thanks for considering this!
Reacted by stagefright5, Tim Bhison and Michal Čaplygin
I'm wondering if the cause of this is related to #85306, "Expand selection" misses { } in <script> tag, in which case perhaps both individual issues should be closed in favor of something like, "some editor features do not work within <script> tags."
feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitieshtmlHTML support issuesinsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded
Activity
ultraGentle commentedon Nov 22, 2019
I'm wondering if the cause of this is related to #85306, "Expand selection" misses { } in <script> tag, in which case perhaps both individual issues should be closed in favor of something like, "some editor features do not work within <script> tags."
aeschli commentedon Nov 26, 2019
It's just not implemented yet.
[-]can't "rename symbol" within <script> tags[/-][+][html] can't "rename symbol" within <script> tags[/+]ultraGentle commentedon Nov 26, 2019
Thanks for the response. Good to know.
stagefright5 commentedon May 18, 2020
Hey Martin Aeschlimann (@aeschli) , Can you provide any details on this? Is it in the roadmap?
aeschli commentedon May 18, 2020
No, it's not on the roadmap. Help is welcome!
chenjigeng commentedon Dec 1, 2020
Martin Aeschlimann (@aeschli) can you check this? I did it by borrowing its ideas