Skip to content

Commit d7c2bb6

Browse files
authored
let suggest new imports work on symbol operators used infix (#540)
1 parent 15bb044 commit d7c2bb6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Development/IDE/Plugin/CodeAction.hs

+2
Original file line numberDiff line numberDiff line change
@@ -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
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)