Ghcide: Give the user a choice of implicit cradle if there is more than one

Created on 13 Sep 2020  路  8Comments  路  Source: haskell/ghcide

I think this is great and I'm happy to merge it, but I have a couple of requests that can either be done in this PR of in follow-ups:

  1. Inform the user that there is no cradle #788
  2. Write the implicit cradle to disk
  3. Give the user a choice if there are both stack and cabal project descriptors
  4. Delete all the cradle files from ghcide and hls - no longer needed

_Originally posted by @pepeiborra in https://github.com/haskell/ghcide/pull/782#issuecomment-691618901_

implicit-hie enhancement

Most helpful comment

In the cradle-less plan where the implicit cradle is always used by default, I can see how you need config in case there is more than one choice.
My preference would be for a 3-way option "Ask/Cabal/Stack" where Ask is the default value and the answer is recorded in the project file system (e.g. in vscode/settings.json but ideally somewhere more portable).

All 8 comments

Additionally, it would be nice to define a default selection. E.g., personally I always want to use cabal and don't want to be asked again and again what type of cradle I want to have generated.

Rather than a selection feature, just write it to disk?

Yeah, that probably suffices, it is not that bad to select once per project what tool you want to use.

A init param and/or lsp client setting, --default-build-tool would be great for this and maybe could be used for other things

Just keep things simple. Ask the user to pick Cabal or Stack, generate it and write it to disk. Zero configuration, fewer questions, hopefully less issues raised about it.

In the cradle-less plan where the implicit cradle is always used by default, I can see how you need config in case there is more than one choice.
My preference would be for a 3-way option "Ask/Cabal/Stack" where Ask is the default value and the answer is recorded in the project file system (e.g. in vscode/settings.json but ideally somewhere more portable).

Would the question be asked by means of window/showMessageRequest?

I would suggest storing the answer in a file in the project root, called something explicit like hie-implicit-choice, and populated with some explanation of what it means.

The settings.json belongs to the lsp spec, right? Any client can send a didChangeConfiguration request with the json so emacs, vim, etc can use it.
So i would use it instead add more config files.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

i-am-the-slime picture i-am-the-slime  路  9Comments

emilypi picture emilypi  路  8Comments

meditans picture meditans  路  6Comments

istathar picture istathar  路  8Comments

ndmitchell picture ndmitchell  路  3Comments