nwolverson / purescript-language-server

MIT License
183 stars 41 forks source link

Insert module header into empty .purs files automatically #169

Closed i-am-the-slime closed 2 years ago

i-am-the-slime commented 2 years ago

This change inserts

module Path.From.Src.Directory where

import Prelude

when opening empty .purs files. This makes these files compile instead of being invalid modules.

https://user-images.githubusercontent.com/1588055/144762071-9729f321-c469-4eba-af81-0443f0530d94.mov

nwolverson commented 2 years ago

Per discord discussion, some people use alternate (additional) prefixes for module name in addition to the path, in particular the Test. prefix to those files under test/, which convention is used by spago init (and this is not universal).

I'm minded to accept this PR as-is (once I try it out), and look at adding a configurable prefix-mapping.