lexical-lsp / lexical

Lexical is a next-generation elixir language server
776 stars 77 forks source link

Code Action: Remove unused aliases #748

Closed scohen closed 1 month ago

scohen commented 1 month ago

This code action removes any unused aliases. It handles both single aliases where it deletes the entire line up to the next line, and multiple aliases, where it deletes the single alias in the list, handling edge cases when it deletes both the last entry in the list, deleting the previous line's comma and when there's only one entry in the list when it deletes the whole alias.

The approach here is much more complicated than I wanted, I described the reasons why it's that way in the module's documentation, hopefully, we can get a fix from sourceror soon and improve this.