File tree 2 files changed +3
-2
lines changed
hls-module-name-plugin/src/Ide/Plugin
hls-rename-plugin/src/Ide/Plugin
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import Data.Aeson (Value (Null), toJSON)
22
22
import Data.Char (isLower )
23
23
import qualified Data.HashMap.Strict as HashMap
24
24
import Data.List (intercalate , isPrefixOf , minimumBy )
25
+ import qualified Data.List.NonEmpty as NE
25
26
import Data.Maybe (maybeToList )
26
27
import Data.Ord (comparing )
27
28
import Data.String (IsString )
@@ -99,7 +100,7 @@ action state uri =
99
100
let emptyModule = maybe True (T. null . T. strip . virtualFileText) contents
100
101
101
102
correctNames <- liftIO $ traceAs " correctNames" <$> pathModuleNames state nfp fp
102
- let bestName = minimumBy (comparing T. length ) correctNames
103
+ bestName <- minimumBy (comparing T. length ) <$> ( MaybeT . pure $ NE. nonEmpty correctNames)
103
104
104
105
statedNameMaybe <- liftIO $ traceAs " statedName" <$> codeModuleName state nfp
105
106
case statedNameMaybe of
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ renameProvider state pluginId (RenameParams (TextDocumentIdentifier uri) pos _pr
48
48
getFileEdits = ap (getSrcEdits state . renameModRefs newNameText) (locToUri . head )
49
49
50
50
fileEdits <- mapM getFileEdits filesRefs
51
- pure $ foldl1 (<>) fileEdits
51
+ pure $ foldl' (<>) mempty fileEdits
52
52
53
53
-------------------------------------------------------------------------------
54
54
-- Source renaming
You can’t perform that action at this time.
0 commit comments