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:
_Originally posted by @pepeiborra in https://github.com/haskell/ghcide/pull/782#issuecomment-691618901_
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.
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.jsonbut ideally somewhere more portable).