Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to load project with spaces on its absolute path #4225

Open
arbitrary-dev opened this issue May 12, 2024 · 3 comments
Open

Failure to load project with spaces on its absolute path #4225

arbitrary-dev opened this issue May 12, 2024 · 3 comments
Labels
build tool: cabal status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@arbitrary-dev
Copy link

Your environment

Which OS do you use?
Gentoo

Which version of GHC do you use and how did you install it?
9.8.2 compiled from sources

How is your project built?

cabal-version:      3.0
name:               project
version:            0.1.0.0
-- synopsis:
-- description:
license:            NONE
author:             Me
maintainer:         no
-- copyright:
category:           Testing
build-type:         Simple
extra-doc-files:    CHANGELOG.md
-- extra-source-files:

common warnings
    ghc-options: -Wall -main-is Server

executable app
    import:           warnings
    main-is:          Main.hs
    -- other-modules:
    -- other-extensions:
    build-depends:
        ...
    hs-source-dirs:   app
    default-language: GHC2021

Which LSP client (editor/plugin) do you use?
neovim + lsp-configs

Which version of HLS do you use and how did you install it?
2.7.0.0 compiled from sources

Have you configured HLS in any way (especially: a hie.yaml file)?
Nope

Steps to reproduce

Put a sample project on a path with spaces, e.g:
/tmp/ab c/project

Expected behaviour

HLS successfully loads the project.

Actual behaviour

 Diagnostics:
 Loading the module '/tmp/ab c/project/app/Main.hs' failed.

 It may not be listed in your .cabal file!
 Perhaps you need to add `Main` to other-modules or exposed-modules.

 For more information, visit: https://cabal.readthedocs.io/en/3.4/developing-pa
 ckages.html#modules-included-in-the-package
@arbitrary-dev arbitrary-dev added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels May 12, 2024
@fendor
Copy link
Collaborator

fendor commented May 12, 2024

Hi, thank you for your bug report!

This seems to be a bug in cabal, see haskell/cabal#8875. That's quite unfortunate, I am not sure whether there is any actionable workaround for this issue.

@arbitrary-dev
Copy link
Author

Perhaps the workaround for HLS would be to allow for a setting to use relative paths when calling Cabal. Because as I see in haskell/cabal#8875 and confirmed locally, using Cabal without specifying the absolute path works just fine. That way I can just initialize HLS while at the root of my project and be just fine. What do you think?

@fendor
Copy link
Collaborator

fendor commented May 12, 2024

That workaround is slightly tricky, as we would need to figure out to which .cabal file a filepath is most likely to be relative to.

Also, as I tested in haskell/cabal#8875 (comment), it is also broken if there are spaces in the hs-source-dir, for which there is no workaround at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: cabal status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants