let suggest new imports work on symbol operators used infix (#540)
commitd7c2bb6ff3c4de2de29c7e9da52ad37a7ec7638f
authorJ. S <document_done@hotmail.com>
dateFri 8 May 2020, 09:48 (6 years ago)
parent15bb044
src/Development/IDE/Plugin/CodeAction.hs+2
@@ -424,6 +424,8 @@ extractNotInScopeName x
424424 = Just $ NotInScopeDataConstructor name
425425 | Just [name] <- matchRegex x "ot in scope: type constructor or class [^‘]*‘([^’]*)’"
426426 = Just $ NotInScopeTypeConstructorOrClass name
427+ | Just [name] <- matchRegex x "ot in scope: \\(([^‘ ]+)\\)"
428+ = Just $ NotInScopeThing name
427429 | Just [name] <- matchRegex x "ot in scope: ([^‘ ]+)"
428430 = Just $ NotInScopeThing name
429431 | Just [name] <- matchRegex x "ot in scope:[^‘]*‘([^’]*)’"
test/exe/Main.hs+2
@@ -966,6 +966,8 @@ suggestImportTests = testGroup "suggest import actions"
966966 , test True [] "f :: Typeable a => a" ["f = undefined"] "import Data.Typeable (Typeable)"
967967 , test True [] "f = pack" [] "import Data.Text (pack)"
968968 , test True [] "f :: Text" ["f = undefined"] "import Data.Text (Text)"
969+ , test True [] "f = [] & id" [] "import Data.Function ((&))"
970+ , test True [] "f = (&) [] id" [] "import Data.Function ((&))"
969971 ]
970972 ]
971973 where