Skip to content
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

Document call hierarchy plugin #2067

Closed
wants to merge 3 commits into from
Closed

Conversation

July541
Copy link
Collaborator

@July541 July541 commented Aug 2, 2021

This document includes

  • description
  • demo
  • requirement and configure
  • acknowledge

@jneira
Copy link
Member

jneira commented Aug 2, 2021

wow, that was really fast, many thanks for adding the docs, we miss them here a lot 😅

@July541
Copy link
Collaborator Author

July541 commented Aug 2, 2021

Yes, I got a lot of trouble when I first into this project 😅, hope it can bring convenience to others.

@jneira
Copy link
Member

jneira commented Aug 2, 2021

I would add a link to this readme in the main one, in the features section f.e.

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.


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?

@Ailrun
Copy link
Member

Ailrun commented Aug 2, 2021

I would add a link to this readme in the main one, in the features section f.e.

Yeah, giving users the links to documented plugins will be great. Currently it's kinda hard to know which one is documented, and it's also not so user-friendly that asking users to check directories for all packages.

@July541
Copy link
Collaborator Author

July541 commented Aug 3, 2021

Continue on #2072.

@July541 July541 closed this Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants