@@ -74,31 +74,26 @@ descriptor _recorder pluginId =
74
74
signatureHelpProvider :: PluginMethodHandler IdeState Method_TextDocumentSignatureHelp
75
75
signatureHelpProvider ideState _pluginId (SignatureHelpParams (TextDocumentIdentifier uri) position _mProgreeToken _mContext) = do
76
76
nfp <- getNormalizedFilePathE uri
77
- mResult <- runIdeActionE " signatureHelp" (shakeExtras ideState) $ do
77
+ results <- runIdeActionE " signatureHelp" (shakeExtras ideState) $ do
78
78
-- TODO(@linj) why HAR {hieAst} may have more than one AST?
79
79
(HAR {hieAst, hieKind}, positionMapping) <- useWithStaleFastE GetHieAst nfp
80
80
case fromCurrentPosition positionMapping position of
81
- Nothing -> pure Nothing
81
+ Nothing -> pure []
82
82
Just oldPosition -> do
83
- let functionName =
84
- extractInfoFromSmallestContainingFunctionApplicationAst
85
- oldPosition
86
- hieAst
87
- (\ span -> getLeftMostNode >>> getNodeName span )
88
- functionType =
89
- extractInfoFromSmallestContainingFunctionApplicationAst
90
- oldPosition
91
- hieAst
92
- (\ span -> getLeftMostNode >>> getNodeType hieKind span )
93
- argumentNumber =
94
- extractInfoFromSmallestContainingFunctionApplicationAst
95
- oldPosition
96
- hieAst
97
- getArgumentNumber
98
- pure $ Just (functionName, functionType, argumentNumber)
99
- case mResult of
100
- -- TODO(@linj) what do non-singleton lists mean?
101
- Just (functionName : _, functionType : _, argumentNumber : _) -> do
83
+ pure $
84
+ extractInfoFromSmallestContainingFunctionApplicationAst
85
+ oldPosition
86
+ hieAst
87
+ ( \ span hieAst -> do
88
+ let functionNode = getLeftMostNode hieAst
89
+ functionName <- getNodeName span functionNode
90
+ functionType <- getNodeType hieKind span functionNode
91
+ argumentNumber <- getArgumentNumber span hieAst
92
+ Just (functionName, functionType, argumentNumber)
93
+ )
94
+ case results of
95
+ -- TODO(@linj) what does non-singleton list mean?
96
+ [(functionName, functionType, argumentNumber)] ->
102
97
pure $ InL $ mkSignatureHelp functionName functionType (fromIntegral argumentNumber - 1 )
103
98
_ -> pure $ InR Null
104
99
0 commit comments