How to fix incorrect module name errors in Daml Studio?

Sometimes Daml Studio (VS Code) can give false positive errors on wrong module names. I had a file A.daml with the following content:

module A where

Note, that I accidentally created the file a.daml and renamed later.

1 Like

This is a known issue with VS Code on Mac OS, though it may also affect Windows since that, too, has a case-insensitive file system by default.

VS Code somehow remembers the original case of files and folders, even across renames. So if you have a chain of renames a.daml -> A.daml -> A2.daml -> A.daml, VS Code still thinks the file is called a.daml.

This “memory” of old names appears to be part of the workspace. In some cases, it can easily be fixed by closing all tabs in the workspace, and restarting VS Code.

If that doesn’t help, as a last resort, you can copy your project to a new folder, which will trick VS Code into regenerating the entire workspace anew.

5 Likes