Skip to content

Commit 6f90b19

Browse files
committed
Set the typedefinitionProvider capability if it has a handler
The capability can either be a static bool, or a dynamic option given the specific file it applies to. If the server explicitly sets the option to one of those in its Config we use it, else set it to statically True if there is a handler for the type definition request.
1 parent 47af965 commit 6f90b19

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Language/Haskell/LSP/Core.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,12 @@ initializeRequestHandler' (_configHandler,dispatcherProc) mHandler tvarCtx req@(
600600
supported (Just _) = Just True
601601
supported Nothing = Nothing
602602

603+
-- If a dynamic setting is provided use it, else set a
604+
-- static True if there is a handler.
605+
static (Just d) _ = Just d
606+
static _ (Just _) = Just (J.GotoOptionsStatic True)
607+
static _ Nothing = Nothing
608+
603609
sync = case textDocumentSync o of
604610
Just x -> Just (J.TDSOptions x)
605611
Nothing -> Nothing
@@ -618,7 +624,7 @@ initializeRequestHandler' (_configHandler,dispatcherProc) mHandler tvarCtx req@(
618624
, J._completionProvider = completionProvider o
619625
, J._signatureHelpProvider = signatureHelpProvider o
620626
, J._definitionProvider = supported (definitionHandler h)
621-
, J._typeDefinitionProvider = typeDefinitionProvider o
627+
, J._typeDefinitionProvider = static (typeDefinitionProvider o) (typeDefinitionHandler h)
622628
, J._implementationProvider = implementationProvider o
623629
, J._referencesProvider = supported (referencesHandler h)
624630
, J._documentHighlightProvider = supported (documentHighlightHandler h)

0 commit comments

Comments
 (0)