@@ -18,6 +18,7 @@ import Data.Aeson.Types
18
18
import Data.Text (Text )
19
19
import qualified Data.Text as T
20
20
import Language.Haskell.LSP.Types.ClientCapabilities
21
+ import Language.Haskell.LSP.Types.CodeAction
21
22
import Language.Haskell.LSP.Types.Command
22
23
import Language.Haskell.LSP.Types.Constants
23
24
import Language.Haskell.LSP.Types.Diagnostic
@@ -259,6 +260,30 @@ data CodeLensOptions =
259
260
260
261
deriveJSON lspOptions ''CodeLensOptions
261
262
263
+ -- ---------------------------------------------------------------------
264
+ {-
265
+ /**
266
+ * Code Action options.
267
+ */
268
+ export interface CodeActionOptions {
269
+ /**
270
+ * CodeActionKinds that this server may return.
271
+ *
272
+ * The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
273
+ * may list out every specific kind they provide.
274
+ */
275
+ codeActionKinds?: CodeActionKind[];
276
+ }
277
+ -}
278
+
279
+ data CodeActionOptions =
280
+ CodeActionOptionsStatic Bool
281
+ | CodeActionOptions
282
+ { _codeActionKinds :: Maybe [CodeActionKind ]
283
+ } deriving (Read ,Show ,Eq )
284
+
285
+ deriveJSON (lspOptions { sumEncoding = A. UntaggedValue }) ''CodeActionOptions
286
+
262
287
-- ---------------------------------------------------------------------
263
288
{-
264
289
/**
@@ -463,9 +488,11 @@ interface ServerCapabilities {
463
488
*/
464
489
workspaceSymbolProvider?: boolean;
465
490
/**
466
- * The server provides code actions.
491
+ * The server provides code actions. The `CodeActionOptions` return type is only
492
+ * valid if the client signals code action literal support via the property
493
+ * `textDocument.codeAction.codeActionLiteralSupport`.
467
494
*/
468
- codeActionProvider?: boolean;
495
+ codeActionProvider?: boolean | CodeActionOptions ;
469
496
/**
470
497
* The server provides code lens.
471
498
*/
@@ -662,7 +689,7 @@ data InitializeResponseCapabilitiesInner =
662
689
-- | The server provides workspace symbol support.
663
690
, _workspaceSymbolProvider :: Maybe Bool
664
691
-- | The server provides code actions.
665
- , _codeActionProvider :: Maybe Bool
692
+ , _codeActionProvider :: Maybe CodeActionOptions
666
693
-- | The server provides code lens.
667
694
, _codeLensProvider :: Maybe CodeLensOptions
668
695
-- | The server provides document formatting.
0 commit comments