diff options
author | wz1000 <> | 2021-01-13 15:27:00 (GMT) |
---|---|---|
committer | hdiff <hdiff@hdiff.luite.com> | 2021-01-13 15:27:00 (GMT) |
commit | fa4723cb08f3f691403b300560c543e461ab23f7 (patch) | |
tree | d5c6c01a88a348072585ee962ba26067598b2ce3 | |
parent | 507f4af736d9a0b9248bb34f3ae3988929ab23d3 (diff) |
-rwxr-xr-x | ChangeLog.md | 4 | ||||
-rw-r--r-- | haskell-lsp-types.cabal | 2 | ||||
-rw-r--r-- | src/Language/Haskell/LSP/Types/CodeAction.hs | 9 |
3 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog.md b/ChangeLog.md index 347a0ea..958cfc7 100755 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Revision history for haskell-lsp-types +## 0.24.0.0 + +* Add and 'isPreferred' and 'disabled' fields to CodeAction + ## 0.23.0.0 * Add runWith for transporots other than stdio (@paulyoung) diff --git a/haskell-lsp-types.cabal b/haskell-lsp-types.cabal index 6a24bb1..d000b07 100644 --- a/haskell-lsp-types.cabal +++ b/haskell-lsp-types.cabal @@ -1,5 +1,5 @@ name: haskell-lsp-types -version: 0.23.0.0 +version: 0.24.0.0 synopsis: Haskell library for the Microsoft Language Server Protocol, data types description: An implementation of the types to allow language implementors to diff --git a/src/Language/Haskell/LSP/Types/CodeAction.hs b/src/Language/Haskell/LSP/Types/CodeAction.hs index d4017e8..ef82095 100644 --- a/src/Language/Haskell/LSP/Types/CodeAction.hs +++ b/src/Language/Haskell/LSP/Types/CodeAction.hs @@ -261,6 +261,10 @@ data CodeActionParams = deriveJSON lspOptions ''CodeActionParams +newtype Reason = Reason {_reason :: Text} + deriving (Read, Show, Eq) + +deriveJSON lspOptions ''Reason data CodeAction = -- | A code action represents a change that can be performed in code, e.g. to fix a problem or -- to refactor code. @@ -275,6 +279,11 @@ data CodeAction = , _command :: Maybe Command -- ^ A command this code action executes. If a code action -- provides an edit and a command, first the edit is -- executed and then the command. + , _isPreferred :: Maybe Bool -- ^ Marks this as a preferred action. + -- Preferred actions are used by the `auto fix` command and can be targeted by keybindings. + -- A quick fix should be marked preferred if it properly addresses the underlying error. + -- A refactoring should be marked preferred if it is the most reasonable choice of actions to take. + , _disabled :: Maybe Reason -- ^ Marks that the code action cannot currently be applied. } deriving (Read,Show,Eq) deriveJSON lspOptions ''CodeAction |