Skip to content

New rename plugin implementation #2108

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
avoid using Data.List.nub
  • Loading branch information
OliverMadine committed Aug 17, 2021
commit 6c994a0fb22858124a4a2ce15237e24378c5f769
4 changes: 2 additions & 2 deletions plugins/hls-rename-plugin/src/Ide/Plugin/Rename.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import qualified Data.Bifunctor
import Data.Containers.ListUtils
import Data.Generics
import qualified Data.HashMap.Strict as HM
import Data.List
import qualified Data.HashSet as HashSet
import qualified Data.Map as M
import Data.Maybe
import qualified Data.Text as T
Expand Down Expand Up @@ -43,7 +43,7 @@ renameProvider state pluginId (RenameParams (TextDocumentIdentifier uri) pos _pr
oldName <- (handleMaybe "error: could not find name at pos" . listToMaybe) =<<
getNamesAtPos state pos nfp
refs <- refsAtName state nfp oldName
refFiles <- mapM safeGetNfp (nub [uri | Location uri _ <- refs])
refFiles <- mapM safeGetNfp (HashSet.toList $ HashSet.fromList [uri | Location uri _ <- refs])

let newOccName = mkTcOcc $ T.unpack newNameText
nfpEdits <- mapMToSnd (getSrcEdits state (renameRefs refs newOccName)) refFiles
Expand Down