Skip to content

Document call hierarchy plugin #2067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions plugins/hls-call-hierarchy-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Call hierarchy plugin for the [Haskell Language Server](https://github.com/haskell/haskell-language-server#readme)

The call hierarchy plugin can review the code to determine where functions are called and how they relate to other functions.

This plugin is useful when debugging and refactoring code because it allows you to see how different parts of the code are related. And it is more conducive for users to quickly understand their macro architecture in the face of strange code.
Copy link
Member

Choose a reason for hiding this comment

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

I think it's helpful to mention somewhere in this doc that this works only on definitions, not type signatures. I recently saw some people said that this feature doesn't work, but it was actually that they used this on type signatures.

Copy link
Member

Choose a reason for hiding this comment

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

out of curiosity anyone knows if other langs work differently?


## Demo

![Call Hierarchy in Emacs](call-hierarchy-in-emacs.gif)

![Call Hierarchy in VSCode](call-hierarchy-in-vscode.gif)

## Prerequisite
None. You can experience the whole feature without any setting.

## Configuration
Enable default. You can disable it in the setting file (JSON format) whenever you like.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jneira I am not sure how to point out where the setting is precisely, maybe we can link it to a unified place(lots of plugins need this)

Copy link
Member

@jneira jneira Aug 2, 2021

Choose a reason for hiding this comment

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

mmm you can the discover the hls server configuration with 2 commands:

  • haskell-language-server vscode-extension-schema: it outputs a json snippet usable in the vscode extension package.json config to add them auto to the extension config ui in vscode
  • haskell-language-server generate-default-config: it outputs the default values of that config

So the configuration for hlint, for example, would be:

{
  "haskell.plugin.hlint.diagnosticsOn": false
}

If you put a file with that content in a settings.json int the project root dir, you will disable hlint

... but i tried both commands with last version and it does not mention any hls-call-hierarchy plugin.. 🤔

I think something has to be done to "register" the plugin and include its config in the output, but dont remember right now (i think @berberman did that nice addition to the cli)

Copy link
Collaborator

Choose a reason for hiding this comment

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

but i tried both commands with last version and it does not mention any hls-call-hierarchy plugin

Ah, that's because

handlersToGenericDefaultConfig :: DSum.DSum IdeMethod f -> [A.Pair]
handlersToGenericDefaultConfig (IdeMethod m DSum.:=> _) = case m of
STextDocumentCodeAction -> ["codeActionsOn" A..= True]
STextDocumentCodeLens -> ["codeLensOn" A..= True]
STextDocumentRename -> ["renameOn" A..= True]
STextDocumentHover -> ["hoverOn" A..= True]
STextDocumentDocumentSymbol -> ["symbolsOn" A..= True]
STextDocumentCompletion -> ["completionOn" A..= True]
_ -> []

and

handlersToGenericSchema (IdeMethod m DSum.:=> _) = case m of
STextDocumentCodeAction -> [withIdPrefix "codeActionsOn" A..= schemaEntry "code actions"]
STextDocumentCodeLens -> [withIdPrefix "codeLensOn" A..= schemaEntry "code lenses"]
STextDocumentRename -> [withIdPrefix "renameOn" A..= schemaEntry "rename"]
STextDocumentHover -> [withIdPrefix "hoverOn" A..= schemaEntry "hover"]
STextDocumentDocumentSymbol -> [withIdPrefix "symbolsOn" A..= schemaEntry "symbols"]
STextDocumentCompletion -> [withIdPrefix "completionOn" A..= schemaEntry "completions"]
_ -> []

need update for new call hierarchy handlers

Copy link
Member

Choose a reason for hiding this comment

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

@July541 could you have the chance of update those definitions, to complete the hierarchy plugin integration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I'll do it.


## Acknowledgments
Supported by

* [Google Summer of Code](https://summerofcode.withgoogle.com/)
* Warm and timely help from mentors [@jneira](https://github.com/jneira) and [@pepeiborra](https://github.com/pepeiborra)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.