Skip to content

Support projects in subfolders #1016

Open
@ColonelPhantom

Description

@ColonelPhantom

Is your feature request related to a problem? Please describe.

I'm currently working on a project of which a Haskell project is only a small part. When trying to open the root folder in VSCode however, the Haskell extension does not pick up on the Stack project in the Haskell-specific subfolder.

Describe the solution you'd like

I would like the extension to select the Haskell project folder by looking for stack.yaml/*.cabal/whatever files, instead of just naively picking the opened folder as Haskell project folder.

This is also what Kate does, its LSP client default configuration has the following line for HLS:
"rootIndicationFileNames": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml"]

Describe alternatives you've considered

  • Just open the Haskell project in a separate VSCode window, and have two windows open (kind of annoying imo)
  • Allow creating a file that instructs HLS where to actually find the project (a bit hacky, but would be a decent workaround)
  • Open both toplevel and projects in a multi-root workspace

Additional context

Consider the following folder layout:

toplevel
| - project
| | - stack.yaml, project.cabal, src/, all other parts of a Haskell project
| - otherStuff

In my example, I open toplevel in VSCode (instead of project), but want HLS to use project as root folder.

So if I open the file project/src/Main.hs, I want HLS to start with Directory: toplevel/project, not Directory: toplevel which causes it to miss the stack/cabal files that allow it to know what dependencies I am using etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions