Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Enable TypeDefinition Requests #1169

Merged
merged 1 commit into from Apr 9, 2019

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented Apr 9, 2019

It works in VsCode with simple examples.

@@ -966,6 +966,7 @@ hieOptions :: [T.Text] -> Core.Options
hieOptions commandIds =
def { Core.textDocumentSync = Just syncOptions
, Core.completionProvider = Just (J.CompletionOptions (Just True) (Just ["."]))
, Core.typeDefinitionProvider = Just (J.GotoOptionsStatic True)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is J.GotoOptionsStatic True the right thing?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked the haskell-lsp docs and was none the wiser afterwards.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that the protocol allows to pass a link instead of a file as response, which would be nice for hoogle packages. Should we look into this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would that entail?
What do you mean with hoogle packages? Documentation?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll investigate a bit more, I think it would entail showing the local Html page build with haddock or potentially a link to the haddock page for the type, which we can get from hoogle

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also be interesting for findDefinition.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if it worked project wide, but I think, this is a different problem.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the typedefinitionprovider flag to be set only if there is a handler for the gototypedefinition request, rather than having to be set explicitly.

So there may be a shortcoming in haskell-lsp.

Copy link
Collaborator

@lukel97 lukel97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the correct usage of the LSP options from what I can remember (to let the client know what features the server supports and other stuff. We should probably go through flick on all the options for the stuff we already support at some point too)

As a side point, shouldn’t the field be called server capabilities? Perhaps I am confusing it with something else

@fendor
Copy link
Collaborator Author

fendor commented Apr 9, 2019

So is this ready to merge? The feature looks like it's working on small projects.

@lukel97 lukel97 merged commit c3c70af into haskell:master Apr 9, 2019
@alanz
Copy link
Collaborator

alanz commented Apr 10, 2019

@bubba @fendor I would expect this capability to be set the same way it is done for go to definition, as per https://github.com/alanz/haskell-lsp/blob/master/src/Language/Haskell/LSP/Core.hs#L620

@fendor
Copy link
Collaborator Author

fendor commented Apr 10, 2019

@alanz why are the capabilities of hie set via haskell-lsp? I thought, haskell-lsp is more general than hie.

@alanz
Copy link
Collaborator

alanz commented Apr 10, 2019

@fendor because some of them are mechanical consequences. If we have a typedefinitionrequesthandler, it means we have the capability, so should set it. If this were correctly set in haskell-lsp from the beginning, this PR would not be necessary.

@fendor
Copy link
Collaborator Author

fendor commented Apr 10, 2019

So, this is a mistake in haskell-lsp that should be fixed and this commit should be reverted after it is done?

@alanz
Copy link
Collaborator

alanz commented Apr 10, 2019

yes

@fendor fendor deleted the enable-type-definition-request branch April 13, 2019 16:46
@alanz alanz added this to the 2019-04 milestone May 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants