curry-language-server icon indicating copy to clipboard operation
curry-language-server copied to clipboard

Use project-local `.curry` as output directory if workspace contains multiple projects

Open fwcd opened this issue 1 year ago • 0 comments

Consider the following project layout

<workspace>
├─ .curry
├─ project1
│  ├─ .curry
│  ├─ src
│  └─ package.json
└─ project2
   ├─ .curry
   ├─ src
   └─ package.json

Currently, the language server will use <workspace>/.curry as an output directory in any case since defaultOutDir points to ./.curry and the language server's working directory is the workspace:

https://github.com/fwcd/curry-language-server/blob/668edfc7fe34e1023549a61a84d94a2a63cec97e/src/Curry/LanguageServer/Index/Store.hs#L261

Given that the user will compile projects anyway from their respective subdirectories, it would make sense for the language server to use the local .curry directories as well, which is what this PR does. This additionally prevents clashes if the user has a module under the same name in multiple packages and unexpected cross-visibility between packages in the same workspace once compiled.

Some more testing is needed, however, especially to make sure that dependencies use the correct out dir too etc.

fwcd avatar Jun 15 '23 22:06 fwcd