zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.66k stars 3.14k forks source link

“Remove unused declaration“ command breaks Svelte each-loop #9635

Open jnsprnw opened 8 months ago

jnsprnw commented 8 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Given the following code, where i is unused:

<script>
  const data = [1, 2, 3, 4];
</script>

{#each data as d, i}
  <span>{d}</span>
{/each}

Running the Remove unused declaration command removes more than just i.

zed_1 zed_2 zed_3

On another note, the command says Remove unused declaration for: … and the general command says Delete all unused declarations. You might want to align remove and delete. It seems that you sort the action popovers alphabetically, so this would also bring them together. A more general solution would be command groups, but that should probably be in a new issue if that’s desired.

Environment

Zed 0.127.3 M2 Pro Sonoma 14.4 (23E214)

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

github-actions[bot] commented 2 months ago

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. Are you able to reproduce this issue in the latest version of Zed? If so, please let us know by commenting on this issue and we will keep it open; otherwise, we'll close it in a week. Feel free to open a new issue if you're seeing this message after the issue has been closed. Thanks for your help!

jnsprnw commented 2 months ago

The issue can still be reproduced.