Skip to content

Commit 698ef6f

Browse files
authored
Merge pull request #491 from haskell/mpj/cak-subsume
Add codeActionKindSubsumes back
2 parents ca8b400 + 997ba52 commit 698ef6f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

lsp-types/lsp-types.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ library
117117
Language.LSP.Protocol.Message.Parsing
118118
Language.LSP.Protocol.Message.Registration
119119
Language.LSP.Protocol.Message.Types
120+
Language.LSP.Protocol.Types.CodeAction
120121
Language.LSP.Protocol.Types.Common
121122
Language.LSP.Protocol.Types.Edit
122123
Language.LSP.Protocol.Types.Lens

lsp-types/src/Language/LSP/Protocol/Types.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module Language.LSP.Protocol.Types (
1616
, module Edits
1717
-- ** Markup
1818
, module Markup
19+
-- ** Code actions
20+
, module CodeAction
1921
-- ** Progress
2022
, module Progress
2123
-- ** Semantic tokens
@@ -24,11 +26,10 @@ module Language.LSP.Protocol.Types (
2426
, module WatchKinds
2527
-- * Main LSP types and functions
2628
, module Generated
27-
-- ** Orphan instances for the generated types
28-
, module Orphans
2929
) where
3030

3131
import Language.LSP.Protocol.Internal.Types as Generated
32+
import Language.LSP.Protocol.Types.CodeAction as CodeAction
3233
import Language.LSP.Protocol.Types.Common as Common
3334
import Language.LSP.Protocol.Types.Location as Locations
3435
import Language.LSP.Protocol.Types.LspEnum as LspEnum
@@ -39,5 +40,5 @@ import Language.LSP.Protocol.Types.Singletons as Singletons
3940
import Language.LSP.Protocol.Types.Uri as Uri
4041
import Language.LSP.Protocol.Types.Uri.OsPath as Uri
4142
import Language.LSP.Protocol.Types.Edit as Edits
42-
import Language.LSP.Protocol.Types.Orphans as Orphans
43+
import Language.LSP.Protocol.Types.Orphans ()
4344
import Language.LSP.Protocol.Types.WatchKinds as WatchKinds
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Language.LSP.Protocol.Types.CodeAction where
2+
3+
import Language.LSP.Protocol.Types.LspEnum
4+
import Language.LSP.Protocol.Internal.Types
5+
import qualified Data.Text as T
6+
7+
-- | Does the first 'CodeActionKind' subsume the other one, hierarchically. Reflexive.
8+
codeActionKindSubsumes :: CodeActionKind -> CodeActionKind -> Bool
9+
-- Simple but ugly implementation: prefix on the string representation
10+
codeActionKindSubsumes parent child = toEnumBaseType parent `T.isPrefixOf` toEnumBaseType child

0 commit comments

Comments
 (0)