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

Users should be able to specify multi-repl support and opt-out of it, if unsupported. #4178

Closed
fendor opened this issue Apr 16, 2024 · 1 comment · Fixed by #4179
Closed
Assignees
Labels

Comments

@fendor
Copy link
Collaborator

fendor commented Apr 16, 2024

We added support for loading multiple component loading in #3462 and since then, we had a couple of bug reports and other issues, such as haskell/cabal#9860.

We improve the situation by adding a hie-bios configuration and expand this configurability to HLS itself: It should be possible to use the cabal multi-repl feature by toggling an option in the lsp client.

To achieve that, introduce a new LSP config:

Description: Specify the project loading strategy of the Language Server. It allows the build tool (such as cabal or stack) to load multiple components at once. While this can lead to an improved IDE experience, it is an experimental feature. Only change to "Single Component" when you encounter issues with cabal.

Configs:

  • Single Component: Always load only a single component at a time. This is the most reliable option if you encountered any issues with the other options.
  • Multiple Components: Allow the build tool to setup a multiple component session, if the build tool supports it. At the moment, only cabal supports loading with multiple components. If the cabal version does not support load multiple components at once, HLS falls gracefully back to "Single Component" mode
  • Auto: Let HLS decide how to load your project. For build tools that support it, HLS will use "Multiple Components" and otherwise "Single Component". Starting from the cabal version 3.12, cabal supports loading of multiple components at once.

Related issue: #3738

@fendor
Copy link
Collaborator Author

fendor commented Apr 19, 2024

There are two main goals that we need to reconcile in this issue:

  • We want to honour user configuration (explicitly enabling/disabling multi-repl)
  • We want to provide the best IDE experience (which, to the best of our knowledge, uses cabal's multi-repl feature)

I am proposing here the different scenarios a regular user could encounter, and how HLS should behave.

We have the following assumptions:

  • cabal-3.12 supports --enable-multi-repl feature
  • We cannot know on HLS startup, whether the user has multi-repl explicitly enabled
    • multi-repl is disabled by default
    • We can only check whether it is enabled, when cabal repl target1 target2 fails with a specific error message
  • We want to use multi-repl by default

Scenarios

  1. User has cabal-3.12 installed and wants to use multi-repl feature (happy path).
  • Solution 1: multi-repl is enabled by default
  • Solution 2: hie.yaml file with the contents cradle: { cabal: { multi-repl: True }}
  • Solution 3: LSP setting Multiple Components
  1. User has cabal-3.12 installed and doesn't want to use multi-repl feature.
  • Solution 1: hie.yaml file with the contents cradle: { cabal: { multi-repl: False }}
  • Solution 2: LSP setting Single Component
  1. User has cabal < 3.12 installed
  • Solution 1: Fallback to Single Component mode
  1. User has cabal-3.12 installed and cannot use multi-repl due to custom setup issues.
  • Solution 1: hie.yaml file with the contents cradle: { cabal: { multi-repl: False }}
  • Solution 2: LSP setting Single Component
  1. User uses stack (or any other cradle type)
  • As stack doesn't support Multiple Components option, nothing should change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant