haskell / haskell/haskell-language-server
restrict `autoImports` to `base` or another list of libraries
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 13
Description
**Is your feature request related to a problem? Please describe.**
We teach a Haskell course and automatically grade student submissions. We do this using https://github.com/cxandru/haskell-submission-tester, where each exercise is tested by the test suite of a cabal project with specified dependencies. I assume that because of the way students' installation is set up they work in a global project with a bunch of packages available, so `haskell.plugin.ghcide-completions.config.autoExtendOn` imports things from all sorts of packages that aren't `base`, meaning we can't grade their submissions. Often nothing from the imported modules is even used. Imports include really strange things such as:
```
System.Directory.Internal
Unicode
Network.TCP
import Control.Monad.Identity ( replicateM ) (instead of the sane import from Control.Monad)
import Distribution.Simple.Flag (BooleanFlag)
import Distribution.Simple.Hpc (guessWay)
```
all in exercises with business logic entirely unrelated to any of these packages. I can only imagine that the autocompletion runs wild completely.
**Describe the solution you'd like**
We would like to have students be able to still use autocompletion, but only for modules in base
**Describe alternatives you've considered**
Telling students to disable autocompletion entirely.
Supply students templates within a `cabal` project with restricted dependencies. I assume hls would then adjust what it suggests? The problem with this would be that it exposes additional complexity to students that might cause to more issues.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how the `haskell.plugin.ghcide-completions.config.autoExtendOn` setting is read and how it controls automatic imports. Determine how a `base`-only or explicitly configured library list can be represented without disabling autocompletion. Done means suggestions and automatic imports are restricted to the allowed libraries while existing unrestricted behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100