Skip to content

Commit

Permalink
fixup! Improve ImportDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardSergeev committed Jun 20, 2024
1 parent 5f5d298 commit eda221a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion input/before/UnusedImportProvider.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Data.List (sort, tails)
import Data.Maybe
import Data.Monoid (All(..), Any(getAny), Product(getProduct), Sum(..))
import Data.Monoid (All(..), Any(getAny), Product(getProduct), Sum(..), Any(..), First(..))

foo :: Ord a => [a] -> [a]
foo xs =
Expand Down
3 changes: 1 addition & 2 deletions src/features/importProvider/importDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ export default class ImportDeclaration {
}

public removeElement(elem: string) {
const regex = new RegExp(`^${elem}(\(.+\))?$`);
const before = this.importElements;

const index = this._importElements.findIndex(elem => regex.test(elem));
const index = this._importElements.findIndex(oldElem => oldElem === elem || oldElem == `${elem}(..)`);
if (index !== -1) {
if (this._importElements.length > 1) {
if (index === this._importElements.length - 1) {
Expand Down

0 comments on commit eda221a

Please sign in to comment.