-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Conversation
wow, that was really fast, many thanks for adding the docs, we miss them here a lot 😅 |
Yes, I got a lot of trouble when I first into this project 😅, hope it can bring convenience to others. |
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. |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 vscodehaskell-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)
There was a problem hiding this comment.
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
haskell-language-server/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
Lines 87 to 95 in 047ffc3
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
haskell-language-server/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs
Lines 117 to 124 in 047ffc3
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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. |
Continue on #2072. |
This document includes