@@ -47,8 +47,8 @@ identifierFromExternDecl (TypeSynonymDeclaration name _) = runProperNameT name
4747identifierFromExternDecl (DataConstructor name _ _) = name
4848identifierFromExternDecl (TypeClassDeclaration name) = runProperNameT name
4949identifierFromExternDecl (ModuleDecl name _) = name
50−identifierFromExternDecl (FixityDeclaration (Left op)) = runOpNameT op
51−identifierFromExternDecl (FixityDeclaration (Right op)) = runOpNameT op
50+identifierFromExternDecl (ValueOperator op _ _ _) = runOpNameT op
51+identifierFromExternDecl (TypeOperator op _ _ _) = runOpNameT op
5252identifierFromExternDecl Dependency{} = "~Dependency~"
5353identifierFromExternDecl Export{} = "~Export~"
5454
@@ -56,16 +56,25 @@ identifierFromMatch :: Match -> Text
5656identifierFromMatch (Match _ ed) = identifierFromExternDecl ed
5757
5858completionFromMatch :: Match -> Maybe Completion
59−completionFromMatch (Match _ Dependency{}) = Nothing
60−completionFromMatch (Match _ Export{}) = Nothing
61−completionFromMatch (Match m d) = Just $ case d of
62− ValueDeclaration name type' -> Completion (m, name, prettyTypeT type')
63− TypeDeclaration name kind -> Completion (m, runProperNameT name, T.pack $ P.prettyPrintKind kind)
64− TypeSynonymDeclaration name kind -> Completion (m, runProperNameT name, prettyTypeT kind)
65− DataConstructor name _ type' -> Completion (m, name, prettyTypeT type')
66− TypeClassDeclaration name -> Completion (m, runProperNameT name, "class")
67− ModuleDecl name _ -> Completion ("module", name, "module")
68− _ -> error "the impossible happened in completionFromMatch"
59+completionFromMatch (Match m d) = case d of
60+ ValueDeclaration name type' -> Just $ Completion (m, name, prettyTypeT type')
61+ TypeDeclaration name kind -> Just $ Completion (m, runProperNameT name, T.pack $ P.prettyPrintKind kind)
62+ TypeSynonymDeclaration name kind -> Just $ Completion (m, runProperNameT name, prettyTypeT kind)
63+ DataConstructor name _ type' -> Just $ Completion (m, name, prettyTypeT type')
64+ TypeClassDeclaration name -> Just $ Completion (m, runProperNameT name, "class")
65+ ModuleDecl name _ -> Just $ Completion ("module", name, "module")
66+ ValueOperator op ref precedence associativity -> Just $ Completion (m, runOpNameT op, showFixity precedence associativity ref op)
67+ TypeOperator op ref precedence associativity -> Just $ Completion (m, runOpNameT op, showFixity precedence associativity ref op)
68+ Dependency{} -> Nothing
69+ Export{} -> Nothing
70+ where
71+ showFixity p a r o =
72+ let asso = case a of
73+ P.Infix -> "infix"
74+ P.Infixl -> "infixl"
75+ P.Infixr -> "infixr"
76+ in T.unwords [asso, T.pack (show p), r, "as", runOpNameT o]
77+
6978
7079encodeT :: (ToJSON a) => a -> Text
7180encodeT = toStrict . decodeUtf8 . encode