-
-
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
Renaming multi component support #2193
Comments
I think if we enabled it with the caveat that it will only work reliably across one component that would be fine. Perhaps slap "(experimental)" after all the code action titles :) |
We don't use a code action since we get the new name directly from the client. So I don't think we have a great way of announcing this caveat to the user without them having to go through HLS logs etc. It would be nice to have a vscode option (rather than a cabal build flag) so that we could enable the plugin for single-component use more easily, but I'm not really sure how to do this (especially without causing the plugin tests to fail). |
i am afraid #2009 needs haskell/hie-bios#301 which in turn needs the |
It was my understanding that this PR is just concerned with 'loading multiple components' and we were going to use If not, this at least seems to be what it is doing currently so maybe we could merge what is done so far ('loading multiple components') then open a new PR to continue the work? |
Sorry, that PR is indeed more a POC for what is possible with show-build-info, not of the general multiple components loading mechanism. However, it is true that the general issue of loading multiple components can be done independently of show-build-info, just the semantics of the proposed NonEmpty needs to be discussed. |
We could add a configuration option in vscode to enable/disable the plugin at runtime and make it disabled by default. In the config description we could note the caveats. //cc @berberman |
In order to disable a plugin by default (no corresponding config section provided), we will need to change the behavior of parsing haskell-language-server/hls-plugin-api/src/Ide/Plugin/Config.hs Lines 78 to 95 in b6d1df2
Currently, the following "static" default values will be used if the client does not provide these options: haskell-language-server/hls-plugin-api/src/Ide/Plugin/Config.hs Lines 132 to 144 in b6d1df2
I think a easy way would be carrying the information that "the client does not give this value" in parsed config, rather than concealing it with a default value. So in plugin's handler, we could retrieve the config which says no option to enable this plugin is given by the client. |
With the new rename plugin implementation in mind, is this plugin now suitable to be enabled? It would create a huge productivity boost, even if still has that one-component-only-caveat. |
Yeah, i think the required changes in cabal will take more time and there is no a wip in stack so it is time to enable it, making clear its limitations in docs |
As a fallback, could we enable the rename plugin on single component projects? |
Do we have a way of detecting whether we are in a single- or multi-component project? If so, we could simply make the rename handler fail informatively if it detects it is in a multi-component package. |
No, we don't. In the current design of hie-bios, there is no way to enumerate all components / modules of a project. |
Is there an issue somewhere that discusses this... perhaps a potential implementation or plan of attack? |
Hi! Yes, there is, and it requires multiple steps. First, we need to be able to actually get multiple components from a build tool. To achieve that for cabal, we have implemented haskell/cabal#7489 and merged haskell/cabal#7498 which means we are more than halfway there! The remaining PR for proper support by cabal is haskell/cabal#7500. Afterwards, we would like to migrate hie-bios to use the new cabal API to see whether there are any design issues. The initial implementation for an old version of cabal show-build-info can be found here: haskell/hie-bios#301 After that, we can finally come to ghcide! We need to work on the ghcide session-loading logic which is very complicated and tricky to get right: https://github.com/haskell/haskell-language-server/blob/master/ghcide/session-loader/Development/IDE/Session.hs#L405 I can be helpful on every step you want to tackle here, just ask for a couple clarifications and I can give you for cabal/hie-bios stuff step-by-step instructions. |
I am curious how this is going. As an HLS user, I certainly would love to see this come to fruition! (Having to load in each component at my work codebase is still a sore spot!) |
Given that this doesn't appear to be happening any time soon, does anyone know how easy it might be to relax the explicit-export-list restriction for renaming local names? It's quite silly that I can't rename module M where
f x = () |
@georgefst it is likely to happen rather soon for ghc versoins > 9.4 once #3462 lands and the next major cabal release. However, for your specific case, I think it should be easy to lift the restriction. |
Ah yes, I'd forgotten that this is yet another thing which will be solved by #3462 (although it is actually clear now that I've read the whole thread). |
Multiple home unit support now exists, so I think this should now be possible. It would still need some work:
But that seems pretty doable! |
haskell-language-server/haskell-language-server.cabal
Lines 134 to 137 in e1075e8
//cc @pepeiborra @OliverMadine
After enabling the plugin we will track here the multi component support for renaming here
The text was updated successfully, but these errors were encountered: