Skip to content

Commit f636f1a

Browse files
committed
Use helpers from lsp to do code action prefixing
Nicer version as promised in haskell#2146.
1 parent 2558035 commit f636f1a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Diff for: hls-plugin-api/src/Ide/Types.hs

+1-5
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,7 @@ instance PluginMethod TextDocumentCodeAction where
202202
-- should check whether the requested kind is a *prefix* of the action kind.
203203
-- That means, for example, we will return actions with kinds `quickfix.import` and
204204
-- `quickfix.somethingElse` if the requested kind is `quickfix`.
205-
-- TODO: add helpers in `lsp` for handling code action hierarchies
206-
-- For now we abuse the fact that the JSON representation gives us the hierarchical string.
207-
, Just caKind <- ca ^. kind
208-
, String caKindStr <- toJSON caKind =
209-
any (\k -> k `T.isPrefixOf` caKindStr) [kstr | k <- allowed, let String kstr = toJSON k ]
205+
, Just caKind <- ca ^. kind = any (\k -> k `codeActionKindSubsumes` caKind) allowed
210206
| otherwise = False
211207

212208
instance PluginMethod TextDocumentCodeLens where

0 commit comments

Comments
 (0)